Please enable JavaScript.
Coggle requires JavaScript to display documents.
SUBSCRIPTION CRON - Coggle Diagram
SUBSCRIPTION CRON
Get List of Billable Subscription
select e from #{#entityName} e where nextInstallmentDue < CURRENT_TIMESTAMP and e.deletedAt is null
Filter Results that have status that
canRecur = true
Iterate Billable Subscription
Get Subscription CreditBalance
Grpc call to Account Service
getSubscriptionCreditBalance by subscription OrgID
Calculate Subscription Amount Due
Initial value is zero then add subscription plan price
Iterate Subscription Feature and get filter
Subscription feature that status is not Cancelled
If found then add feature price to the amount due
Create Installment by
(subscription, amoundDue, CreditBalance, dry)
Grpc call to account service to get Organization detail by subscription org id
(stub.getOrganizationDetai)
Amount Due is > 0
Yes then Process Payment
Grpc call to Payment service
grpcClient.processCardTransaction
if succeed Update paid At
1 more item...
No then proceed to Create Installment process
Process Installment
if dry is false (cron job is false)
then save new installment
Create Installment items from subscription feature
Calculate Next Installment Due
Default value is current date if has existing subscription then it will vary
if Period is days, weeks, months and years