@bizzsv/bizz-payment 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,174 @@
1
+ export declare class BizzPaymentForm {
2
+ private config;
3
+ private iframe;
4
+ private messageHandler;
5
+ private successListeners;
6
+ private failureListeners;
7
+ private readyListeners;
8
+ private sizingListeners;
9
+ private validation;
10
+ private origin;
11
+ private serverErrorHandler;
12
+ private orchestrator;
13
+ private paymentIntent;
14
+ private countryContent;
15
+ private processPayment;
16
+ private stateContent;
17
+ private amountEvaluation;
18
+ private currentAmount;
19
+ private currentValues;
20
+ constructor(config: PaymentFormConfig);
21
+ /**
22
+ * Subscribe to host-side events.
23
+ */
24
+ on<E extends keyof PaymentFormEventMap>(event: E, listener: (data: PaymentFormEventMap[E]) => void): void;
25
+ setup(): Promise<void>;
26
+ /**
27
+ * When loading configuration by order template (`paymentRequestCode`), the amount is fixed from `amount_cents`.
28
+ */
29
+ private applyFixedAmountFromOrderTemplate;
30
+ private renderForm;
31
+ private resetForm;
32
+ private setSubmitLoading;
33
+ private setToken;
34
+ private sendAlert;
35
+ private sendFailureEmitter;
36
+ private sendReadyEmitter;
37
+ private sendSizingEmitter;
38
+ private sendSuccess;
39
+ destroy(): void;
40
+ }
41
+
42
+ declare interface FormCustomHeader {
43
+ logo?: boolean;
44
+ description?: boolean;
45
+ totalAmount?: boolean;
46
+ requestMessage?: boolean;
47
+ date?: boolean;
48
+ }
49
+
50
+ export declare interface PaymentFormConfig {
51
+ iframeTarget: string;
52
+ i18n?: PaymentFormI18n;
53
+ branchCode: string;
54
+ paymentRequestCode?: string;
55
+ description?: string;
56
+ totalAmount?: number;
57
+ header?: boolean | FormCustomHeader;
58
+ }
59
+
60
+ declare type PaymentFormEventMap = {
61
+ success: PaymentFormSuccessPayloadEmitter;
62
+ failure: PaymentFormFailurePayloadEmitter;
63
+ ready: void;
64
+ sizing: PaymentFormSizingPayloadEmitter;
65
+ };
66
+
67
+ declare interface PaymentFormFailurePayloadEmitter {
68
+ status: number;
69
+ message: string;
70
+ }
71
+
72
+ export declare type PaymentFormFieldName = PaymentFormFieldNameBase | PaymentFormFieldName3DSExtra;
73
+
74
+ declare type PaymentFormFieldName3DSExtra = PaymentFormFieldNameBase | 'firstName' | 'lastName' | 'phone' | 'country' | 'region' | 'city' | 'address' | 'postalCode';
75
+
76
+ declare type PaymentFormFieldNameBase = 'amount' | 'documentType' | 'billingDocumentNumber' | 'email' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'cardHolder' | 'description';
77
+
78
+ export declare interface PaymentFormFieldOverride {
79
+ name: PaymentFormFieldName;
80
+ label?: string;
81
+ placeholder?: string;
82
+ }
83
+
84
+ export declare interface PaymentFormI18n {
85
+ fields?: PaymentFormFieldOverride[];
86
+ submitButton?: PaymentFormSubmitButton;
87
+ }
88
+
89
+ export declare type PaymentFormMessage = {
90
+ type: 'payment-form:submit';
91
+ value: Partial<Record<PaymentFormFieldName, string>>;
92
+ } | {
93
+ type: 'payment-form:validate';
94
+ field: PaymentFormFieldName;
95
+ value: string;
96
+ } | {
97
+ type: 'payment-form:validation-result';
98
+ field: PaymentFormFieldName;
99
+ error: string;
100
+ } | {
101
+ type: 'payment-form:set-token';
102
+ token: string;
103
+ } | {
104
+ type: 'payment-form:set-submit-loading';
105
+ disabled: boolean;
106
+ } | {
107
+ type: 'payment-form:reset';
108
+ } | {
109
+ type: 'payment-form:alert';
110
+ title: string;
111
+ message: string;
112
+ } | {
113
+ type: 'payment-form:success';
114
+ paymentIntent: PaymentIntentSuccessResponse;
115
+ } | {
116
+ type: 'payment-form:states-loaded';
117
+ states: State[];
118
+ } | {
119
+ type: 'payment-form:validate-amount';
120
+ amount: string;
121
+ } | {
122
+ type: 'payment-form:sizing';
123
+ width: number;
124
+ height: number;
125
+ };
126
+
127
+ declare interface PaymentFormSizingPayloadEmitter {
128
+ width: number;
129
+ height: number;
130
+ }
131
+
132
+ export declare interface PaymentFormSubmitButton {
133
+ label?: string;
134
+ loadingLabel?: string;
135
+ }
136
+
137
+ declare interface PaymentFormSuccessPayloadEmitter {
138
+ id: string;
139
+ status: string;
140
+ amount_cents: number;
141
+ response_code: string | null;
142
+ authorization_number: string | null;
143
+ reference_number: string | null;
144
+ }
145
+
146
+ declare interface PaymentIntentSuccessResponse {
147
+ data: {
148
+ id: string;
149
+ status: string;
150
+ amount_cents: number;
151
+ amount_currency: string;
152
+ response_code: string | null;
153
+ authorization_number: string | null;
154
+ reference_number: string | null;
155
+ billing_document_number: string;
156
+ description: string;
157
+ date: string;
158
+ time: string;
159
+ commerce_name: string;
160
+ branch_name: string;
161
+ card_network: string;
162
+ card_last_digits: string | null;
163
+ invoice_serie: string | null;
164
+ };
165
+ }
166
+
167
+ declare type State = {
168
+ id: string;
169
+ name: string;
170
+ code: string;
171
+ short_code: string;
172
+ };
173
+
174
+ export { }