@motopays/pay-form 2.1.1-rc.1 → 2.2.0-rc.1

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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,14 @@
1
1
  # Changelog
2
2
 
3
- ## 2.1.1
3
+ ## 2.2.0
4
4
 
5
5
  ### Added
6
6
  - fingerprint and deviceInfo additional fields for payment request
7
+ - paymentFlow field to settings model. Read more details in README.md
8
+ - createInvoice callback to moto-payment-form component for overriding invoice generation
9
+ - makePayment callback to moto-payment-form component for overriding payment flow
10
+ ### Changed
11
+ - requisites encryption only instead of whole payment request
7
12
 
8
13
 
9
14
 
@@ -45,7 +50,6 @@
45
50
 
46
51
 
47
52
  ## 2.0.2
48
-
49
53
  ### Fixed
50
54
  - Manage cards collapsed by default
51
55
  - Empty userPreferences checkboxes array causes an error
@@ -56,7 +60,6 @@
56
60
 
57
61
 
58
62
 
59
-
60
63
  ## 2.0.1
61
64
  - CHANGELOG.md updated
62
65
 
package/README.md CHANGED
@@ -130,6 +130,8 @@ import { IPaymentSettings, ISettings } from '@motopays/pay-form/index.js';
130
130
  <moto-payment-form
131
131
  [payment]="payment"
132
132
  [settings]="settings"
133
+ [createInvoice]="createInvoice"
134
+ [makePayment]="makePayment"
133
135
  (close)="onClose()"
134
136
  (analyticsTracked)="onAnalyticsTracked($event)"
135
137
  (error)="onError($event)"
@@ -143,6 +145,18 @@ export class AppComponent {
143
145
  protected payment: IPaymentSettings = {...};
144
146
  protected settings: ISettings = {...};
145
147
 
148
+ constructor() {
149
+ this.createInvoice = this.createInvoice.bind(this);
150
+ this.makePayment = this.makePayment.bind(this);
151
+ }
152
+
153
+ protected createInvoice(request: IPaymentRequest): Promise<IPaymentRequest> {
154
+ //create invoice
155
+ }
156
+
157
+ protected makePayment(request: IPaymentRequest): Promise<IPaymentResponse> {
158
+ //make payment
159
+ }
146
160
 
147
161
  protected onClose(): void {
148
162
  console.log('close');
@@ -229,6 +243,9 @@ export class AppComponent {
229
243
  | events.analytics | { optional: boolean; required: boolean; } | The analytics events configuration. Optional is responsible for 'focus' events. Required is responsible for 'click' events. Read more about analytics events in the Analytics section |
230
244
  | events.error | boolean | The error events configuration. If true, the error events will be emitted; otherwise, they will not |
231
245
  | apmsCollapse | boolean | The apms collapse configuration. If true, the 'or use alternative methods' text will be clickable and will control whether the apms are shown or not. By default, if true, the apms will be collapsed. |
246
+ | paymentFlow | IPaymentFlowSettings | The payment flow configuration |
247
+ | paymentFlow.tokenizeCard | boolean | If true, than for not 'default' paymentFlow.type card requisites will be tokenized (only for 'invoice-overridden' and 'payment-overridden' paymentFlow.type) |
248
+ | paymentFlow.type | TPaymentFlow | If 'invoice-overridden' and createInvoice callback provided to the payment form, the createInvoice callback will be called with the invoice generated by the payment form. After receiving the invoice from the createInvoice callback, the payment process will proceed according to the default scenario. If 'payment-overridden' and makePayment callback provided to the payment form, the entire payment process will be handled through the makePayment callback with the invoice generated by the payment form |
232
249
 
233
250
  ### Example
234
251
 
@@ -431,6 +448,10 @@ const settings: ISettings = {
431
448
  defaultValue: false
432
449
  }
433
450
  ]
451
+ },
452
+ paymentFlow: {
453
+ tokenizeCard: false,
454
+ type: 'default'
434
455
  }
435
456
  };
436
457
  ```
package/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export type TOrderType = "regular" | "free-trial" | "gems";
7
7
  export type TPaymentInitiator = "customer" | "merchant";
8
8
  export type TButtonStateUntilFilled = "enabled" | "disabled" | "hidden-enabled";
9
9
  export type TLanguageCode = "en-US" | "es-ES" | "fr-FR" | string;
10
+ export type TPaymentFlow = "default" | "invoice-overridden" | "payment-overridden";
10
11
  export interface ITextContainer {
11
12
  text: Partial<Record<TLanguageCode, string>>;
12
13
  }
@@ -114,6 +115,10 @@ export interface IEvents {
114
115
  };
115
116
  error: boolean;
116
117
  }
118
+ export interface IPaymentFlowSettings {
119
+ tokenizeCard?: boolean;
120
+ type?: TPaymentFlow;
121
+ }
117
122
  export interface ISettings {
118
123
  isCloseButtonVisible?: boolean;
119
124
  isProblemTipsListVisible?: boolean;
@@ -132,6 +137,7 @@ export interface ISettings {
132
137
  requiredFieldsBehavior?: IRequiredFieldsBehavior;
133
138
  events?: IEvents;
134
139
  apmsCollapse?: boolean;
140
+ paymentFlow?: IPaymentFlowSettings;
135
141
  }
136
142
  export interface ISimple<Value = any> {
137
143
  [key: string]: Value;
@@ -164,6 +170,31 @@ export interface IPaymentSettings {
164
170
  signature?: string;
165
171
  billingAddress?: IBillingAddress;
166
172
  }
173
+ declare enum ChallengeWindowSizeType {
174
+ SMALL = 1,
175
+ MEDIUM = 2,
176
+ LARGE = 3,
177
+ EXTRA_LARGE = 4,
178
+ FULL_SCREEN = 5
179
+ }
180
+ export interface IBrowserInfo {
181
+ timezoneOffsetUtcMinutes: number;
182
+ locale: string;
183
+ userAgent: string;
184
+ javaEnabled: boolean;
185
+ javaScriptEnabled: boolean;
186
+ colorDepth: number;
187
+ height: number;
188
+ width: number;
189
+ challengeWindowSize: ChallengeWindowSizeType;
190
+ }
191
+ export interface IDeviceInfo {
192
+ id?: string;
193
+ fonts?: string[];
194
+ networkParameters?: string;
195
+ batteryLevelAndChargingStatus?: string;
196
+ browserData: IBrowserInfo;
197
+ }
167
198
  export interface IRedirectData {
168
199
  location: string;
169
200
  }
@@ -222,6 +253,56 @@ export interface IPaymentResponse {
222
253
  user: IUser;
223
254
  signature?: string;
224
255
  }
256
+ interface IBillingAddress$1 {
257
+ addressLine: string;
258
+ city: string;
259
+ state: string;
260
+ country: string;
261
+ zip: string;
262
+ }
263
+ type TAmountType$1 = "GrossWithoutGst" | "Net" | "Gross";
264
+ type TOrderType$1 = "Regular" | "FreeTrial" | "Gems";
265
+ interface IOrder$1 {
266
+ amount?: number;
267
+ amountType?: TAmountType$1;
268
+ currency: string;
269
+ description?: string;
270
+ details?: string;
271
+ type?: TOrderType$1;
272
+ tax?: number;
273
+ }
274
+ export interface IPayer {
275
+ id: string;
276
+ email: string;
277
+ phoneNumber?: string;
278
+ ipAddress?: string;
279
+ deviceInfo: IDeviceInfo;
280
+ billingAddress?: IBillingAddress$1;
281
+ }
282
+ type TPaymentInitiator$1 = "Customer" | "Merchant";
283
+ export interface IRejectionPreferences {
284
+ showResolvingTips: boolean;
285
+ }
286
+ export interface IRequisites {
287
+ anchor: string;
288
+ cardHolder: string;
289
+ cardNumber: string;
290
+ cvv: string;
291
+ expiration: string;
292
+ paymentToken: string;
293
+ type: string;
294
+ }
295
+ export interface IPaymentRequest {
296
+ id: string;
297
+ initiator?: TPaymentInitiator$1;
298
+ returnUrl?: string;
299
+ webhookUrl?: string;
300
+ order: IOrder$1;
301
+ payer: IPayer;
302
+ requisites: IRequisites;
303
+ signature?: string;
304
+ rejectionPreferences: IRejectionPreferences;
305
+ }
225
306
  declare class ServiceAction<Type extends string, Payload = unknown | undefined> {
226
307
  type: Type;
227
308
  payload?: Payload | undefined;
@@ -247,6 +328,8 @@ export interface IApmsShowAnalytics {
247
328
 
248
329
  export {
249
330
  CreditCardTypeCardBrandId,
331
+ IBillingAddress$1 as IBillingAddressRequest,
332
+ IOrder$1 as IOrderRequest,
250
333
  };
251
334
 
252
335
  export {};