Last active
June 29, 2019 20:44
-
-
Save raj-saxena/c39a679a49c0aa27fbb108c1f4426738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BacsPayment | |
/* | |
----, | |
SQS ) => Received => AccountCheck => MandateCheck => Withdraw => Succeeded | |
----' | |
*/ | |
fun processPayment(payment: BacsPayment<Received>) { | |
try { | |
val acccountCheck: BacsPayment<AccountChecked> = accountCheck(payment) | |
val mandateCheck: BacsPayment<MandateChecked> = mandateCheck(acccountChecked) | |
val debit: BacsPayment<DebitAttempted> = debit(currencyCheck) | |
completeProcessing(debit) | |
} catch(e: BacsPaymentException) { | |
} | |
} | |
fun accountCheck(payment: BacsPayment<Received>): BacsPayment<AccountChecked> = TODO() | |
fun mandateCheck(payment: BacsPayment<AccountCheckPassed>): BacsPayment<MandateChecked> = TODO() | |
fun debit(payment: BacsPayment<CurrencyCheckPassed>): BacsPayment<DebitAttempted> = TODO() | |
fun completeProcessing(payment: BacsPayment<DebitSuccessful>): BacsPayment<Succeeded> = TODO() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment