ArboreumDev / credit-union-frontend

Frontend in Next.js + Typescript + GraphQL
https://frontend-two-sandy.vercel.app
1 stars 0 forks source link

move fiat deposits into user wallet #213

Open djudjuu opened 3 years ago

djudjuu commented 3 years ago

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] 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.

djudjuu commented 3 years ago

@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..

do you have experience doing that?