Skip to content

Commit

Permalink
Simplify payment methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Palad committed Jan 30, 2025
1 parent 997eca9 commit 4e53cb2
Showing 1 changed file with 14 additions and 99 deletions.
113 changes: 14 additions & 99 deletions packages/ui-extensions/src/surfaces/point-of-sale/types/payment.ts
Original file line number Diff line number Diff line change
@@ -1,100 +1,15 @@
export type PaymentMethod =
| CashPayment
| CustomPayment
| CreditCardPayment
| CardPresentRefund
| StripeCardPresentRefund
| GiftCardPayment
| StripeCreditCardPayment
| ShopPay
| UnknownPayment;

export interface BasePayment {
amount: string;
export type PaymentMethodType =
| 'Cash'
| 'Custom'
| 'CreditCard'
| 'CardPresentRefund'
| 'StripeCardPresentRefund'
| 'GiftCard'
| 'StripeCreditCard'
| 'ShopPay'
| 'Unknown';
export interface PaymentMethod {
amount: number;
currency: string;
type: PaymentMethodType;
}

interface CashPayment extends BasePayment {
type: 'Cash';
amountIn: string;
roundedAmount?: string;
}

interface CustomPayment extends BasePayment {
type: 'Custom';
name: string;
}

interface Customer extends BasePayment {
id: string;
}

export interface CreditCardPayment extends BasePayment {
type: 'CreditCard';
brand: string;
lastDigits: string;
customer?: Customer;
isSignatureRequired: boolean;
checkAmountToSkipSignature: boolean;
vaultedCardSessionId?: string;
cardSource?: CardSource;
receipt?: Receipt;
}
interface Receipt {
metadata?: Metadata;
authorizationCode?: string;
emvReceiptDetails?: EmvReceiptDetails;
}

interface Metadata {
shopId?: string;
cardReadMethod?: string;
cardSource?: string;
}

interface EmvReceiptDetails {
applicationIdentifierAidTerminal: string;
terminalIdentification: string;
applicationLabel?: string;
terminalVerificationResults: string;
transactionStatusInformation: string;
issuerApplicationData: string;
verificationMethod: string;
authorisationResponseCode?: string;
interacAccountType?: string;
applicationPreferredName?: string;
}
interface CardPresentRefund extends BasePayment {
type: 'CardPresentRefund';
lastDigits: string;
vaultedCardSessionId?: string;
cardSource?: CardSource;
}

interface StripeCardPresentRefund extends BasePayment {
type: 'StripeCardPresentRefund';
refundId: string;
cardSource?: string;
}

interface StripeCreditCardPayment extends BasePayment {
type: 'StripeCreditCard';
brand: string;
lastDigits: string;
}

interface GiftCardPayment extends BasePayment {
type: 'GiftCard';
lastCharacters: string;
giftCardId: string;
balance?: string;
}

interface ShopPay extends BasePayment {
type: 'ShopPay';
isInstallmentsPayment: boolean;
}

interface UnknownPayment extends BasePayment {
type: 'Unknown';
}
export type CardSource = 'manual' | 'swiped' | 'emv';

0 comments on commit 4e53cb2

Please sign in to comment.