Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Document Status

Status
colourBlue
titlein-progress

Document Owner(s)

Capovilla, Evandro

Reviewers

...

Info

Pre-auth removal refence: https://rbictg.atlassian.net/wiki/spaces/TRX/pages/4312367174/Paycomet+-+Pre-auth+removal#Integration-steps-TO-BE-(Delivery)

Whitelabel App (Already done)

The frontend will be responsible for displaying and retrieving the cardholderName field and sending this information to paycomet. Nowadays this information is already sent via Paycomet forms, but they also need it to be sent via the merchantData field.

...

Expand
titlesrc/modules/legacy/legacy.service.ts

Before

Code Block
paycometSale = {
  ...,
  fullName: paymentUserDetails.name!,
  ...,
};

After

Code Block
paycometSale = {
  ...,
  fullName: payment?.fullName || paymentUserDetails.name!,
  ...,
};

Payment Service (Already done)

Expand
titlesrc/functions/graphql/utils/make-payment.ts
Code Block
private mapPaymentMethod(
    params: IPaycometPaymentSaleEvent,
  ): {
    paymentMethodType: string;
    paymentMethod: string;
  } {
    const isVaultedPayment = !params.storePaymentMethod && params.storedPaymentMethodId;

    if (isVaultedPayment) {
      return {
        paymentMethodType: params.paymentType,
        paymentMethod: JSON.stringify({
          ...,
          cardholderName: params?.fullName,
          ...,
        }),
      };
    }

    return {
      paymentMethodType: params.paymentType,
      paymentMethod: JSON.stringify({
        ...,
        cardholderName: params?.fullName,
        ...,
      }),
    };
  }

...

Info

Pre-auth reference: /wiki/spaces/TRX/pages/3929702586

Whitelabel App (Already done)

Expand
titlesrc/pages/cart/payment/order-payment/paycomet-hosted-page-payment/paycomet-vaulted-card.tsx
Code Block
generateCreatePreAuthorization({
        variables: {
          input: {
            ...,
            cardHolderName: paymentValues.nameOnCard,
            ...,
          },
        },
      });

GraphQL (Already done)

Expand
titlesrc/functions/graphql/providers/payments.ts
Code Block
public async createPreAuthorizationPaycomet({...}){
  const paycometPreauth =
    await this.paymentsClient.paycometClient.request<ICreatePreAuthorizationResponse>((apis) =>
      apis.paymentsApi.createPreAuthorization({
        iCreatePreAuthorizationRequest: {
          ...,
          cardHolderName,
          ...,
        },
        region: regionCountry,
      }),
    );
}

...

Expand
titlesrc/payment/preauth/preauth.service.ts
Code Block
languagetypescript
public async processPreAuth(...){
  ...
  const customer = this.paycometHelper.buildUserDetails(region, cellphone, email, request);
  ...
}

...

Vaulted

No update required

...

Vaulted - Pre-auth

No update required

...

Update phoneNumber field to use user accounts or delivery data

The idea here is to mainly use the phoneNumber from the cart page ( delivery mode ) and if it doesn't exist, we use the phoneNumber from the user data ( restaurant mode ). If neither of these fields exist, we are sending that data as empty.

...