@globalpayments/js 1.8.4 → 1.8.6

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 CHANGED
@@ -33,25 +33,38 @@ This plugin allows you to use online payments (eCommerce) features of a variety
33
33
 
34
34
  #### Options
35
35
 
36
- ##### `publicApiKey` - `string`
36
+ ##### `publicApiKey` - `string` (Optional)
37
37
 
38
- > Note: Applies to Heartland eCommerce only.
38
+ > Note: Applies to Heartland Online Payments only.
39
39
 
40
40
  The public API key associated with the merchant account. This API key is tied to a specific merchant/teminal account combination at Heartland and requires a matching secret API key to consume this value.
41
41
 
42
- ##### `merchantId` - `string`
42
+ ##### `binCheck` - `object` (Optional)
43
43
 
44
- > Note: Applies to Global Payments eCommerce only.
44
+ > Note: Applies to Heartland Online Payments only.
45
+
46
+ Enables a BIN check for various capabilities.
47
+
48
+ | Key | Type | Default | Description |
49
+ |-----|------|---------|-------------|
50
+ | `hsaFsa` | `boolean` | `false` | Determines if the supplied card is for healthcare use (HSA/FSA). |
51
+ | `surcharge` | `boolean` | `false` | Deterimines if the supplied card can be surcharged. |
52
+
53
+ ##### `merchantId` - `string` (Optional)
54
+
55
+ > Note: Applies to Global Payments eCommerce and GP API only.
45
56
 
46
- The merchant ID value supplied by Global Payments eCommerce.
57
+ For Global Payments eCommerce integrations, the merchant ID value supplied for the account.
47
58
 
48
- ##### `account` - `string`
59
+ For GP API integrations using multi-merchant support, the merchant ID value for a specific merchant account supported by the partner.
60
+
61
+ ##### `account` - `string` (Optional)
49
62
 
50
63
  > Note: Applies to Global Payments eCommerce only.
51
64
 
52
65
  The account ID value supplied by Global Payments eCommerce.
53
66
 
54
- ##### `env` - `string`
67
+ ##### `env` - `string` (Optional)
55
68
 
56
69
  Supported values:
57
70
 
@@ -60,7 +73,7 @@ Supported values:
60
73
 
61
74
  > Note: For Heartland eCommerce, this value is inferred from the configured `publicApiKey`.
62
75
 
63
- ##### `hash` - `(object) => Promise<object>`
76
+ ##### `hash` - `(object) => Promise<object>` (Optional)
64
77
 
65
78
  > Note: Applies to Global Payments eCommerce only.
66
79
 
@@ -141,6 +154,14 @@ The target API version. Default is `2020-10-22`.
141
154
 
142
155
  The transaction reference for the tokenization request. If not provided, a GUID is created and sent in the request.
143
156
 
157
+ ##### `enableAutocomplete` - `boolean` (Optional)
158
+
159
+ Enables autocomplete / autofill features. Default is `false`.
160
+
161
+ ##### `language` - `string` (Optional)
162
+
163
+ Value for the `html` element's `lang` attribute within the iframes. Default is `en`.
164
+
144
165
  #### Examples
145
166
 
146
167
  ##### Heartland eCommerce
@@ -1,6 +1,7 @@
1
1
  const replace = require('replace-in-file');
2
2
  const options = {
3
3
  files: [
4
+ 'src/assets/artifactVersion.txt',
4
5
  'src/lib/version.ts',
5
6
  'README.md',
6
7
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalpayments/js",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "author": "Heartland Developer Portal <developers@heartland.us>",
5
5
  "license": "GPL-2.0",
6
6
  "repository": {
@@ -26,11 +26,11 @@
26
26
  "test:serve": "serve -p 7777"
27
27
  },
28
28
  "dependencies": {
29
- "globalpayments-lib": "^1.8.4"
29
+ "globalpayments-lib": "^1.8.6"
30
30
  },
31
31
  "devDependencies": {
32
32
  "rimraf": "*",
33
33
  "rollup": "*"
34
34
  },
35
- "gitHead": "09776fcfe6140ce5b1ea8fc55fb4867b15565f1d"
35
+ "gitHead": "515ab8c7ccf4d644af66c3aeb166d3041ede513b"
36
36
  }
@@ -1,4 +1,20 @@
1
1
  import UIForm, { IUIFormOptions } from "../ui/form";
2
2
  export declare const defaultOptions: IUIFormOptions;
3
+ /**
4
+ * Allows integrators to create a standard drop-in form for
5
+ * accepting credit card data.
6
+ *
7
+ * @param target Target element to contain the drop-in form
8
+ * @param formOptions Options for the drop-in form
9
+ * @returns
10
+ */
3
11
  export declare function form(target: string | HTMLElement, formOptions?: IUIFormOptions): UIForm;
12
+ /**
13
+ * Allows integrators to create a drop-in form for accepting
14
+ * track data from a human interface device (HID).
15
+ *
16
+ * @param target Target element to contain the drop-in form
17
+ * @param formOptions Options for the drop-in form
18
+ * @returns
19
+ */
4
20
  export declare function trackReaderForm(target: string | HTMLElement, formOptions?: IUIFormOptions): UIForm;
@@ -1,3 +1,11 @@
1
1
  import UIForm, { IUIFormOptions } from "../ui/form";
2
2
  export declare const defaultOptions: IUIFormOptions;
3
+ /**
4
+ * Allows integrators to create a standard drop-in form for
5
+ * accepting eCheck / ACH data.
6
+ *
7
+ * @param target Target element to contain the drop-in form
8
+ * @param formOptions Options for the drop-in form
9
+ * @returns
10
+ */
3
11
  export declare function form(target: string | HTMLElement, formOptions?: IUIFormOptions): UIForm;
@@ -1,3 +1,11 @@
1
1
  import UIForm, { IUIFormOptions } from "../ui/form";
2
2
  export declare const defaultOptions: IUIFormOptions;
3
+ /**
4
+ * Allows integrators to create a standard drop-in form for
5
+ * accepting gift and loyalty card data.
6
+ *
7
+ * @param target Target element to contain the drop-in form
8
+ * @param formOptions Options for the drop-in form
9
+ * @returns
10
+ */
3
11
  export declare function form(target: string | HTMLElement, formOptions?: IUIFormOptions): UIForm;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Provides integrators helper functions for working with events.
3
+ */
1
4
  export default class Events {
2
5
  /**
3
6
  * addHandler
@@ -1,2 +1,2 @@
1
- declare const _default: "1.8.4";
1
+ declare const _default: "1.8.6";
2
2
  export default _default;
@@ -1,2 +1,8 @@
1
1
  declare const _default: (status: PaymentComplete) => void;
2
+ /**
3
+ * Completes a payment via the PaymentRequest API after
4
+ * the server-side authorization request is performed
5
+ *
6
+ * @param data Payment status: "fail", "success", "unknown"
7
+ */
2
8
  export default _default;
@@ -5,4 +5,22 @@ export declare class PaymentRequestEmitter extends EventEmitter {
5
5
  constructor(iframe: IframeField);
6
6
  on(event: string, listener: IEventListener): void;
7
7
  }
8
+ /**
9
+ * Initiates a payment card via the PaymentRequest API
10
+ * to leverage card data stored in a cardholder's
11
+ * browser, tokenizing it via the configured gateway
12
+ * implementation. This is triggered in the parent
13
+ * window, but the PaymentRequest functionality and
14
+ * data only exists within the hosted field.
15
+ *
16
+ * @param selector Selector for the target element.
17
+ * @param details PaymentRequest details. Default includes
18
+ * no details.
19
+ * @param instruments PaymentRequest instruments to allow.
20
+ * Default includes a single instrument for
21
+ * `basic-card`.
22
+ * @param options Additional PaymentRequest options
23
+ * @param startOnLoad If true, the payment card will be
24
+ * shown once the hosted field loads
25
+ */
8
26
  export default function (selector: string, details?: PaymentDetailsInit, instruments?: PaymentMethodData[], options?: PaymentOptions, startOnLoad?: boolean): void | PaymentRequestEmitter;
@@ -1,13 +1,16 @@
1
1
  import { IDictionary } from "../internal/lib/util";
2
- export interface IConfiguration {
3
- [key: string]: any;
2
+ /**
3
+ * Defines expected configuration properties for using the
4
+ * library with the supported gateway implementations.
5
+ */
6
+ export interface IConfiguration extends IDictionary {
7
+ enableAutocomplete?: boolean;
8
+ language?: string;
9
+ publicApiKey?: string;
4
10
  binCheck?: {
5
11
  hsaFsa?: boolean;
6
12
  surcharge?: boolean;
7
13
  };
8
- enableAutocomplete?: boolean;
9
- language?: string;
10
- publicApiKey?: string;
11
14
  merchantId?: string;
12
15
  account?: string;
13
16
  hash?: (data: IDictionary) => Promise<IDictionary>;
@@ -26,4 +29,9 @@ export interface IConfiguration {
26
29
  reference?: string;
27
30
  }
28
31
  declare const _default: (options: IConfiguration) => void;
32
+ /**
33
+ * Allows integrators to configure the library with their
34
+ * desired merchant account configuration and any global
35
+ * library flags.
36
+ */
29
37
  export default _default;
@@ -44,7 +44,9 @@ export declare const fieldStyles: () => {
44
44
  border: string;
45
45
  "box-sizing": string;
46
46
  color: string;
47
- cursor: string;
47
+ cursor: string; /**
48
+ * Represents logic surrounding a group of hosted fields.
49
+ */
48
50
  display: string;
49
51
  "font-family": string;
50
52
  "font-size": string;
@@ -425,7 +427,12 @@ export declare const parentStyles: () => {
425
427
  color: string;
426
428
  overflow: string;
427
429
  "background-size": string;
428
- background: string;
430
+ background: string; /**
431
+ * Sets a special-case event listener that fires when all hosted
432
+ * fields in a form have registered / loaded
433
+ *
434
+ * @param fn The listener function
435
+ */
429
436
  };
430
437
  ".secure-payment-form .tooltip-content": {
431
438
  visibility: string;
@@ -540,15 +547,48 @@ export declare const frameFieldTypes: string[];
540
547
  export interface IUIFormFields {
541
548
  [key: string]: IUIFormField;
542
549
  }
550
+ /**
551
+ * Represents logic surrounding a group of hosted fields.
552
+ */
543
553
  export default class UIForm {
544
554
  frames: IFrameCollection;
545
555
  fields: IUIFormFields;
546
556
  styles: object;
547
557
  private totalNumberOfFields;
558
+ /**
559
+ * Instantiates a new UIForm object for a group of hosted fields
560
+ *
561
+ * @param fields Hosted field configuration
562
+ * @param styles Custom CSS configuration
563
+ */
548
564
  constructor(fields: IUIFormFields, styles: object);
549
- on(type: string, event: string | IEventListener, listener?: IEventListener): this | undefined;
565
+ /**
566
+ * Sets an event listener for an event type
567
+ *
568
+ * @param fieldTypeOrEventName The field type on which the listener should
569
+ * be applied, or the type of event that should trigger the listener
570
+ * @param eventNameOrListener The type of event that should trigger the
571
+ * listener, or the listener function
572
+ * @param listener The listener function when both field type and event type
573
+ * are provided
574
+ */
575
+ on(fieldTypeOrEventName: string, eventNameOrListener: string | IEventListener, listener?: IEventListener): this | undefined;
576
+ /**
577
+ * Appends additional CSS rules to the group of hosted fields
578
+ *
579
+ * @param json New CSS rules
580
+ */
550
581
  addStylesheet(json: IDictionary): this | undefined;
582
+ /**
583
+ * Sets a special-case event listener that fires when all hosted
584
+ * fields in a form have registered / loaded
585
+ *
586
+ * @param fn The listener function
587
+ */
551
588
  ready(fn: (fields: IFrameCollection) => void): void;
589
+ /**
590
+ * Deletes all hosted fields within the form
591
+ */
552
592
  dispose(): void;
553
593
  private createFrames;
554
594
  private requestDataFromAll;
@@ -1,3 +1,9 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, type: string, data: IDictionary) => void;
3
+ /**
4
+ * Once data is accumulated from the other hosted fields,
5
+ * the `card-number` / `account-number` hosted field initiates
6
+ * the tokenization request with the configured gateway.
7
+ *
8
+ */
3
9
  export default _default;
@@ -1,2 +1,8 @@
1
1
  declare const _default: (id: string) => void;
2
+ /**
3
+ * Once initiated, the hosted field accepts track data via a
4
+ * human input device (HID) into a hidden text field
5
+ *
6
+ * @param id ID of the hosted field
7
+ */
2
8
  export default _default;
@@ -1,2 +1,9 @@
1
1
  declare const _default: (id: string, type: string) => void;
2
+ /**
3
+ * Gets the value of the `card-cvv` hosted field
4
+ *
5
+ * @param id ID of the hosted field
6
+ * @param type Field type of the hosted field
7
+ * @returns
8
+ */
2
9
  export default _default;
@@ -1,3 +1,13 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, data: IDictionary) => Promise<void>;
3
+ /**
4
+ * Completes a payment via the PaymentRequest API
5
+ * after the integrator performs the server-side
6
+ * authorization request. This is triggered in the parent
7
+ * window, but the PaymentRequest functionality and
8
+ * data only exists within the hoted field.
9
+ *
10
+ * @param id ID of the hosted field
11
+ * @param data Payment status from the integrator
12
+ */
3
13
  export default _default;
@@ -1,3 +1,14 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, data: IDictionary) => Promise<void>;
3
+ /**
4
+ * Initiates a payment card via the PaymentRequest API
5
+ * to leverage card data stored in a cardholder's
6
+ * browser, tokenizing it via the configured gateway
7
+ * implementation. This is triggered in the parent
8
+ * window, but the PaymentRequest functionality and
9
+ * data only exists within the hosted field.
10
+ *
11
+ * @param id ID of the hosted field
12
+ * @param data PaymentRequest details
13
+ */
3
14
  export default _default;
@@ -1,3 +1,12 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, type: string, data: IDictionary) => void;
3
+ /**
4
+ * Causes the hosted field to send its data to the `card-number`
5
+ * field for tokenization when triggered by the
6
+ * `ui:iframe-field:request-data` event.
7
+ *
8
+ * @param id ID of the hosted field
9
+ * @param type Field type of the hosted field
10
+ * @param data Information about the recipient hosted field
11
+ */
3
12
  export default _default;
@@ -1,2 +1,11 @@
1
1
  declare const _default: (cardType?: string | undefined) => void;
2
+ /**
3
+ * Sets the class list of a hosted field to include
4
+ * the card type inferred from the `card-number` field
5
+ * emitting the `ui:iframe-field:card-type` through
6
+ * the parent window.
7
+ *
8
+ * @param cardType The inferred card type
9
+ * @returns
10
+ */
2
11
  export default _default;
@@ -1,2 +1,5 @@
1
1
  declare const _default: () => void;
2
+ /**
3
+ * Sets input focus on the hosted field
4
+ */
2
5
  export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (text: string) => void;
2
+ /**
3
+ * Sets the label of a hosted field
4
+ *
5
+ * @param text The desired input label
6
+ */
2
7
  export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (placeholder: string) => void;
2
+ /**
3
+ * Sets the placeholder text of a hosted field
4
+ *
5
+ * @param placeholder The desired palceholder text
6
+ */
2
7
  export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (text: string) => void;
2
+ /**
3
+ * Sets the text content of a hosted field
4
+ *
5
+ * @param text The desired text value
6
+ */
2
7
  export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (text: string) => void;
2
+ /**
3
+ * Sets the value of a hosted field
4
+ *
5
+ * @param text The desired input value
6
+ */
2
7
  export default _default;
@@ -12,8 +12,28 @@ export interface IUIFormField {
12
12
  value?: string;
13
13
  }
14
14
  export declare const fieldTypeAutocompleteMap: IDictionary;
15
+ /**
16
+ * Represents logic surrounding individual hosted fields.
17
+ *
18
+ * Static methods are ran within the iframe / child window.
19
+ *
20
+ * Instance methods are ran within the parent window.
21
+ */
15
22
  export declare class IframeField extends EventEmitter {
23
+ /**
24
+ * Sets up the hosted field's iframe for further
25
+ * processing, and registers the hosted field
26
+ * with the parent window.
27
+ *
28
+ * @param type Field type of the hosted field
29
+ */
16
30
  static register(type: string): void;
31
+ /**
32
+ * Sets the hosted field's `lang` attribute on the `html` element
33
+ * with the globally configured value.
34
+ *
35
+ * @param lang The configured language code
36
+ */
17
37
  static setHtmlLang(lang: string): void;
18
38
  /**
19
39
  * Creates the inner field within the iframe window and sets
@@ -49,11 +69,17 @@ export declare class IframeField extends EventEmitter {
49
69
  * Sets the iframe window's postMessage handler in order to
50
70
  * react to parent/sibling events.
51
71
  *
52
- * @param id Field ID
53
- * @param type Field type
72
+ * @param id ID of the hosted field
73
+ * @param type Field type of the hosted field
54
74
  * @param targetOrigin Parent window's origin
55
75
  */
56
76
  static addMessageListener(id: string, type: string, targetOrigin: string): void;
77
+ /**
78
+ * Triggers a resize of the hosted field's iframe element
79
+ * within the parent window.
80
+ *
81
+ * @param id ID of the hosted field
82
+ */
57
83
  static triggerResize(id: string): void;
58
84
  container: Element | null;
59
85
  frame: HTMLIFrameElement;
@@ -61,14 +87,65 @@ export declare class IframeField extends EventEmitter {
61
87
  targetNode: any;
62
88
  type: "button" | "input";
63
89
  url: string;
90
+ /**
91
+ * Instantiates a new IframeField object for a hosted field
92
+ *
93
+ * @param type Field type of the hosted field
94
+ * @param opts Options for creating the iframe / hosted field
95
+ * @param src URL for the hosted field's iframe
96
+ */
64
97
  constructor(type: string, opts: IUIFormField, src: string);
98
+ /**
99
+ * Appends additional CSS rules to the hosted field
100
+ *
101
+ * @param json New CSS rules
102
+ */
65
103
  addStylesheet(json: IDictionary): void;
104
+ /**
105
+ * Gets the CVV value from the `card-cvv` hosted field.
106
+ *
107
+ * Used by gateway implementations that do not store the CVV
108
+ * with the token value:
109
+ *
110
+ * - TransIT (tsep)
111
+ * - Heartland Bill pay (billpay)
112
+ *
113
+ * @returns A promise that resolves with the CVV value
114
+ */
66
115
  getCvv(): Promise<unknown>;
116
+ /**
117
+ * Sets input focus on the hosted field
118
+ */
67
119
  setFocus(): void;
120
+ /**
121
+ * Sets the placeholder text of a hosted field
122
+ *
123
+ * @param placeholder The desired palceholder text
124
+ */
68
125
  setPlaceholder(placeholder: string): void;
126
+ /**
127
+ * Sets the text content of a hosted field
128
+ *
129
+ * @param text The desired text value
130
+ */
69
131
  setText(text: string): void;
132
+ /**
133
+ * Sets the value of a hosted field
134
+ *
135
+ * @param value The desired input value
136
+ */
70
137
  setValue(value: string): void;
138
+ /**
139
+ * Sets the label of a hosted field
140
+ *
141
+ * @param label The desired input label
142
+ */
71
143
  setLabel(label: string): void;
144
+ /**
145
+ * Sets the title of a hosted field
146
+ *
147
+ * @param title The desired title
148
+ */
72
149
  setTitle(title: string): void;
73
150
  private makeFrame;
74
151
  }
@@ -1,3 +1,10 @@
1
1
  import UIForm from "./form";
2
2
  export * from "./iframe-field";
3
+ /**
4
+ * Allows integrators to custom payment data entry forms for credit
5
+ * card, eCheck / ACH, or gift and loyalty cards.
6
+ *
7
+ * @param options Form options.
8
+ * @returns
9
+ */
3
10
  export declare function form(options: any): UIForm;