Document Status | Status |
---|
colour | Blue |
---|
title | in-progress |
---|
|
|
---|
Document Owner(s) | Capovilla, Evandro |
---|
Reviewers | |
---|
🛠️ 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.
...
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
...
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 |
---|
title | src/pages/cart/payment/order-payment/use-order-payment.ts |
---|
|
Code Block |
---|
| 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 |
---|
title | src/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 |
---|
title | src/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 |
---|
title | src/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 |
---|
title | src/paycomet-core/commons.types.ts |
---|
|
Code Block |
---|
| export class VaultedSchemeDto extends PaymentMethodBase {
@ApiProperty({
required: false,
example: 'John Smith',
description: 'Cardholder name',
})
@IsString()
@IsOptional()
public cardholderName?: string;
} |
|
...
Expand |
---|
title | src/payment/payment.service.ts |
---|
|
Code Block |
---|
| 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
...
Whitelabel App (Already done)
Expand |
---|
title | src/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 |
---|
title | src/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 |
---|
title | src/payment/preauth/preauth.service.ts |
---|
|
Code Block |
---|
| public async processPreAuth(...){
...
const customer = this.paycometHelper.buildUserDetails(region, cellphone, email, request);
...
} |
|
...
Vaulted
Payment made with a vaulted card
Whitelabel App (Already done)
Expand |
---|
title | src/pages/cart/payment/order-payment/use-order-payment.ts |
---|
|
Code Block |
---|
| ddddsadsaconst processOrderWithAccount = useCallback(...) => {
...
paycometCommitInput = {
...
...commitInput,
payment: {
fullName: payCometValues.nameOnCard || '',
paymentMethodBrand: paymentAccount?.paymentMethodBrand ?? undefined,
billingAddress,
},
}
...
} |
|
Expand |
---|
title | src/payment/payment.service.ts |
---|
|
Code Block |
---|
| 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
⚠️ Call-outs
This functionality is made exclusively for the PSP Paycomet which is used in the Spanish and Portuguese environments.