@globalpayments/js 3.0.8 → 3.0.12
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/README.md +29 -5
- package/package.json +1 -1
- package/types/common/enums.d.ts +7 -0
- package/types/internal/gateways/gp-api/index.d.ts +1 -1
- package/types/internal/gateways/index.d.ts +1 -1
- package/types/lib/version.d.ts +1 -1
- package/types/ui/iframe-field/action-set-custom-message.d.ts +8 -0
- package/types/ui/iframe-field/index.d.ts +9 -0
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ This plugin allows you to use online payments (eCommerce) features of a variety
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
|
-
<script src="https://js.globalpay.com/3.0.
|
|
27
|
+
<script src="https://js.globalpay.com/3.0.12/globalpayments.js"></script>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
> Note: Installing via NPM will only provide TypeScript types for type-checking.
|
|
@@ -449,19 +449,41 @@ const cardForm = GlobalPayments.ui.form({
|
|
|
449
449
|
fields: {
|
|
450
450
|
"card-holder-name": {
|
|
451
451
|
placeholder: "Jane Smith",
|
|
452
|
-
target: "#credit-card-card-holder"
|
|
452
|
+
target: "#credit-card-card-holder",
|
|
453
|
+
validationMessages: {
|
|
454
|
+
NotValidCardHolderName: 'Please enter a valid Card Holder Name',
|
|
455
|
+
CharactersMoreThan100: 'Card Holder Name can be at most 100 characters'
|
|
456
|
+
}
|
|
453
457
|
},
|
|
454
458
|
"card-number": {
|
|
455
459
|
placeholder: "•••• •••• •••• ••••",
|
|
456
|
-
target: "#credit-card-card-number"
|
|
460
|
+
target: "#credit-card-card-number",
|
|
461
|
+
validationMessages: {
|
|
462
|
+
Required: 'A Card Number is required',
|
|
463
|
+
CharactersLessThan12: 'The Card Number must consist of at least 12 digits',
|
|
464
|
+
NumberIsNotValid: 'The Card Number is not valid',
|
|
465
|
+
NotAllowedCardType: 'Cannot process this card type, please use another Card'
|
|
466
|
+
},
|
|
457
467
|
},
|
|
458
468
|
"card-expiration": {
|
|
459
469
|
placeholder: "MM / YYYY",
|
|
460
|
-
target: "#credit-card-card-expiration"
|
|
470
|
+
target: "#credit-card-card-expiration",
|
|
471
|
+
validationMessages: {
|
|
472
|
+
NotCompleted: 'Please enter a valid month/year',
|
|
473
|
+
YearNotValid: 'The year is not valid',
|
|
474
|
+
MonthNotValid: 'The month is not valid',
|
|
475
|
+
ExpiryDateNotValid: 'The Expiry Date is not valid',
|
|
476
|
+
}
|
|
461
477
|
},
|
|
462
478
|
"card-cvv": {
|
|
463
479
|
placeholder: "•••",
|
|
464
|
-
target: "#credit-card-card-cvv"
|
|
480
|
+
target: "#credit-card-card-cvv",
|
|
481
|
+
validationMessages: {
|
|
482
|
+
CodeIsNotValid: 'The Card CVV is not valid',
|
|
483
|
+
CodeIsLessThan3Digits: 'Card CVV is too short',
|
|
484
|
+
CodeMustBe3Digits: 'Card CVV must be 3 digits',
|
|
485
|
+
AmexCodeMustBe4Digits: 'Card CVV for Amex must be 4 digits',
|
|
486
|
+
}
|
|
465
487
|
},
|
|
466
488
|
"submit": {
|
|
467
489
|
value: "Submit",
|
|
@@ -473,6 +495,8 @@ const cardForm = GlobalPayments.ui.form({
|
|
|
473
495
|
});
|
|
474
496
|
```
|
|
475
497
|
|
|
498
|
+
The list of validation messages is accessible at [/packages/globalpayments-js/src/internal/lib/translations/en.ts](https://github.globalpay.com/Developer-Experience/globalpayments-js/blob/94540f9ca68bc627f4d3e038b2cec36c6bd317b0/packages/globalpayments-js/src/internal/lib/translations/en.ts#L13)
|
|
499
|
+
|
|
476
500
|

|
|
477
501
|
|
|
478
502
|
> See demo on [JSFiddle](https://jsfiddle.net/dcy5wz2k/2/)
|
package/package.json
CHANGED
package/types/common/enums.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare enum CardFormFieldNames {
|
|
|
6
6
|
CardHolderName = "card-holder-name"
|
|
7
7
|
}
|
|
8
8
|
export declare enum HostedFieldValidationEvents {
|
|
9
|
+
SetCustomValidationMessages = "hosted-field-set-custom-validation-messages",
|
|
9
10
|
BuiltInValidationShow = "hosted-field-built-in-validation-show",
|
|
10
11
|
BuiltInValidationHide = "hosted-field-built-in-validation-hide",
|
|
11
12
|
ValidationCvvTooltipShow = "hosted-field-validation-cvv-tooltip-show",
|
|
@@ -24,3 +25,9 @@ export declare enum CardFormFieldValidationTestEvents {
|
|
|
24
25
|
CardCvv = "card-cvv-test",
|
|
25
26
|
CardHolderName = "card-holder-name-test"
|
|
26
27
|
}
|
|
28
|
+
export declare enum Environments {
|
|
29
|
+
Local = "local",
|
|
30
|
+
QA = "qa",
|
|
31
|
+
Sandbox = "sandbox",
|
|
32
|
+
Production = "production"
|
|
33
|
+
}
|
|
@@ -22,7 +22,7 @@ export declare const urls: {
|
|
|
22
22
|
assetBaseUrl: (result: string) => string;
|
|
23
23
|
tokenization: (prod: boolean) => string;
|
|
24
24
|
queryInstallmentPlans: (prod: boolean) => string;
|
|
25
|
-
getQRCodePaymentMethodsUrl: (
|
|
25
|
+
getQRCodePaymentMethodsUrl: () => string;
|
|
26
26
|
};
|
|
27
27
|
export declare const actions: IActions;
|
|
28
28
|
export declare const requiredSettings: string[];
|
|
@@ -76,7 +76,7 @@ export interface IUrlGenerators {
|
|
|
76
76
|
assetBaseUrl?: (result: string) => string;
|
|
77
77
|
tokenization: (prod: boolean) => string;
|
|
78
78
|
queryInstallmentPlans?: (prod: boolean) => string;
|
|
79
|
-
getQRCodePaymentMethodsUrl?: (
|
|
79
|
+
getQRCodePaymentMethodsUrl?: () => string;
|
|
80
80
|
}
|
|
81
81
|
export interface IGatewayModule {
|
|
82
82
|
[key: string]: any;
|
package/types/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "3.0.
|
|
1
|
+
declare const _default: "3.0.12";
|
|
2
2
|
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _default: (type: any, customMessages: object) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Updates the messages for a specific validation field based on custom messages
|
|
4
|
+
*
|
|
5
|
+
* @param type - the type of the validation field (e.g., 'card-number', 'card-expiration')
|
|
6
|
+
* @param customMessages - an object containing custom messages to override the default ones
|
|
7
|
+
*/
|
|
8
|
+
export default _default;
|
|
@@ -12,6 +12,7 @@ export interface IUIFormField {
|
|
|
12
12
|
value?: string;
|
|
13
13
|
amount?: string;
|
|
14
14
|
fieldOptions?: any;
|
|
15
|
+
validationMessages?: object;
|
|
15
16
|
}
|
|
16
17
|
export declare const fieldTypeAutocompleteMap: IDictionary;
|
|
17
18
|
/**
|
|
@@ -150,6 +151,14 @@ export declare class IframeField extends EventEmitter {
|
|
|
150
151
|
* @param title The desired title
|
|
151
152
|
*/
|
|
152
153
|
setTitle(title: string): void;
|
|
154
|
+
/**
|
|
155
|
+
* Sets custom validation messages for the hosted field
|
|
156
|
+
*
|
|
157
|
+
* @param customMessages - an object containing custom validation messages
|
|
158
|
+
* The `msg` object should have keys corresponding to specific validation messages for the field.
|
|
159
|
+
* For example, { NotCompleted: 'Custom not completed message', YearNotValid: 'Custom year not valid message' }.
|
|
160
|
+
*/
|
|
161
|
+
setCustomValidationMessages(customMessages: object): void;
|
|
153
162
|
/**
|
|
154
163
|
* Show the validation of a hosted field
|
|
155
164
|
*
|