@motopays/pay-form 2.2.0-rc.0 → 2.2.0-rc.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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # Changelog
2
+
2
3
  ## 2.2.0
4
+
3
5
  ### Added
6
+ - fingerprint and deviceInfo additional fields for payment request
4
7
  - paymentFlow field to settings model. Read more details in README.md
5
8
  - createInvoice callback to moto-payment-form component for overriding invoice generation
6
9
  - makePayment callback to moto-payment-form component for overriding payment flow
10
+ ### Changed
11
+ - requisites encryption only instead of whole payment request
12
+
7
13
 
8
14
 
9
15
 
package/README.md CHANGED
@@ -26,12 +26,22 @@ yarn add @motopays/pay-form
26
26
  </body>
27
27
  <script src="motopays/pay-form/index.js" type="text/javascript"></script>
28
28
  <script type="text/javascript">
29
+ async function createInvoice(request) {
30
+ //create invoice
31
+ }
32
+
33
+ async function makePayment(request) {
34
+ //make payment
35
+ }
36
+
29
37
  const targetElement = document.getElementById("moto-payment-form");
30
38
  const paymentFormElement = document.createElement("moto-payment-form");
31
39
  paymentFormElement.id = "moto-payment-form";
32
40
 
33
41
  paymentFormElement.payment = {...};
34
42
  paymentFormElement.settings = {...};
43
+ paymentFormElement.createInvoice = createInvoice;
44
+ paymentFormElement.makePayment = makePayment;
35
45
 
36
46
  paymentFormElement.addEventListener("close", (event) => {
37
47
  console.log(event);
@@ -130,6 +140,8 @@ import { IPaymentSettings, ISettings } from '@motopays/pay-form/index.js';
130
140
  <moto-payment-form
131
141
  [payment]="payment"
132
142
  [settings]="settings"
143
+ [createInvoice]="createInvoice"
144
+ [makePayment]="makePayment"
133
145
  (close)="onClose()"
134
146
  (analyticsTracked)="onAnalyticsTracked($event)"
135
147
  (error)="onError($event)"
@@ -143,6 +155,18 @@ export class AppComponent {
143
155
  protected payment: IPaymentSettings = {...};
144
156
  protected settings: ISettings = {...};
145
157
 
158
+ constructor() {
159
+ this.createInvoice = this.createInvoice.bind(this);
160
+ this.makePayment = this.makePayment.bind(this);
161
+ }
162
+
163
+ protected createInvoice(request: IPaymentRequest): Promise<IPaymentRequest | IInvoiceRequest> {
164
+ //create invoice
165
+ }
166
+
167
+ protected makePayment(request: IPaymentRequest): Promise<IPaymentResponse> {
168
+ //make payment
169
+ }
146
170
 
147
171
  protected onClose(): void {
148
172
  console.log('close');
@@ -229,6 +253,9 @@ export class AppComponent {
229
253
  | 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
254
  | events.error | boolean | The error events configuration. If true, the error events will be emitted; otherwise, they will not |
231
255
  | 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. |
256
+ | paymentFlow | IPaymentFlowSettings | The payment flow configuration |
257
+ | 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) |
258
+ | 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
259
 
233
260
  ### Example
234
261
 
@@ -431,6 +458,10 @@ const settings: ISettings = {
431
458
  defaultValue: false
432
459
  }
433
460
  ]
461
+ },
462
+ paymentFlow: {
463
+ tokenizeCard: false,
464
+ type: 'default'
434
465
  }
435
466
  };
436
467
  ```
package/index.d.ts CHANGED
@@ -170,6 +170,31 @@ export interface IPaymentSettings {
170
170
  signature?: string;
171
171
  billingAddress?: IBillingAddress;
172
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
+ }
173
198
  export interface IRedirectData {
174
199
  location: string;
175
200
  }
@@ -235,27 +260,6 @@ interface IBillingAddress$1 {
235
260
  country: string;
236
261
  zip: string;
237
262
  }
238
- declare enum ChallengeWindowSizeType {
239
- SMALL = 1,
240
- MEDIUM = 2,
241
- LARGE = 3,
242
- EXTRA_LARGE = 4,
243
- FULL_SCREEN = 5
244
- }
245
- export interface IBrowserInfo {
246
- timezoneOffsetUtcMinutes: number;
247
- locale: string;
248
- userAgent: string;
249
- javaEnabled: boolean;
250
- javaScriptEnabled: boolean;
251
- colorDepth: number;
252
- height: number;
253
- width: number;
254
- challengeWindowSize: ChallengeWindowSizeType;
255
- }
256
- export interface IDeviceInfo {
257
- browserData: IBrowserInfo;
258
- }
259
263
  type TAmountType$1 = "GrossWithoutGst" | "Net" | "Gross";
260
264
  type TOrderType$1 = "Regular" | "FreeTrial" | "Gems";
261
265
  interface IOrder$1 {
@@ -299,6 +303,13 @@ export interface IPaymentRequest {
299
303
  signature?: string;
300
304
  rejectionPreferences: IRejectionPreferences;
301
305
  }
306
+ export interface IInvoiceRequest {
307
+ invoice: string;
308
+ ei?: 1 | 2;
309
+ es?: {
310
+ uo?: boolean;
311
+ };
312
+ }
302
313
  declare class ServiceAction<Type extends string, Payload = unknown | undefined> {
303
314
  type: Type;
304
315
  payload?: Payload | undefined;