@@ -51,17 +51,25 @@ protected async Task<decimal> CommitApplicationAsync(LicenceAppBase licAppBase,
51
51
HasValidSwl90DayLicence = HasSwl90DayLicence
52
52
} , ct ) ;
53
53
LicenceFeeResp ? licenceFee = price ? . LicenceFees . FirstOrDefault ( ) ;
54
+
55
+ //applications with portal origin type are considered authenticated, otherwise not.
56
+ bool IsAuthenticated = licAppBase . ApplicationOriginTypeCode == Shared . ApplicationOriginTypeCode . Portal ? true : false ;
57
+ bool isNewOrRenewal = licAppBase . ApplicationTypeCode == Shared . ApplicationTypeCode . New || licAppBase . ApplicationTypeCode == Shared . ApplicationTypeCode . Renewal ;
58
+ ApplicationStatusEnum status ;
59
+
54
60
if ( licenceFee == null || licenceFee . Amount == 0 )
55
- {
56
- if ( companionAppId != null ) await _licAppRepository . CommitLicenceApplicationAsync ( ( Guid ) companionAppId , ApplicationStatusEnum . Submitted , null , ct ) ;
57
- await _licAppRepository . CommitLicenceApplicationAsync ( licenceAppId , ApplicationStatusEnum . Submitted , null , ct ) ;
58
- }
61
+ status = isNewOrRenewal && ! IsAuthenticated ? ApplicationStatusEnum . ApplicantVerification : ApplicationStatusEnum . Submitted ;
59
62
else
63
+ status = ApplicationStatusEnum . PaymentPending ;
64
+
65
+ // Commit the companion application if it exists
66
+ //companionAppId is the swl for sole proprietor which the business would pay for it, therefore the licence fee should be null here.
67
+ if ( companionAppId != null )
60
68
{
61
- //companionAppId is the swl for sole proprietor which the business would pay for it, therefore the licence fee should be null here.
62
- if ( companionAppId != null ) await _licAppRepository . CommitLicenceApplicationAsync ( ( Guid ) companionAppId , ApplicationStatusEnum . PaymentPending , null , ct ) ;
63
- await _licAppRepository . CommitLicenceApplicationAsync ( licenceAppId , ApplicationStatusEnum . PaymentPending , licenceFee . Amount , ct ) ;
69
+ await _licAppRepository . CommitLicenceApplicationAsync ( ( Guid ) companionAppId , ApplicationStatusEnum . PaymentPending , null , ct ) ;
64
70
}
71
+ // Commit the main licence application
72
+ await _licAppRepository . CommitLicenceApplicationAsync ( licenceAppId , status , licenceFee ? . Amount , ct ) ;
65
73
66
74
return licenceFee ? . Amount ?? 0 ;
67
75
}
0 commit comments