AutoFund-workflows
SetAutoFund
sequenceDiagram
autonumber
participant UserAgent
participant AutoFundingApi
participant AutoFundingService
participant PspDb
UserAgent ->> AutoFundingApi : SetAutoFund
AutoFundingApi ->> AutoFundingService : SetAutoFund
alt settings exists
AutoFundingService ->> PspDb: AutoFundingSettingsUpdate
else settings not exist
AutoFundingService ->> PspDb: AutoFundingSettingsInsert
end
SubscriptionFeeEnforcedEvent
sequenceDiagram
autonumber
participant EnforceFeeCronJob
participant UserProfileService
participant UserService
participant ServiceBus
participant SubscriptionFeeEnforcedEventHandler
participant AutoFundingService
participant PspDb
EnforceFeeCronJob ->> UserProfileService : GetByTermsAccepted
loop foreach user
EnforceFeeCronJob ->> UserService: TryEnforceSubscriptionFee
UserService ->> PspDb: set EnforceSubscriptionFee true
UserService --) ServiceBus: SubscriptionFeeEnforcedEvent
ServiceBus --) SubscriptionFeeEnforcedEventHandler: SubscriptionFeeEnforcedEvent
SubscriptionFeeEnforcedEventHandler -> AutoFundingService: EnforceSubscriptionRenewal
AutoFundingService ->> PspDb: AutoFundingSettingsGetAll
alt settings exists
AutoFundingService ->> PspDb: AutoFundingSettingsUpdate
else settings not exist
AutoFundingService ->> PspDb: AutoFundingSettingsInsert
end
end
AvailableBalanceChangedEvent
sequenceDiagram
autonumber
participant ServiceBus
participant AvailableBalanceChangedEventHandler
participant PspDb
participant AutoFundService
ServiceBus--) AvailableBalanceChangedEventHandler: AvailableBalanceChangedEvent
AvailableBalanceChangedEventHandler ->> PspDb: GetAutoFundSettings
AvailableBalanceChangedEventHandler ->> AutoFundService: CreateAutoFundOrder
InsufficientBalanceSubscriptionSuspendedEvent
sequenceDiagram
autonumber
participant ServiceBus
participant InsufficientBalanceSubscriptionSuspendedEventHandler
participant AutoFundService
participant UserService
participant PspDb
ServiceBus--) InsufficientBalanceSubscriptionSuspendedEventHandler: InsufficientBalanceSubscriptionSuspendedEvent
InsufficientBalanceSubscriptionSuspendedEventHandler->> AutoFundService: TryAutoFundSubscriptionRenewal
AutoFundService->> UserService: HasEnforcedSubscriptionRenewal
UserService ->> PspDb: GetUserById
AutoFundService ->> PspDb: GetAutoFundSettings
alt SubscriptionRenewal Enforced or Enabled
AutoFundService ->> AutoFundService : CreateAutoFundOrder
else SubscriptionRenewal Not Enforced and Not Enabled
AutoFundService --) ServiceBus: SendEmailMessage
end