@fat-zebra/sdk 1.4.9 → 1.4.10

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/dist/main.js CHANGED
@@ -24,6 +24,7 @@ export default class FatZebra {
24
24
  this.gatewayClient = new GatewayClient({
25
25
  accessToken: window.localStorage.getItem(LocalStorageAccessTokenKey),
26
26
  username: config.username,
27
+ environment: process.env.API_ENV,
27
28
  });
28
29
  this.sca = new Sca({
29
30
  gatewayClient: this.gatewayClient,
@@ -1,3 +1,2 @@
1
1
  import VerifyCard from "./VerifyCard";
2
- import submitForm from "./submitForm";
3
- export { VerifyCard, submitForm };
2
+ export { VerifyCard };
@@ -1,3 +1,2 @@
1
1
  import VerifyCard from "./VerifyCard";
2
- import submitForm from "./submitForm";
3
- export { VerifyCard, submitForm };
2
+ export { VerifyCard };
package/dist/react/url.js CHANGED
@@ -8,7 +8,9 @@ const generatePaymentURL = (values, environment) => {
8
8
  "iframe",
9
9
  "postmessage",
10
10
  "hide_card_holder",
11
- "hide_button",
11
+ "return_path",
12
+ "card_types",
13
+ "surcharge_enabled",
12
14
  "sca_enabled",
13
15
  ];
14
16
  const environmentConfig = env[environment || Environment.sandbox];
@@ -25,8 +27,6 @@ const generatePaymentURL = (values, environment) => {
25
27
  iframe: true,
26
28
  postmessage: true,
27
29
  tokenize_only: values.tokenize_only,
28
- hide_card_holder: values.hide_card_holder,
29
- hide_button: values.hide_button,
30
30
  });
31
31
  return url;
32
32
  };
@@ -33,7 +33,7 @@ declare class Sca {
33
33
  loadScript(): void;
34
34
  get cardinal(): CardinalManager;
35
35
  set cardinal(cardinal: CardinalManager);
36
- reportFailure(message: string): void;
36
+ reportFailure(message: string, data?: any): void;
37
37
  reportSuccess(message: string, data: any): void;
38
38
  run(config: ScaRunProps): Promise<void>;
39
39
  createCardinalJWT(): Promise<string>;
package/dist/sca/index.js CHANGED
@@ -40,13 +40,13 @@ class Sca {
40
40
  set cardinal(cardinal) {
41
41
  this._cardinal = cardinal;
42
42
  }
43
- reportFailure(message) {
43
+ reportFailure(message, data) {
44
44
  if (this.failureCallback) {
45
- const event = new CustomEvent(PublicEvent.SCA_ERROR, { detail: { errors: [message] } });
45
+ const event = new CustomEvent(PublicEvent.SCA_ERROR, { detail: { errors: [message], data: data } });
46
46
  this.failureCallback(event);
47
47
  }
48
48
  else {
49
- emit(PublicEvent.SCA_ERROR, { errors: [message], data: null });
49
+ emit(PublicEvent.SCA_ERROR, { errors: [message], data: data });
50
50
  }
51
51
  console.log(message);
52
52
  }
@@ -116,7 +116,9 @@ class Sca {
116
116
  this.reportSuccess(`FatZebra.3DS: 3DS success - ${scenario.description}.`, threedsData);
117
117
  }
118
118
  else {
119
- this.reportFailure(`FatZebra.3DS: 3DS error - ${scenario.description} - ${scenario.outcome.errorCode}`);
119
+ this.reportFailure(`FatZebra.3DS: 3DS error - ${scenario.description} - ${scenario.outcome.errorCode}`, {
120
+ errorCode: scenario.outcome.errorCode,
121
+ });
120
122
  }
121
123
  }));
122
124
  }
@@ -198,7 +200,7 @@ class Sca {
198
200
  this.reportSuccess(`FatZebra.3DS: 3DS success - ${scenario.description}.`, threedsData);
199
201
  }
200
202
  else {
201
- this.reportFailure(`FatZebra.3DS: 3DS error - ${scenario.description} - ${scenario.outcome.errorCode}`);
203
+ this.reportFailure(`FatZebra.3DS: 3DS error - ${scenario.description} - ${scenario.outcome.errorCode}`, { errorCode: scenario.outcome.errorCode });
202
204
  }
203
205
  }
204
206
  }
@@ -45,7 +45,12 @@ class GatewayClient {
45
45
  }
46
46
  enrolSCA(data) {
47
47
  return __awaiter(this, void 0, void 0, function* () {
48
- return this.client.post("/sca/enrollment", data);
48
+ return this.client.post("/sca/enrollment", data).then((response) => response).catch(err => {
49
+ if (err.response && err.response.status == 422) {
50
+ return err.response;
51
+ }
52
+ throw err;
53
+ });
49
54
  });
50
55
  }
51
56
  validateSCA(data) {
@@ -97,8 +97,7 @@ export type PaymentConfig = {
97
97
  options: OptionalUrlValues;
98
98
  };
99
99
  export type OptionalUrlValues = {
100
- hide_card_holder?: boolean;
101
- hide_button?: boolean;
100
+ hide_card_holder?: string;
102
101
  return_path?: string;
103
102
  card_types?: Array<string>;
104
103
  surcharge_enabled?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fat-zebra/sdk",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {