...
1. Deposit flow
Current flow:
...
Administrator from AdminPanel sends following mutation
Code Block |
---|
type Mutation {
adminDeposit(
currencyId: String!,
paymentInterfaceId: String!,
address: String!,
amount: Float!,
documentId: String
): String
} |
Service "paymentGateway" receive this mutation and call action “processTransaction” of service "operations"
Code Block |
---|
await ctx.call('paymentGateway.processTransaction', {
txid: String(ctx.params.documentId || new Date().getTime()), // # bank transaction or if it is Null - unix time
amount: Number(ctx.params.amount), // deposit amount
paymentInterfaceId: piId, // fiat payment interface ID
currencyId: ctx.params.currencyId, // deposit currency ID
address: ctx.params.address, // user ref No
}); |
Deposit flow without administrator participation:
...
To do this, in the payment interface it is necessary to implement the receipt of information from the bank. And if a deposit has arrived from the client, trigger call the action paymentGateway. processTransaction of service “operations” with parameters:
txid - String - original bank document ID
amount - Number - amount of payment
paymentInterfaceId - String
currencyId - String
address - String - user refNo from payment description
Example call:
Code Block |
---|
await ctx.call('paymentGateway.processTransaction', {
txid: String(documentId),
amount: Number(amount),
paymentInterfaceId: 'FIAT-PI',
currencyId: 'EUR',
address: 'C03457' // user ref No
}); |
If the bank uses webhooks following docs can be used https://moleculer.services/docs/0.12/moleculer-web.html
...