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

...

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

✅ Proposed Solution

...

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/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

Payment made with a vaulted card

Whitelabel App (Already done)

...

No update required

...

Vaulted - Pre-auth

No update required

...

Update phoneNumber field to use user accounts or delivery data

Whitelabel App

Expand
titlecart/payment/order-payment/use-order-payment.ts

One-time:

Code Block
languagetypescript
ddddsadsaconst processOrderWithAccount = useCallback(const {
  ...),
=> { ...
paycometCommitInputorderPhoneNumber,
} = useOrderContext();
{
const  ...
 placeOrder = useCallback(async () => {
  ...commitInput,
  
  payment:const {userPaymentDetails = enablePaycometPaymentUserDetails
    fullName: payCometValues.nameOnCard || '',? {
        paymentMethodBrandphoneNumber: orderPhoneNumber paymentAccount?? auth.paymentMethodBrand user?.details? undefined.phoneNumber,
      billingAddress,  email: auth.user?.details?.email,
      },
    : undefined;
    }
  ...
  
}

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

public async handlePurchase(...){ ... const customer = this.paycometHelper.buildUserDetails(region, cellphone, email, request)

Vaulted:

Expand
titlesrc/payment/payment.service.ts
Code Block
languagetypescript
Code Block
const {
  ...,
  orderPhoneNumber,
} = useOrderContext();

const processOrderWithAccount = useCallback(async () => {
  ...
  
  const userPaymentDetails = enablePaycometPaymentUserDetails
    ? {
        phoneNumber: orderPhoneNumber ?? user?.details.phoneNumber,
        email: user?.details?.email,
      }
    : undefined;
    
  ...
  
}
Expand
titlepaycomet-hosted-page-payment/paycomet-vaulted-card.tsx
Code Block
const { setRepriceOrderAfterNavigate, orderPhoneNumber } = useOrderContext();

...

if (rbiOrder?.rbiOrderId && accountIdentifier && vaultedPaymentConfirmed) {
  ...
  const userPaymentDetails = enablePaycometPaymentUserDetails
      ? {
          phoneNumber: orderPhoneNumber ?? auth.user?.details?.phoneNumber,
          email: auth.user?.details?.email,
        }
      : undefined;
  ...
}
Expand
titlepaycomet-hosted-page-payment/paycomet-credit-card-form/paycomet-credit-card-form.tsx
Code Block
const { setRepriceOrderAfterNavigate, orderPhoneNumber } = useOrderContext();

...

if (rbiOrder?.rbiOrderId && tpvToken) {
  ...
  const userPaymentDetails = enablePaycometPaymentUserDetails
      ? {
          phoneNumber: orderPhoneNumber ?? user?.details?.phoneNumber,
          email: user?.details?.email,
        }
      : undefined;
  ...
}

Vaulted - Pre-auth

...

🎛️ Configuration

Info

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

...