@motopays/pay-form 2.4.1-rc.0 → 2.5.0-rc.0

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,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Added
6
+ - master checkbox. Read more details in README.md
7
+ - GooglePay confirmation payment button
8
+ - GooglePay button and card auth methods settings. Read more details in README.md
9
+
10
+ ### Fixed
11
+ - Toastr overlay remains in DOM after unmount
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
3
20
  ## 2.4.0
4
21
 
5
22
  ### Added
package/README.md CHANGED
@@ -203,7 +203,7 @@ export class AppComponent {
203
203
  | initiator | TPaymentInitiator | Identifies who of 2 types initiated the payment. Currently accepted: {'customer', 'merchant'} |
204
204
  | webhookUrl | string | URL where the Motopays will send hooks about the payment status changes |
205
205
  | returnUrl | string | The URL to which the user will be redirected after completing some types of payment, such as PayPal |
206
- | description | string | Short order description for the customer |
206
+ | description | string | *Required for using Apple Pay. Short order description for the customer |
207
207
  | details | ISimple<any> | Additional information about payment |
208
208
  | phoneNumber | string | End-customer phone number (can be changed if a customer fill the number by themselves) |
209
209
  | ipAddress | string | End-customer ip address |
@@ -231,7 +231,7 @@ export class AppComponent {
231
231
  | languageSettings | ILanguageSettings | The language settings
232
232
  | languageSettings.code | TLanguageCode | The code of language. Currently accepted: { 'en-US', 'es-ES', 'fr-FR' }. It's also possible to add another code by adding custom language to languageSettings.languages
233
233
  | languageSettings.languages | Partial<Record<TLanguageCode, ILanguage>> | Languages by codes
234
- | components | TComponentType[] | Components that will be on the form, as well as their order, which depends on the position of the components in the array. Currently accepted: {'available-card-brands', 'card-list', 'requisites', 'phone-number', 'charge-terms', 'pay-button', 'apm-list', 'user-preferences', 'merchant-info', 'protected-by', 'no-methods'}
234
+ | components | TComponentType[] | Components that will be on the form, as well as their order, which depends on the position of the components in the array. When 'master' is used, the components array must not contain charge-terms or user-preferences at the same time. In that case, checkboxes are still taken from userPreferences and chargeTerms, but they are rendered inside the master container instead of separate sections. Currently accepted: {'available-card-brands', 'card-list', 'requisites', 'phone-number', 'charge-terms', 'pay-button', 'apm-list', 'user-preferences', 'merchant-info', 'protected-by', 'no-methods', 'master'}
235
235
  | resultComponentsStructure | IResultComponentsStructure | Components that will be on the result page of the form, as well as their order, which depends on the position of the components in the array
236
236
  | resultComponentsStructure<br>.aboveResult | TComponentType[] | Components that will be on the result page of the form above the result, as well as their order, which depends on the position of the components in the array
237
237
  | resultComponentsStructure<br>.belowResult | TComponentType[] | Components that will be on the result page of the form below the result, as well as their order, which depends on the position of the components in the array
@@ -241,9 +241,14 @@ export class AppComponent {
241
241
  | chargeTerms | IChargeTermsSettings | The charge terms section |
242
242
  | chargeTerms.checkboxes | Partial<Record<TLanguageCode, string>>[] | The user must select all the checkboxes to proceed with the payment. Without selecting these checkboxes, the payment cannot be made. Multilingual support and linkify. Read more about linkify in the Linkify section |
243
243
  | chargeTerms.text | Partial<Record<TLanguageCode, string>> | The text of charge terms. For example, description of terms and policy. Multilingual support and linkify. Read more about linkify in the Linkify section |
244
+ | chargeTerms.shape | TCheckboxShape | The shape of master checkbox. Currently accepted: { circle, square } |
244
245
  | userPreferences | IUserPreferencesSettings | The user preferences section |
245
246
  | userPreferences.text | Partial<Record<TLanguageCode, string>> | The text of user preferences. For example, description of autorefill plan. Multilingual support and linkify. Read more about linkify in the Linkify section |
246
247
  | userPreferences.checkboxes | IUserPreferenceCheckbox[] | The text of user preferences. For example, description of autorefill plan. Multilingual support and linkify. Read more about linkify in the Linkify section |
248
+ | userPreferences.shape | TCheckboxShape | The shape of master checkbox. Currently accepted: { circle, square } |
249
+ | master | IMasterSettings | Master checkbox section that combines charge terms and user preferences into a single control. Individual checkboxes are taken from the userPreferences and chargeTerms settings. |
250
+ | master.text | Partial<Record<TLanguageCode, string>> | The label text of the master checkbox. Multilingual support and linkify. Read more about linkify in the Linkify section |
251
+ | master.shape | TCheckboxShape | The shape of master checkbox. Currently accepted: { circle, square } |
247
252
  | availableCardBrands | string[] or CreditCardTypeCardBrandId[] | The сard brands for which icons will be displayed on the form as card payment methods. Currently accepted: {american-express, discover, jcb, maestro, mastercard, unionpay, visa} |
248
253
  | requiredFieldsBehavior | IRequiredFieldsBehavior | Configuration of the display of required fields for the user to manage the user's focus on them |
249
254
  | requiredFieldsBehavior<br>.showStars | boolean | Show the stars on labels of required fields |
@@ -256,6 +261,9 @@ export class AppComponent {
256
261
  | paymentFlow | IPaymentFlowSettings | The payment flow configuration |
257
262
  | 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
263
  | 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 |
264
+ | googlePay | IGooglePayIntegratorSettings | Google pay settings |
265
+ | googlePay.button | ButtonOptions | Default Google Pay button options (the 'onClick' callback and 'allowedPaymentMethods' field must not be provided). See more details: https://developers.google.com/pay/api/web/guides/resources/customize |
266
+ | googlePay.allowedAuthMethods | CardAuthMethod[] | Allowed card auth methods. Currently accepted: { PAN_ONLY, CRYPTOGRAM_3DS } See more details: https://developers.google.com/pay/api/web/guides/tutorial#supported-card-networks|
259
267
 
260
268
  ### Example
261
269
 
@@ -491,7 +499,7 @@ IPaymentResponse {
491
499
  }
492
500
  payment: {
493
501
  paymentId: string;
494
- state: TPaymentState; //on of strings: completed, rejected, needAction
502
+ state: TPaymentState; //one of strings: completed, rejected, needAction
495
503
  rebillAnchor: string;
496
504
  info: {
497
505
  completeProcessingTime?: Date;
@@ -558,6 +566,8 @@ For receiving analytics listen analyticsTracked events.
558
566
  'remove-card-button-click' - the card removing button has been clicked. Payload: ICardAnalytics.<br>
559
567
  'select-card-button-click' - the card selecting button has been clicked. Payload: ICardAnalytics.<br>
560
568
  'apms-show-button-click' - the apm collapse text has been clicked. Payload: ICardAnalytics.<br>
569
+ 'master-click' - the master checkbox has been clicked. <br>
570
+ 'master-focus' - the master checkbox has been clicked. <br>
561
571
 
562
572
  Examples of dynamic event types (number inserting):
563
573
  &emsp;1. Example of the first checkbox: 'charge-term-checkbox-0-check'
@@ -575,7 +585,9 @@ type TAnalyticsServiceAction =
575
585
  | ServiceAction<'expiration-date-field-focus'>
576
586
  | ServiceAction<'cvv-field-focus'>
577
587
  | ServiceAction<'card-holder-field-focus'>
578
- | ServiceAction<'number-field-focus'> //
588
+ | ServiceAction<'number-field-focus'>
589
+ | ServiceAction<'master-click'>
590
+ | ServiceAction<'master-focus'>
579
591
  | ServiceAction<
580
592
  `charge-term-checkbox${`-${number}`}-focus`,
581
593
  IChargeTermsAnalytics
package/index.d.ts CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { CreditCardTypeCardBrandId } from 'credit-card-type/dist/types';
4
4
 
5
- export type TAmountType = "gross-without-gst" | "net" | "gross";
6
5
  export type TOrderType = "regular" | "free-trial" | "gems";
7
6
  export type TPaymentInitiator = "customer" | "merchant";
8
7
  export type TButtonStateUntilFilled = "enabled" | "disabled" | "hidden-enabled";
@@ -15,11 +14,14 @@ export interface IUserPreferenceCheckbox extends ITextContainer {
15
14
  name: string;
16
15
  defaultValue?: boolean;
17
16
  }
17
+ export type TCheckboxShape = "circle" | "square";
18
18
  export interface IUserPreferencesSettings extends ITextContainer {
19
19
  checkboxes?: IUserPreferenceCheckbox[];
20
+ shape?: TCheckboxShape;
20
21
  }
21
22
  export interface IChargeTermsSettings extends ITextContainer {
22
23
  checkboxes?: Partial<Record<TLanguageCode, string>>[];
24
+ shape?: TCheckboxShape;
23
25
  }
24
26
  export interface ILink extends ITextContainer {
25
27
  href: string;
@@ -36,7 +38,7 @@ export interface IRequiredFieldsBehavior {
36
38
  markAsInvalidUntilCorrect?: boolean;
37
39
  buttonStateUntilFilled?: TButtonStateUntilFilled;
38
40
  }
39
- export type TComponentType = "available-card-brands" | "card-list" | "requisites" | "phone-number" | "charge-terms" | "pay-button" | "apm-list" | "user-preferences" | "merchant-info" | "protected-by" | "no-methods";
41
+ export type TComponentType = "available-card-brands" | "card-list" | "requisites" | "phone-number" | "charge-terms" | "pay-button" | "apm-list" | "user-preferences" | "merchant-info" | "protected-by" | "no-methods" | "master";
40
42
  export type TSecurityCodeLabel = "CVV" | "CVC" | "CID" | "CVN" | "CVE" | "CVP2";
41
43
  export interface ISecurityCodeLabels extends Record<TSecurityCodeLabel, string> {
42
44
  }
@@ -99,6 +101,10 @@ export interface ILanguage {
99
101
  };
100
102
  };
101
103
  close: string;
104
+ master: {
105
+ selectAll: string;
106
+ };
107
+ confirmPayment: string;
102
108
  }
103
109
  export interface ILanguageSettings {
104
110
  code: TLanguageCode;
@@ -119,6 +125,13 @@ export interface IPaymentFlowSettings {
119
125
  tokenizeCard?: boolean;
120
126
  type?: TPaymentFlow;
121
127
  }
128
+ export interface IMasterSettings extends ITextContainer {
129
+ shape?: TCheckboxShape;
130
+ }
131
+ export interface IGooglePayIntegratorSettings {
132
+ button?: Omit<google.payments.api.ButtonOptions, "onClick" | "allowedPaymentMethods">;
133
+ allowedAuthMethods?: google.payments.api.CardAuthMethod[];
134
+ }
122
135
  export interface ISettings {
123
136
  isCloseButtonVisible?: boolean;
124
137
  isProblemTipsListVisible?: boolean;
@@ -130,6 +143,7 @@ export interface ISettings {
130
143
  urls: IServicesUrls;
131
144
  components?: TComponentType[];
132
145
  resultComponentsStructure?: IResultComponentsStructure;
146
+ master?: IMasterSettings;
133
147
  merchantInfo?: IMerchantInfoSettings;
134
148
  chargeTerms?: IChargeTermsSettings;
135
149
  userPreferences?: IUserPreferencesSettings;
@@ -138,10 +152,12 @@ export interface ISettings {
138
152
  events?: IEvents;
139
153
  apmsCollapse?: boolean;
140
154
  paymentFlow?: IPaymentFlowSettings;
155
+ googlePay?: IGooglePayIntegratorSettings;
141
156
  }
142
157
  export interface ISimple<Value = any> {
143
158
  [key: string]: Value;
144
159
  }
160
+ export type TAmountType = "gross-without-gst" | "net" | "gross";
145
161
  export interface IBillingAddress {
146
162
  addressLine: string;
147
163
  city: string;
@@ -328,7 +344,7 @@ export interface IUserPreferencesAnalytics {
328
344
  name: string;
329
345
  text: string;
330
346
  }
331
- export type TAnalyticsServiceAction = ServiceAction<"init-start"> | ServiceAction<"loading-finish"> | ServiceAction<"card-number-field-focus"> | ServiceAction<"expiration-date-field-focus"> | ServiceAction<"cvv-field-focus"> | ServiceAction<"card-holder-field-focus"> | ServiceAction<"number-field-focus"> | ServiceAction<`charge-term-checkbox${`-${number}`}-focus`, IChargeTermsAnalytics> | ServiceAction<`charge-term-checkbox${`-${number}`}-check`, IChargeTermsAnalytics> | ServiceAction<`charge-term-checkbox${`-${number}`}-uncheck`, IChargeTermsAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-focus`, IUserPreferencesAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-check`, IUserPreferencesAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-uncheck`, IUserPreferencesAnalytics> | ServiceAction<"pay-button-focus"> | ServiceAction<"pay-button-click"> | ServiceAction<`${string}-button-focus`> | ServiceAction<`${string}-button-click`> | ServiceAction<"add-card-button-focus"> | ServiceAction<"add-card-button-click"> | ServiceAction<"card-options-button-click", ICardAnalytics> | ServiceAction<"cards-toggle-button-click", ICardListAnalytics> | ServiceAction<"remove-card-button-click", ICardAnalytics> | ServiceAction<"select-card-button-click", ICardAnalytics> | ServiceAction<"apms-show-button-click", ICardAnalytics>;
347
+ export type TAnalyticsServiceAction = ServiceAction<"init-start"> | ServiceAction<"loading-finish"> | ServiceAction<"card-number-field-focus"> | ServiceAction<"expiration-date-field-focus"> | ServiceAction<"cvv-field-focus"> | ServiceAction<"card-holder-field-focus"> | ServiceAction<"number-field-focus"> | ServiceAction<"master-click"> | ServiceAction<"master-focus"> | ServiceAction<`charge-term-checkbox${`-${number}`}-focus`, IChargeTermsAnalytics> | ServiceAction<`charge-term-checkbox${`-${number}`}-check`, IChargeTermsAnalytics> | ServiceAction<`charge-term-checkbox${`-${number}`}-uncheck`, IChargeTermsAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-focus`, IUserPreferencesAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-check`, IUserPreferencesAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-uncheck`, IUserPreferencesAnalytics> | ServiceAction<"pay-button-focus"> | ServiceAction<"pay-button-click"> | ServiceAction<`${string}-button-focus`> | ServiceAction<`${string}-button-click`> | ServiceAction<"add-card-button-focus"> | ServiceAction<"add-card-button-click"> | ServiceAction<"card-options-button-click", ICardAnalytics> | ServiceAction<"cards-toggle-button-click", ICardListAnalytics> | ServiceAction<"remove-card-button-click", ICardAnalytics> | ServiceAction<"select-card-button-click", ICardAnalytics> | ServiceAction<"apms-show-button-click", ICardAnalytics>;
332
348
  export interface IApmsShowAnalytics {
333
349
  show: boolean;
334
350
  }