@globalpayments/js 1.9.15 → 1.9.19

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.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/types/internal/gateways/gp-api/action-query-installment-plans.d.ts +3 -0
  3. package/types/internal/gateways/gp-api/index.d.ts +1 -0
  4. package/types/internal/gateways/index.d.ts +6 -0
  5. package/types/internal/lib/card.d.ts +17 -0
  6. package/types/internal/lib/installments/components/add-issuer-banner.d.ts +2 -0
  7. package/types/internal/lib/installments/components/modal/create-modal-component.d.ts +9 -0
  8. package/types/internal/lib/installments/components/modal/styles.d.ts +23 -0
  9. package/types/internal/lib/installments/contracts/constants.d.ts +3 -0
  10. package/types/internal/lib/installments/contracts/enums.d.ts +18 -0
  11. package/types/internal/lib/installments/contracts/installment-action.d.ts +20 -0
  12. package/types/internal/lib/installments/contracts/installment-payment-method.d.ts +21 -0
  13. package/types/internal/lib/installments/contracts/installment-plans-data.d.ts +50 -0
  14. package/types/internal/lib/installments/contracts/installment-term-fees.d.ts +16 -0
  15. package/types/internal/lib/installments/contracts/installment-term.d.ts +35 -0
  16. package/types/internal/lib/installments/helpers/currency.d.ts +2 -0
  17. package/types/internal/lib/installments/helpers/html-element.d.ts +88 -0
  18. package/types/internal/lib/installments/installments-handler.d.ts +48 -0
  19. package/types/internal/lib/installments/requests/query-installment-plans.d.ts +3 -0
  20. package/types/internal/lib/installments/templates/common.d.ts +6 -0
  21. package/types/internal/lib/installments/templates/create-step-0.d.ts +3 -0
  22. package/types/internal/lib/installments/templates/create-step-1.d.ts +3 -0
  23. package/types/internal/lib/installments/templates/modals.d.ts +6 -0
  24. package/types/internal/lib/styles/default.d.ts +12 -12
  25. package/types/internal/lib/styles/gp-default.d.ts +342 -13
  26. package/types/internal/lib/styles/installments/common.d.ts +335 -0
  27. package/types/internal/lib/styles/installments/default.d.ts +335 -0
  28. package/types/internal/lib/styles/installments/gp-default.d.ts +335 -0
  29. package/types/internal/lib/styles/installments/simple.d.ts +335 -0
  30. package/types/internal/lib/styles/simple.d.ts +12 -12
  31. package/types/lib/version.d.ts +1 -1
  32. package/types/tools/configure.d.ts +6 -0
  33. package/types/ui/form/index.d.ts +419 -83
  34. package/types/ui/iframe-field/action-accumulate-installment-data.d.ts +3 -0
  35. package/types/ui/iframe-field/action-add-installments.d.ts +3 -0
  36. package/types/ui/iframe-field/action-card-request-installments.d.ts +6 -0
  37. package/types/ui/iframe-field/action-request-installment-data.d.ts +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalpayments/js",
3
- "version": "1.9.15",
3
+ "version": "1.9.19",
4
4
  "author": "Heartland Developer Portal <developers@heartland.us>",
5
5
  "license": "GPL-2.0",
6
6
  "repository": {
@@ -0,0 +1,3 @@
1
+ import { IDictionary } from "../../lib/util";
2
+ declare const _default: (url: string, _env: string, data: IDictionary) => Promise<any>;
3
+ export default _default;
@@ -21,6 +21,7 @@ export declare const supports: {
21
21
  export declare const urls: {
22
22
  assetBaseUrl: (result: string) => string;
23
23
  tokenization: (prod: boolean) => string;
24
+ queryInstallmentPlans: (prod: boolean) => string;
24
25
  };
25
26
  export declare const actions: IActions;
26
27
  export declare const requiredSettings: string[];
@@ -42,6 +42,10 @@ export interface ISuccess {
42
42
  orderId?: string;
43
43
  reference?: string;
44
44
  apmProvider?: string;
45
+ installment?: {
46
+ id: string;
47
+ reference: string;
48
+ };
45
49
  };
46
50
  methodName?: string;
47
51
  payerEmail?: string;
@@ -65,10 +69,12 @@ export interface IActions {
65
69
  setup?: () => any;
66
70
  tokenize: (url: string, env: string, data: IDictionary) => Promise<any>;
67
71
  validateData: (data: IDictionary) => IErrorReason[];
72
+ queryInstallmentPlans?: (url: string, env: string, data: IDictionary) => Promise<any>;
68
73
  }
69
74
  export interface IUrlGenerators {
70
75
  assetBaseUrl?: (result: string) => string;
71
76
  tokenization: (prod: boolean) => string;
77
+ queryInstallmentPlans?: (prod: boolean) => string;
72
78
  }
73
79
  export interface IGatewayModule {
74
80
  [key: string]: any;
@@ -93,6 +93,23 @@ export default class Card {
93
93
  * @param e
94
94
  */
95
95
  static validateExpiration(e: Event): void;
96
+ /**
97
+ * validateInstallmentFields
98
+ *
99
+ * Validates a target element"s value based on the
100
+ * availability of use installment plans.
101
+ *
102
+ * @param e
103
+ */
104
+ static validateInstallmentFields(e: Event, fieldType: string): void;
105
+ /**
106
+ * postInstallmentFieldValidatedEvent
107
+ *
108
+ * Post an event when an installment related card field is validated
109
+ *
110
+ * @param e
111
+ */
112
+ static postInstallmentFieldValidatedEvent(e: Event): void;
96
113
  /**
97
114
  * attachNumberEvents
98
115
  *
@@ -0,0 +1,2 @@
1
+ import { IframeField } from "../../../../ui";
2
+ export default function addIssuerBanner(iframeField: IframeField | undefined): void;
@@ -0,0 +1,9 @@
1
+ export declare const createModalComponent: (modalProps: {
2
+ id: string;
3
+ htmlContent?: HTMLElement | undefined;
4
+ }) => ModalComponent | undefined;
5
+ export interface ModalComponent {
6
+ open: () => void;
7
+ close: () => void;
8
+ modalElement: HTMLDivElement;
9
+ }
@@ -0,0 +1,23 @@
1
+ declare const styles: (_assetBaseUrl: string) => {
2
+ ".secure-payment-form .modal-overlay": {
3
+ background: string;
4
+ position: string;
5
+ top: string;
6
+ left: string;
7
+ margin: string;
8
+ width: string;
9
+ height: string;
10
+ display: string;
11
+ "justify-content": string;
12
+ "align-items": string;
13
+ "z-index": string;
14
+ };
15
+ ".secure-payment-form .modal-wrapper": {
16
+ "font-family": string;
17
+ background: string;
18
+ "border-width": string;
19
+ "border-radius": string;
20
+ overflow: string;
21
+ };
22
+ };
23
+ export default styles;
@@ -0,0 +1,3 @@
1
+ export declare const INSTALLMENTS_KEY = "installments";
2
+ export declare const INSTALLMENTS_CONFIG_DEFAULT_CHANNEL = "CNP";
3
+ export declare const INSTALLMENTS_CONFIG_DEFAULT_ENTRY_MODE = "ECOM";
@@ -0,0 +1,18 @@
1
+ export declare enum InstallmentEvents {
2
+ CardInstallmentsFieldValidated = "card-installments-field-validated",
3
+ CardInstallmentsRequestStart = "card-installments-request-start",
4
+ CardInstallmentsRequestCompleted = "card-installments-request-completed",
5
+ CardInstallmentsRequestFailed = "card-installments-request-failed",
6
+ CardInstallmentsHide = "card-installments-hide",
7
+ CardInstallmentsRequestData = "card-installments-request-data",
8
+ CardInstallmentsPassData = "card-installments-pass-data",
9
+ CardInstallmentsAccumulateData = "card-installments-accumulate-data"
10
+ }
11
+ export declare enum InstallmentAvailableStatus {
12
+ Available = "AVAILABLE",
13
+ NotAvailable = "NOT_AVAILABLE"
14
+ }
15
+ export declare enum InstallmentTermModes {
16
+ APR = "APR",
17
+ FEE = "FEE"
18
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * InstallmentAction class model.
3
+ */
4
+ export default class InstallmentAction {
5
+ id: string;
6
+ type: string;
7
+ timeCreated: string;
8
+ resultCode: string;
9
+ appId: string;
10
+ appName: string;
11
+ constructor(_id: string, _type: string, _timeCreated: string, _resultCode: string, _appId: string, _appName: string);
12
+ }
13
+ export declare function installmentActionMapper(origin: {
14
+ id: string;
15
+ type: string;
16
+ time_created: string;
17
+ result_code: string;
18
+ app_id: string;
19
+ app_name: string;
20
+ }): InstallmentAction;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * InstallmentPaymentMethod class model.
3
+ */
4
+ export default class InstallmentPaymentMethod {
5
+ entryMode: string;
6
+ card: {
7
+ brand: string;
8
+ maskedNumberLast4: string;
9
+ };
10
+ constructor(_entryMode: string, _card: {
11
+ brand: string;
12
+ maskedNumberLast4: string;
13
+ });
14
+ }
15
+ export declare function installmentPaymentMethodMapper(origin: {
16
+ entry_mode: string;
17
+ card: {
18
+ brand: string;
19
+ masked_number_last4: string;
20
+ };
21
+ }): InstallmentPaymentMethod;
@@ -0,0 +1,50 @@
1
+ import InstallmentAction from "./installment-action";
2
+ import InstallmentPaymentMethod from "./installment-payment-method";
3
+ import InstallmentTerm from "./installment-term";
4
+ /**
5
+ * InstallmentPlansData class models the data returned from the server with the installment plans and terms.
6
+ */
7
+ export default class InstallmentPlansData {
8
+ id: string;
9
+ timeCreated: string;
10
+ type: string;
11
+ status: string;
12
+ channel: string;
13
+ amount: string;
14
+ currency: string;
15
+ country: string;
16
+ merchantId: string;
17
+ merchantName: string;
18
+ accountId: string;
19
+ accountName: string;
20
+ reference: string;
21
+ termsAndConditionsUrl: string;
22
+ providerImageUrl: string;
23
+ terms: InstallmentTerm[];
24
+ paymentMethod: InstallmentPaymentMethod;
25
+ action: InstallmentAction;
26
+ constructor(_id: string, _timeCreated: string, _type: string, _status: string, _channel: string, _amount: string, _currency: string, _country: string, _merchantId: string, _merchantName: string, _accountId: string, _accountName: string, _reference: string, _termsAndConditionsUrl: string, _providerImageUrl: string, _terms: InstallmentTerm[], _paymentMethod: InstallmentPaymentMethod, _action: InstallmentAction);
27
+ }
28
+ export declare function installmentPlansDataMapper(origin: {
29
+ id: string;
30
+ time_created: string;
31
+ type: string;
32
+ status: string;
33
+ channel: string;
34
+ amount: string;
35
+ currency: string;
36
+ country: string;
37
+ merchant_id: string;
38
+ merchant_name: string;
39
+ account_id: string;
40
+ account_name: string;
41
+ reference: string;
42
+ terms_and_conditions_url: string;
43
+ provider_image_url: string;
44
+ terms: any[];
45
+ payment_method: any;
46
+ action: any;
47
+ }): InstallmentPlansData;
48
+ export declare function verifyInstallmentAvailability(installmentPlansData: {
49
+ status: string;
50
+ }): boolean;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * InstallmentTermFees class model.
3
+ */
4
+ export default class InstallmentTermFees {
5
+ currency: string;
6
+ totalAmount: string;
7
+ fixedAmount: string;
8
+ monthlyAmount: string;
9
+ constructor(_currency: string, _totalAmount: string, _fixedAmount: string, _monthlyAmount: string);
10
+ }
11
+ export declare function installmentTermFeesMapper(origin: {
12
+ currency: string;
13
+ total_amount: string;
14
+ fixed_amount: string;
15
+ monthly_amount: string;
16
+ }): InstallmentTermFees;
@@ -0,0 +1,35 @@
1
+ import InstallmentTermFees from "./installment-term-fees";
2
+ /**
3
+ * InstallmentTerm class model.
4
+ */
5
+ export default class InstallmentTerm {
6
+ reference: string;
7
+ timeUnitAmount: string;
8
+ currency: string;
9
+ mode: string;
10
+ totalTimeUnitCount: string;
11
+ interestRate: string;
12
+ totalAmount?: string;
13
+ description: string;
14
+ expirationDate: string;
15
+ expirationInterestRate: string;
16
+ timeUnit: string;
17
+ termsAndConditionsUrl: string;
18
+ fees?: InstallmentTermFees;
19
+ constructor(_reference: string, _timeUnitAmount: string, _currency: string, _mode: string, _totalTimeUnitCount: string, _interestRate: string, _totalAmount: string, _description: string, _expirationDate: string, _expirationInterestRate: string, _timeUnit: string, _termsAndConditionsUrl: string, _fees?: InstallmentTermFees);
20
+ }
21
+ export declare function installmentTermMapper(origin: {
22
+ reference: string;
23
+ time_unit_amount: string;
24
+ currency: string;
25
+ mode: string;
26
+ total_time_unit_count: string;
27
+ interest_rate: string;
28
+ total_amount: string;
29
+ description: string;
30
+ expiration_date: string;
31
+ expiration_interest_rate: string;
32
+ terms_and_conditions_url: string;
33
+ time_unit: string;
34
+ fees?: any;
35
+ }): InstallmentTerm;
@@ -0,0 +1,2 @@
1
+ export declare const getCurrencySymbol: (currency: string) => string;
2
+ export declare const addCurrencyToAmount: (currency: string, amount: string | number | undefined) => string;
@@ -0,0 +1,88 @@
1
+ export declare const createHtmlElement: (elementType: string, props?: {
2
+ id?: string | undefined;
3
+ className?: string | undefined;
4
+ attributes?: {
5
+ [key: string]: string;
6
+ }[] | undefined;
7
+ } | undefined) => HTMLElement;
8
+ export declare const createHtmlDivElement: (props?: {
9
+ id?: string | undefined;
10
+ className?: string | undefined;
11
+ attributes?: {
12
+ [key: string]: string;
13
+ }[] | undefined;
14
+ } | undefined) => HTMLDivElement;
15
+ export declare const createHtmlSpanElement: (props?: {
16
+ id?: string | undefined;
17
+ className?: string | undefined;
18
+ attributes?: {
19
+ [key: string]: string;
20
+ }[] | undefined;
21
+ textContent?: string | undefined;
22
+ } | undefined) => HTMLSpanElement;
23
+ export declare const createHtmlButtonElement: (props?: {
24
+ id?: string | undefined;
25
+ className?: string | undefined;
26
+ attributes?: {
27
+ [key: string]: string;
28
+ }[] | undefined;
29
+ textContent?: string | undefined;
30
+ } | undefined) => HTMLButtonElement;
31
+ export declare const createHtmlImageElement: (props?: {
32
+ id?: string | undefined;
33
+ className?: string | undefined;
34
+ attributes?: {
35
+ [key: string]: string;
36
+ }[] | undefined;
37
+ src: string;
38
+ alt: string;
39
+ } | undefined) => HTMLImageElement;
40
+ export declare const createHtmlUlElement: (props?: {
41
+ id?: string | undefined;
42
+ className?: string | undefined;
43
+ attributes?: {
44
+ [key: string]: string;
45
+ }[] | undefined;
46
+ } | undefined) => HTMLUListElement;
47
+ export declare const createHtmlLiElement: (props?: {
48
+ id?: string | undefined;
49
+ className?: string | undefined;
50
+ attributes?: {
51
+ [key: string]: string;
52
+ }[] | undefined;
53
+ } | undefined) => HTMLLIElement;
54
+ export declare enum HtmlAnchorTarget {
55
+ Blank = "_blank",
56
+ Self = "_self",
57
+ Parent = "_parent",
58
+ Top = "_top"
59
+ }
60
+ export declare const createHtmlAnchorElement: (props?: {
61
+ id?: string | undefined;
62
+ className?: string | undefined;
63
+ attributes?: {
64
+ [key: string]: string;
65
+ }[] | undefined;
66
+ textContent?: string | undefined;
67
+ target?: HtmlAnchorTarget | undefined;
68
+ href: string;
69
+ } | undefined) => HTMLAnchorElement;
70
+ export declare const createHtmlCheckboxElement: (props?: {
71
+ id?: string | undefined;
72
+ className?: string | undefined;
73
+ attributes?: {
74
+ [key: string]: string;
75
+ }[] | undefined;
76
+ name?: string | undefined;
77
+ textContent?: string | undefined;
78
+ checked: boolean;
79
+ } | undefined) => HTMLInputElement;
80
+ export declare const createHtmlLabelElement: (props?: {
81
+ id?: string | undefined;
82
+ className?: string | undefined;
83
+ attributes?: {
84
+ [key: string]: string;
85
+ }[] | undefined;
86
+ htmlFor: string;
87
+ textContent?: string | undefined;
88
+ } | undefined) => HTMLLabelElement;
@@ -0,0 +1,48 @@
1
+ import { IframeField } from "../../../ui";
2
+ import InstallmentPlansData from "./contracts/installment-plans-data";
3
+ export declare class InstallmentsHandler {
4
+ private readonly iframeField;
5
+ private readonly installmentPlans;
6
+ private currentStepIndex;
7
+ private steps;
8
+ private context;
9
+ private selectedTermIndex;
10
+ private tokenizationCallback;
11
+ constructor(_iframeField: IframeField | undefined, _installmentPlans: InstallmentPlansData, _tokenizationCallback: (installment: InstallmentPaymentData) => void);
12
+ init(): void;
13
+ private moveNext;
14
+ private moveToInitialStep;
15
+ private updateContainerContent;
16
+ private createContainerElement;
17
+ private getInstallmentSteps;
18
+ private getInitialContext;
19
+ private explorePlansHanlder;
20
+ private selectTermHandler;
21
+ private payHandler;
22
+ private changePaymentMethodHandler;
23
+ private changeCreditCardFormFieldsVisibility;
24
+ }
25
+ export interface InstallmentsContext {
26
+ installmentPlans: InstallmentPlansData;
27
+ selectedTerm: number;
28
+ hasIssuerInfo?: boolean;
29
+ explorePlans: () => void;
30
+ selectTerm: (i: number) => void;
31
+ changePaymentMethod: () => void;
32
+ pay: (e: Event) => void;
33
+ updateContainerContent: () => void;
34
+ }
35
+ export interface InstallmentStepDefinition {
36
+ initialize?: (context: InstallmentsContext) => void;
37
+ contentHandler: (context: InstallmentsContext) => HTMLElement;
38
+ eventsListeners: (context: InstallmentsContext) => InstallmentEventListenerDefinition[];
39
+ }
40
+ export interface InstallmentEventListenerDefinition {
41
+ elementSelector: string;
42
+ eventName: string;
43
+ eventHandler: (e: Event) => void;
44
+ }
45
+ export interface InstallmentPaymentData {
46
+ id: string;
47
+ reference: string;
48
+ }
@@ -0,0 +1,3 @@
1
+ import { IDictionary } from "../../util";
2
+ declare const _default: (data: IDictionary) => Promise<unknown>;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ export declare const getProvidedByIssuerTemplate: (props: {
2
+ providerImageSrc: string;
3
+ providerImageAlt: string;
4
+ }) => HTMLElement;
5
+ export declare const getChangePaymentMethodTemplate: (buttonId: string) => HTMLElement;
6
+ export declare const getHaveVirginMoneyCreditCardBannerTemplate: () => HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { InstallmentStepDefinition } from "../installments-handler";
2
+ declare const _default: InstallmentStepDefinition;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { InstallmentStepDefinition } from "../installments-handler";
2
+ declare const _default: InstallmentStepDefinition;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ export declare const getLearnMoreModalContentTemplate: (buttonIds: {
2
+ closeButtonId: string;
3
+ explorePlansButtonId: string;
4
+ termsAndConditionsUrl: string;
5
+ providerImageSrc: string;
6
+ }) => HTMLElement;
@@ -69,7 +69,7 @@ export declare const fieldStyles: (assetBaseUrl: string) => {
69
69
  background: string;
70
70
  "background-size": string;
71
71
  };
72
- "img.card-number": {
72
+ "img.card-number-icon": {
73
73
  background: string;
74
74
  "background-size": string;
75
75
  width: string;
@@ -80,59 +80,59 @@ export declare const fieldStyles: (assetBaseUrl: string) => {
80
80
  "margin-top": string;
81
81
  "background-position": string;
82
82
  };
83
- "img.card-number[src$='/gp-cc-generic.svg']": {
83
+ "img.card-number-icon[src$='/gp-cc-generic.svg']": {
84
84
  background: string;
85
85
  "background-size": string;
86
86
  "background-position-y": string;
87
87
  };
88
- "img.card-number.invalid.card-type-amex": {
88
+ "img.card-number-icon.invalid.card-type-amex": {
89
89
  background: string;
90
90
  "background-size": string;
91
91
  "background-position-y": string;
92
92
  };
93
- "img.card-number.invalid.card-type-discover": {
93
+ "img.card-number-icon.invalid.card-type-discover": {
94
94
  background: string;
95
95
  "background-size": string;
96
96
  "background-position-y": string;
97
97
  width: string;
98
98
  };
99
- "img.card-number.invalid.card-type-jcb": {
99
+ "img.card-number-icon.invalid.card-type-jcb": {
100
100
  background: string;
101
101
  "background-size": string;
102
102
  "background-position-y": string;
103
103
  };
104
- "img.card-number.invalid.card-type-mastercard": {
104
+ "img.card-number-icon.invalid.card-type-mastercard": {
105
105
  background: string;
106
106
  "background-size": string;
107
107
  "background-position-y": string;
108
108
  };
109
- "img.card-number.invalid.card-type-visa": {
109
+ "img.card-number-icon.invalid.card-type-visa": {
110
110
  background: string;
111
111
  "background-size": string;
112
112
  "background-position-y": string;
113
113
  };
114
- "img.card-number.valid.card-type-amex": {
114
+ "img.card-number-icon.valid.card-type-amex": {
115
115
  background: string;
116
116
  "background-size": string;
117
117
  "background-position-y": string;
118
118
  };
119
- "img.card-number.valid.card-type-discover": {
119
+ "img.card-number-icon.valid.card-type-discover": {
120
120
  background: string;
121
121
  "background-size": string;
122
122
  "background-position-y": string;
123
123
  width: string;
124
124
  };
125
- "img.card-number.valid.card-type-jcb": {
125
+ "img.card-number-icon.valid.card-type-jcb": {
126
126
  background: string;
127
127
  "background-size": string;
128
128
  "background-position-y": string;
129
129
  };
130
- "img.card-number.valid.card-type-mastercard": {
130
+ "img.card-number-icon.valid.card-type-mastercard": {
131
131
  background: string;
132
132
  "background-size": string;
133
133
  "background-position-y": string;
134
134
  };
135
- "img.card-number.valid.card-type-visa": {
135
+ "img.card-number-icon.valid.card-type-visa": {
136
136
  background: string;
137
137
  "background-size": string;
138
138
  "background-position-y": string;