...
Backend
Architecture AS-IS
...
intl-whitelabel-graphql
Checking de commit order mutation (resolvers.Mutation.commitOrder) we can see the treatment for payments done after delivery. This process will have to be altered to include payment with card at home:
Code Block | ||
---|---|---|
| ||
...
const isSodexoOrChequeGourmet = !!payment?.paymentMethodBrand;
// we set the status to PAYMENT_REQUIRED for cash
if ((isCashPayment && cashPaymentEnabled) || isSodexoOrChequeGourmet) {
const updatedCart = {
...updatedOrder.cart,
payment: {
cardType,
paymentMethodBrand: payment?.paymentMethodBrand || undefined,
},
} as ICart;
await providers.orders.updateOrderCartAndStatuses({
cartDiff: {
previous: updatedOrder.cart,
updated: updatedCart,
},
rbiOrderId,
statusDiff: {
previous: oldStatus,
updated: RbiOrderStatus.PAYMENT_REQUIRED,
},
paymentStatusDiff: {
previous: paymentStatus,
updated: RbiOrderPaymentStatus.PAYMENT_REQUIRED,
},
});
... |
After saving the order in DynamoDB, it is processed using via intl-packages/fulfilment.
intl-packages/fulfilment
After receiving message to commit the order, the package will dispatch it to the appropiate POS Vendor and sends a message to SQS timeout queue. Here, the only payment validation check for wrong order status, and should not require changes to work with card payments at home.
Code Block | ||
---|---|---|
| ||
if (isPaymentRequired) {
// order must be in payment successful or payment required state to proceed
if (
status !== RbiOrderStatus.PAYMENT_SUCCESSFUL &&
status !== RbiOrderStatus.PAYMENT_REQUIRED
) {
throw new UnpaidCommitOrderError(rbiOrderId);
}
} else {
// non payment required means order needs to be price successful
if (status === RbiOrderStatus.PRICE_ERROR) {
throw new OrderPriceError(rbiOrderId);
} else if (status !== RbiOrderStatus.PRICE_SUCCESSFUL) {
throw new OrderStatusMismatchError(rbiOrderId, RbiOrderStatus.PRICE_SUCCESSFUL);
}
} |
Sodexo/Cheque Gourmet example
One recent change that appears to be very similar to what will be necessary for our case was the inclusion of sodexo and cheque gourmet as payment methods, that were implemented in
Jira Legacy | ||||||
---|---|---|---|---|---|---|
|
Winrest integration
To configure the integration with Winrest team, we’ll need to send them the exact string of the new payment method so they can configure it on their platform (Aligned with Paulo Silva).
...