Technical refinement - Backend

 

Repos that we’ll change:

Packages: https://github.com/rbilabs/intl-packages

Loyalty: https://github.com/rbilabs/intl-loyalty

Fulfillment: https://github.com/rbilabs/intl-fulfillment-service

PSP Paycomet Service:

Whitelabel Graphql:

 

Sequence Diagram

 


 

Business rules

  • A new Bizum payment must be created for Paycomet. ( )

  • This payment must work the same as Paycomet's PayPal, it must generate a link and be used in an Iframe where the payment will be processed.


Tasks breakdown

Task 1: Add Bizum payment to packages

Repo: intl-packages

Bizum payment must be added in CartGooglePaymentTypeExclusion, XenialDeliveryPayTypeId and RBIPaymentCard.

After adding this, run the yarn build command.
Reminder: when making any modifications to the package, the other repositories only receive these new modifications after running Bumps.

*Consider only changes to ENUM and Types in POC

 

Task 2: Update Loyalty

Repo: intl-loyalty

  • In the "loyalty-middleware" folder, update the packages

  • Bump the new version of @rbilabs/intl-payments in intl-loyalty/loyalty-middleware

  • Build the loyalty middleware: yarn install && yarn build

  • Generate the loyalty middleware sdk: yarn sdk:generate . This creates loyalty middleware SDK with MdwRBIPaymentCard

  • Then, finally, in WL-GQL you can load this latest version of intl-loyalty-middleware-sdk

image-20240206-113818.png
image-20240206-114456.png

 

PR Reference: https://github.com/rbilabs/intl-loyalty/pull/426/

Task 3: Fulfillment

Repo: intl-fulfillment-service

  • Update Packages

  • Define Bizum in CARD_TYPE_TO_MDW

     

  • Define Bizum in MAP_GQL_CART_PAYMENT_TO_COMMON

     

  • Define Bizum in MAP_GQL_CART_PAYMENT_TO_RBI_COMMON

Task 4: Added Bizum payment to Paycomet

Repo: intl-psp-paycomet-service

Today, the PSP only works with PayPal, but refactoring is needed so that payment with a link works for PayPal and Bizum.

To works Bizum on the Paycomet API, it’s necessary just configure the methods fields with 11.

const checkout = await this.client.exec( region, new TransactionLinkUrl.Request({ terminal: store.terminal, language: request.language ?? '', operationType: 1, payment: { terminal: store.terminal, methods: [11], amount: request.amount, order: request.rbiOrderId, currency: 'EUR', secure: 0, productDescription: request.orderDescription, userInteraction: 1, urlOk: returnUrl, urlKo: returnUrl, }, }), );

 

But the implementation must be modular, work for PayPal and Bizum without having code repetitions.

My suggestion is to refactor all files and code related to PayPal, and make it modular, with a name suggestive of payment with Link.

Example:

In the POC, I left this ready, but validation from the team is necessary.

If necessary for creating a separate task:

  • Links

    • Add BIZUM in TypePayment and define Controller DTO.

    • Refactor to remover PayPal and add Link (Pay with Link).

    • Generate Link to PayPal or Bizum.

  • Outcome

    • Add BIZUM in TypePayment and define Controller DTO.

    • Refactor to remover PayPal and add Link (Pay with Link).

  • Payment Core

    • Add TransactionMethodId to Bizum with code 11

       

    • Change function to identify payment with PayPal to identify payment with Link.

       

  • Payment

    • Change confirm payment function to works all payments with link and not only Paypal: this.confirmPaymentPaypal => this.confirmPaymentLink

 

Task 5: Added Bizum payment to GraphQL.

Repo: intl-whitelabel-graphql

POC:

  • It’s necessary to add BIZUM in CartPaymentCardType (order.gql) and generate GraphQL.

    • Run yarn update-packages

    • Add Bizum

       

    • Run yarn graphql:types

       

  • Define Bizum in CARD_TYPE_TO_MDW

     

  • Define Bizum in MAP_GQL_CART_PAYMENT_TO_COMMON

     

  • Define Bizum in MAP_GQL_CART_PAYMENT_TO_RBI_COMMON

     

  • Now run command:

    • yarn build