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

Table of Contents
stylenone

🛠️ Potential Solutions

Assumptions

  • We are sending the name as the first string until de empty string.

  • We are sending the surname as the rest of the name after the first empty string

  • We are using the same feature flag to send user details to send first name and last name data

#1 - Send cardholder name field to paycomet

The idea is to send the cardholder name in the merchantData in the make payment request to paycomet.

...

✅ We guarantee that the name is related to the credit card

#2 - Send profile user’s name to paycomet

The idea is to get the profile user’s name to send the information to paycomet.

...

(error) We can’t guarantee that the name is related to the credit card

✅ Proposed Solution

#1 - Send cardholder name field to paycomet

One time

Payment made with a new credit card

...

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/pages/cart/payment/order-payment/use-order-payment.ts
Code Block
languagetypescript
commitInput = {
            creditType: payCometValues.cardType,
            order,
            payment: {
              fullName: payCometValues.nameOnCard || '',
              ...,
            },
            ...,
          };

GraphQL

Today we get the username from user accounts instead of getting the credit card name, which is already sent by whitelabel.

Expand
titlesrc/functions/graphql/resolvers/orders.ts

Before

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

After

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

Fulfillment

The same that we did for graphql we need to replicate in the fulfillment

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

Paycomet Service

Expand
titlesrc/paycomet-core/commons.types.ts
Code Block
languagetypescript
export class VaultedSchemeDto extends PaymentMethodBase {
  @ApiProperty({
    required: false,
    example: 'John Smith',
    description: 'Cardholder name',
  })
  @IsString()
  @IsOptional()
  public cardholderName?: string;
}

...

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

...

Pre-auth

Payment made with a new credit card and pre-auth is enabled

...

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

Paycomet Service

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

...

Vaulted

Payment made with a vaulted card

Whitelabel App (Already done)

Expand
titlesrc/pages/cart/payment/order-payment/use-order-payment.ts
Code Block
languagetypescript
ddddsadsaconst processOrderWithAccount = useCallback(...) => {
...
paycometCommitInput = {
  ...
    ...commitInput,
    payment: {
      fullName: payCometValues.nameOnCard || '',
      paymentMethodBrand: paymentAccount?.paymentMethodBrand ?? undefined,
      billingAddress,
    },
  }
  ...
}

Paycomet Service (Should already be done by one-time task)

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

...

Vaulted - Pre-auth

No update required

🎛️ Configuration

Info

Include here any configuration required (Sanity, LaunchDarkly flags, etc.) required to enable the solution.

🧑‍🚒 QA Plan

Info

We can create the test cases following the doc below

[Test Cases] [Deprecated] Visa/Sibs - new mandatory fields

⚠️ Call-outs

This functionality is made exclusively for the PSP Paycomet which is used in the Spanish and Portuguese environments.