Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Table of Contents

Backend

Architecture AS-IS

intl-whitelabel-app

The app has two possible backend services: intl-whitelabel-graphql or intl-fulfillment-service. The ENABLE FULFILLMENT FT controls which service is used. Today, BK-PT is using whitelabel graphql, but BK-ES is using fulfillment service, for Dev environments.

Servers:

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:

          ...
          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 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 is for wrong order status and should not require changes to work with card payments at home.

    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);
      }
    }

For the winrest integration, the code messages the POS vendor configured in the rbi/{env}/{brand}/partners-api secret inRBI account secrets DynamoDB table.

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 PAYI-336 - Getting issue details... STATUS

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

Frontend

Assumptions and possibilities

For this new feature, some places in the WL App can be impacted depending on the UI/UX that we design for the proposals:

  • Method payment selection

  • Order confirmation

  • Recent orders

Other possible places:

  • Email receipt

Method payment selection

Order confirmation

As the flow will be similar to the payment with cash option we believe that we'll not need to change many details on this screen and we'll just change the information about the payment method.

Recent orders

What about the recent orders page? The user will receive any information about the pending payment?

Email receipt

I think that we'll need to return the payment method description for this new method. A possibility about this email template is that it is controlled/used in Amazon SNS. I'll validate this with Caes, Guilherme

  • No labels