Versions Compared

Key

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

...

Expand
titlepayment-method/types.ts
Code Block
export enum PaymentMethodBrandType {
  SODEXO = 'SODEXO',
  SODEXO_VOUCHER = 'SODEXO_VOUCHER',
  TICKET_RESTAURANT = 'TICKET_RESTAURANT',
  TICKET_RESTAURANT_VOUCHER = 'TICKET_RESTAURANT_VOUCHER',
}
Expand
titlepayment-method-options/payment-method-options.tsx
Code Block
{method?.ticket_restaurant && method?.transient && (
  <StyledOption>
    <PaymentMethodOptionItemDivider />
    <PaymentMethodAddNewItemOption
      data-testid="add-ticket-restaurant-card-payment"
      text={formatMessage({ id: ticketRestaurantLabel(isGuestOrder) })}
      Icon={styledCardIcon(PaymentMethodBrandType.TICKET_RESTAURANT)}
      onClick={e => handleTicketRestaurantOptionClick(e, 'card')}
      isLoading={isLoadingPopup} 
    />
  </StyledOption>
)}
Expand
titlepayment-method/utils/sort-payment-methods.ts
Code Block
case 'TICKET_RESTAURANT':
      return paymentMethods.filter(
        p => p?.transient && p?.sodexo && p.accountIdentifier === typeOrder
      );
Code Block
case 'TICKET_RESTAURANT_VOUCHER':
      return paymentMethods.filter(
        p => p?.transient && p?.sodexo && p.accountIdentifier === typeOrder
      );
Code Block
const paymentMethodListTypeOrder = [
  TICKET_RESTAURANT,
  TICKET_RESTAURANT_VOUCHER,
]
Expand
titlepayment-method-option/ticket-restaurant-method.tsx
Code Block
import React from 'react';

import { useIntl } from 'react-intl';

import { MethodType } from './styled';

const TicketRestaurantMethod = () => {
  const { formatMessage } = useIntl();

  return <MethodType>{formatMessage({ id: 'payWithTicketRestaurantVoucher' })}</MethodType>;
};

export default SodexoMethod;
Expand
titlepayment-method-option/index.tsx
Code Block
import TicketRestaurantMethod from './ticket-restaurant-method';
Code Block
if (method.ticketRestaurant) {
      return <TicketRestaurantMethod />;
    }
Code Block
{method.ticketRestaurant && styledCardIcon(PaymentMethodBrandType.TICKET_RESTAURANT)}
Expand
titlepayment/order-payment/use-order-payment.ts

Improve the paymentMethodBrandValue to add the Ticket Restaurant

Code Block
if (isPaycometSodexoMethodSelected || isPaycometChequeGourmetMethodSelected) {
          paymentMethodBrandValue = isPaycometSodexoMethodSelected
            ? PaymentMethodBrand.SODEXO
            : PaymentMethodBrand.CHEQUE_GOURMET;
        }
Code Block
if (payment.isFreeOrderPayment) {
        paymentAccount = {
          ticketRestaurant: null,
        };
}
Code Block
const isPaymentWithTicketRestaurantVoucher =
        selectedPaymentMethod?.ticketRestaurat &&
        selectedPaymentMethod?.paymentMethodBrand === 'TICKET_RESTAURANT_VOUCHER';
Code Block
const handleOrderCommit = useCallback(async () => {
  ...
}, 
[
  ...,
  selectedPaymentMethod?.ticketRestaurant
]
Expand
titlepaycomet-hosted-page-payment/paycomet-hosted-page-payment.tsx

Improve the paymentMethodBrandValue to add the Ticket Restaurant

Code Block
if (isPaycometSodexoMethodSelected || isPaycometChequeGourmetMethodSelected) {
          paymentMethodBrand = isPaycometSodexoMethodSelected
            ? PaymentMethodBrand.SODEXO
            : PaymentMethodBrand.CHEQUE_GOURMET;
        }
Expand
titlesrc/state/payment/constants.ts

Update all the METHOD_PLACEHOLDER to include ticket_restaurant

Code Block
export const XXXX_METHOD_PLACEHOLDER: IPaymentMethod = {
  ...
  ticketRestaurant: null,
};

Create a new METHOD_PLACEHOLDER for ticket_restaurant and ticket_restaurant_voucher

Code Block
export const TICKET_RESTAURANT_METHOD_PLACEHOLDER: IPaymentMethod = {
  ...
  ticketRestaurant: true,
};

export const TICKET_RESTAURANT_VOUCHER_METHOD_PLACEHOLDER: IPaymentMethod = {
  ...
  ticketRestaurant: true,
  fdAccountId: 'CASH',
  accountIdentifier: 'TICKET_RESTAURANT',
  paymentMethodBrand: 'TICKET_RESTAURANT',
};
Expand
titlestate/payment/types.ts
Code Block
export enum PaymentMethodBrand {
  TICKET_RESTAURANT = 'TICKET_RESTAURANT',
  TICKET_RESTAURANT_VOUCHER = 'TICKET_RESTAURANT_VOUCHER',
}
Expand
titlestate/payment/hooks/use-payment.tsx
Code Block
const cashAccount: IPaymentMethod = {
  ticketRestaurant: null,
};
Expand
titlestate/translations/en.json
Code Block
{
  ...,
  "addNewPaymentSodexo": "Pay with Ticket Restaurant",
  "payWithPaymentSodexo": "Pay with Ticket Restaurant",
  "payWithSodexoVoucher": "Pay with Ticket Restaurant Voucher",
}
Expand
titleutils/launchdarkly/flags.ts
Code Block
/**
   * Flag for enable ticket restaurant credit card in processor paycomet
   */
  ENABLE_TICKET_CREDIT_CARD_PAYCOMET = 'enable-ticket-restaurant-credit-card-paycomet',
  
/**
   * Flag for enable ticket restaurant voucher in processor paycomet
   */
  ENABLE_TICKET_RESTAURANT_VOUCHER_PAYCOMET = 'enable-ticket-restaurant-voucher-paycomet',
Expand
titleutils/payment/voucher.ts
Code Block
export const isVoucher = (method: IPaymentMethod) => {
  return !!method.sodexo || !!method.chequeGourmet || !!method.ticketRestaurant;
};

Graphql

Expand
titlegraphql/schemas/payments.gql

Add the PaymentMethodBrand

Code Block
enum PaymentMethodBrand {
 ...
 TICKET_RESTAURANT
 TICKET_RESTAURANT_VOUCHER
}

https://github.com/rbilabs/intl-whitelabel-graphql/

...

pull/

...

952

Fulfillment

...

Expand
titlesrc/graphql.ts
Code Block
export enum PaymentMethodBrand {
  ...,
  TICKET_RESTAURANT = "TICKET_RESTAURANT",
  TICKET_RESTAURANT_VOUCHER = "TICKET_RESTAURANT_VOUCHER",
}
Expand
titlelegacy/schemas/payments.graphql
Code Block
enum PaymentMethodBrand {
  ...
  TICKET_RESTAURANT
  TICKET_RESTAURANT_VOUCHER
}

https://github.com/rbilabs/intl-fulfillment-service/pull/813

Packages

...

Expand
titleorders/src/types/cart.ts
Code Block
export enum PaymentMethodBrand {
  ...,
  TICKET_RESTAURANT = 'TICKET_RESTAURANT',
  TICKET_RESTAURANT_VOUCHER = 'TICKET_RESTAURANT_VOUCHER',
}

https://github.com/rbilabs/intl-packages/pull/1187

DMP

...

Propagate the paymentMethodBrand

...

Expand
title@tests/unit/pages/CashFlow/controllers/delegate.spec.ts
Code Block
const expected = [
  'TICKET_RESTAURANT',
  'TICKET_RESTAURANT_VOUCHER',
];
Expand
titlesrc/constants/paymentMethod.ts
Code Block
export enum PaymentMethod {
  TICKET_RESTAURANT = 'TICKET_RESTAURANT',
  TICKET_RESTAURANT_VOUCHER = 'TICKET_RESTAURANT_VOUCHER',
}

export const paymentMethodTranslation: Record<PaymentMethod, string> = {
  TICKET_RESTAURANT: 'constants.paymentMethod.ticketRestaurant',
  TICKET_RESTAURANT_VOUCHER: 'constants.paymentMethod.ticketRestaurantVoucher',
};

https://github.com/rbilabs/intl-expeditor-tablet/pull/742

DOP

...

Propagate the paymentMethodBrand

...

Expand
titledelivery/settings/last-mile-settings-card/LastMileSettingsCard.tsx
Code Block
export const paymentMethodTranslation: Record<PaymentMethod, keyof LocalizedDictionary> = {
  TICKET_RESTAURANT: `${baseTranslationPath}.ticketRestaurant`,
  TICKET_RESTAURANT_VOUCHER: `${baseTranslationPath}.ticketRestaurantVoucher`,
};

export enum PaymentMethod {
  TICKET_RESTAURANT = 'TICKET_RESTAURANT',
  TICKET_RESTAURANT_VOUCHER = 'TICKET_RESTAURANT_VOUCHER',
}
Expand
titleutils/orders.ts
Code Block
export const paymentMethodTranslation: Record<string, string> = {
  TICKET_RESTAURANT: 'delivery-mgmt.restaurantManagement.changeDriver.paidWith.ticketRestaurant',
  TICKET_RESTAURANT_VOUCHER: 'delivery-mgmt.restaurantManagement.changeDriver.paidWith.ticketRestaurantVoucher',
};

https://github.com/rbilabs/ctg-fz-portal/pull/2799

Admin App

...

Propagate the paymentMethodBrand

...

Expand
titleorder-details/__tests__/order-details.spec.tsx
Code Block
describe('Payment method', () => {
    it.each`
      case                                     | paymentData                                                                | result
      ${'Ticket restaurant'}                   | ${{ cardType: 'VISA', paymentMethodBrand: 'TICKET_RESTAURANT' }}           | ${'Ticket Restaurant'}
      ${'Ticket restaurant voucher'}           | ${{ cardType: 'CASH', paymentMethodBrand: 'TICKET_RESTAURANT_VOUCHER' }}   | ${'Ticket Restaurant Voucher'}
    `('Should display $case payments accordingly', ({ paymentData, result }) => {
    ....
}
Expand
titleutils/utils.ts
Code Block
export function paymentMethodBrandTranslationMap(paymentMethodBrand: string) {
  const translatePaymentMethodBrand = {
    TICKET_RESTAURANT: 'orderDetails.paymentMethodBrand.ticket_restaurant',
    TICKET_RESTAURANT_VOUCHER: 'orderDetails.paymentMethodBrand.ticket_restaurant_voucher',
};

https://github.com/rbilabs/intl-admin-app/pull/403

Driver-app ( Voucher )

...

Propagate the paymentMethodBrand

...

Expand
titleenums/index.ts
Code Block
export enum PaymentMethod {
  TICKET_RESTAURANT = 'TICKET_RESTAURANT',
  TICKET_RESTAURANT_VOUCHER = 'TICKET_RESTAURANT_VOUCHER',
}
Expand
titleservices/format.ts
Code Block
export const paymentMethodTranslation: Record<PaymentMethod, string> = {
  TICKET_RESTAURANT: `${pathPaymentMethosTranslation}.ticketRestaurant`,
  TICKET_RESTAURANT_VOUCHER: `${pathPaymentMethosTranslation}.ticketRestaurantVoucher`,
};

https://github.com/rbilabs/intl-driver-app/pull/286

...