You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we realized that we are unable to complete incoming payments on a receiving Rafiki, because of the way we are handling single phase transfers.
Basically, during a single phase transfer (without a timeout), we successfully send money to the underlying incoming payment liquidity account when calling accountingService.createTransfer, but since we never call transaction.post -> we never end up calling incomingPayment.onCredit(), which means, we never end up marking the incoming payment as completed, even though it has received the correct amount of funds.
What we should do (IMO), is update the accountingService to split out createTransfer into createSinglePhaseTransfer and createTwoPhaseTransfer to remove any confusion about the current behaviour of createTransfer. createSinglePhaseTransfer will return Promise<TransferError | void> while createTwoPhaseTransfer will have the same signature as createTransfer: Promise<Transaction | TransferError>, where Transaction.
Both function should call onDebit and onCredit for the respective destination and source accounts upon the successful completion of the transfer.
Additionally, I think it would make sense to have a base abstract AccountingService class, in order to simplify the current createAccountToAccountTransfer function:
This can be done in several PRs, the first one to make the abstract class (while keeping all of the same functionality of createTransfer), and a second one to support createTwoPhaseTransfer and createSinglePhaseTransfer
The text was updated successfully, but these errors were encountered:
Context
After merging in:
we realized that we are unable to complete incoming payments on a receiving Rafiki, because of the way we are handling single phase transfers.
Basically, during a single phase transfer (without a timeout), we successfully send money to the underlying incoming payment liquidity account when calling
accountingService.createTransfer
, but since we never calltransaction.post
-> we never end up callingincomingPayment.onCredit()
, which means, we never end up marking the incoming payment as completed, even though it has received the correct amount of funds.What we should do (IMO), is update the accountingService to split out
createTransfer
intocreateSinglePhaseTransfer
andcreateTwoPhaseTransfer
to remove any confusion about the current behaviour ofcreateTransfer
.createSinglePhaseTransfer
will returnPromise<TransferError | void>
whilecreateTwoPhaseTransfer
will have the same signature ascreateTransfer
:Promise<Transaction | TransferError>
, whereTransaction
.Both function should call
onDebit
andonCredit
for the respective destination and source accounts upon the successful completion of the transfer.Additionally, I think it would make sense to have a base abstract
AccountingService
class, in order to simplify the currentcreateAccountToAccountTransfer
function:This can be done in several PRs, the first one to make the abstract class (while keeping all of the same functionality of
createTransfer
), and a second one to supportcreateTwoPhaseTransfer
andcreateSinglePhaseTransfer
The text was updated successfully, but these errors were encountered: