deposits are pushed by the user and the amount is credited into our circle master-account. Therefore we need to monitor that account, (or rather the payments into it) and transfer all money from there into the user-account.
two options: 1) We pull in regular intervals 2) we create a server that we can register in their api to receive push-notifications
both will give us a payment info that we can than use to initiate a transfer from our master wallet into the user wallet.
challenge here will be to make it such that we its not possible to do the same transfer twice -> solution: circle transfers have an idempotency-key that assures that we only do such a transfer once.
Proposed Flow:
For each user (identified by the accountId & walletId):
1) We regularly pull all payments (of all status confirmed)[1], then filter out those where the source_id matches the accountId. these are identified by the 'paymentId'
2) We pull all transfers we initiated from our masterWallet to their walletId, identified by their idempotencyKey
3) If there is no transfer where idemKey == paymentId, we create a new one, from our masterWallet to the user walletId
4) Final State: Once the money is in the wallet of the user, it will be shown in their balance
[1] to optimize this later, we can pull only those payments that have occured after the date of the last transfer to their account, but for now lets just pull all and do some filtering.
@h-vishal what do you think of the above...I am a bit tempted to try setting up a notifications server as described here but it will probably take longer than expected as I have never done so before..
deposits are pushed by the user and the amount is credited into our circle master-account. Therefore we need to monitor that account, (or rather the payments into it) and transfer all money from there into the user-account.
two options: 1) We pull in regular intervals 2) we create a server that we can register in their api to receive push-notifications
both will give us a payment info that we can than use to initiate a transfer from our master wallet into the user wallet.
challenge here will be to make it such that we its not possible to do the same transfer twice -> solution: circle transfers have an idempotency-key that assures that we only do such a transfer once.
Proposed Flow:
For each user (identified by the accountId & walletId):
3) If there is no transfer where idemKey == paymentId, we create a new one, from our masterWallet to the user walletId
[1] to optimize this later, we can pull only those payments that have occured after the date of the last transfer to their account, but for now lets just pull all and do some filtering.