@vulog/aima-payment
Version:
Payment management module for the AIMA platform. This module provides functionality to handle payments, setup intents, payment methods, and trip payments.
149 lines (144 loc) • 3.9 kB
text/typescript
export type SetupIntent = {
id: string;
pspPublishableKey: string;
pspCustomerReference: string;
pspName: string;
pspReference: string;
pspClientSecret: string;
date: string;
[key: string]: any;
};
export type BrowserInfos = {
origin: string;
userAgent: string;
screenHeight: number;
screenWidth: number;
colorDepth: number;
};
export type PaymentDetail = {
token: string;
holderName: string;
fleetId: string;
entityId: string;
pspName: string;
customerPspReference: string;
entityStatus: string;
profileId: string;
profileName: string;
profileType: 'Single' | 'Business';
paymentMethod: 'SEPA' | 'IDEAL' | 'PAYPAL' | 'CREDIT_CARD' | 'WIRE_TRANSFER' | 'EXTERNAL';
mopStatus:
| 'MOP_VALID'
| 'MOP_MISSING'
| 'MOP_EXPIRED'
| 'MOP_INVALID'
| 'MOP_UPDATING'
| 'MOP_UPDATE_FAILED'
| 'MOP_UNKNOWN';
paymentCurrency: string;
cardFunding: 'credit' | 'debit' | 'prepaid' | 'unknown';
} & (
| {
paymentType: 'CARD'; // CARD is also the type used when there is no MoP ... hence all are optional.
cardSummary?: string;
cardType?: string;
expiryDate?: number;
expiryMonth?: string;
expiryYear?: string;
}
| {
paymentType: 'SEPA';
bankCode: string;
branchCode: string;
country: string;
fingerprint: string;
last4: string;
}
| {
paymentType: 'BANK';
bankName: string;
bankAccountNumber: string;
iban: string;
bic: string;
}
| {
paymentType: 'PAYPAL';
// ??
}
| {
paymentType: 'EXTERNAL';
// nothing more
}
);
export type SynchronizeResponse = {
status: 'SUCCEEDED' | 'REQUIRES_CAPTURE' | 'FAILED';
};
export type TripPayment = {
paymentIntents: [
{
id: string;
pspName: 'STRIPE' | 'ADYEN';
pspReference: string;
pspPublishableKey: string;
amount: number;
currency: string;
date: string;
status: string;
paymentMethodType: string;
paymentMethodPspReference: string;
paymentIntentPspReference: string;
number: number;
code: string;
declineCode: string;
pspClientSecret: string;
reason: string;
note: string;
nextAction: {
nextActionRedirectUrl: {
url: string;
method: string;
data: { [key: string]: any };
};
type: string;
};
metadatas: { [key: string]: any };
},
];
paymentReceipts: [
{
id: string;
pspName: string;
pspReference: string;
pspPublishableKey: string;
amount: number;
currency: string;
date: string;
status: string;
paymentMethodType: string;
paymentMethodPspReference: string;
paymentIntentPspReference: string;
number: number;
code: string;
declineCode: string;
pspClientSecret: string;
reason: string;
note: string;
nextAction: {
nextActionRedirectUrl: {
url: string;
method: string;
data: {
[key: string]: any;
};
};
type: string;
};
metadatas: { [key: string]: any };
},
];
id: string;
fleetId: string;
profileId: string;
vehicleId: string;
serviceId: string;
};