tonder-web-sdk 1.12.0-beta.0 → 1.12.0-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tonder-web-sdk",
3
- "version": "1.12.0-beta.0",
3
+ "version": "1.12.0-beta.1",
4
4
  "description": "tonder sdk for integrations",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -34,16 +34,24 @@ export class LiteInlineCheckout extends BaseInlineCheckout {
34
34
  * or update an existing one.
35
35
  * @param {string} authToken - The customer's authentication token.
36
36
  * @param {string} businessId - The business primary key.
37
- * @param {Object} cardData - The card information to be saved.
37
+ * @param {Object} card - The card information to be saved.
38
38
  * @returns {Promise<Object>} A promise that resolves with the saved card data.
39
39
  * @public
40
40
  */
41
- async saveCustomerCard(authToken, businessId, cardData) {
41
+ async saveCustomerCard(authToken, businessId, card) {
42
+ const skyflowTokens = await getSkyflowTokens({
43
+ vault_id: vault_id,
44
+ vault_url: vault_url,
45
+ data: card,
46
+ baseUrl: this.baseUrl,
47
+ apiKey: this.apiKeyTonder,
48
+ });
49
+
42
50
  return await saveCustomerCard(
43
51
  this.baseUrl,
44
52
  authToken,
45
53
  businessId,
46
- cardData,
54
+ skyflowTokens,
47
55
  );
48
56
  }
49
57
 
@@ -102,6 +102,7 @@ export class InlineCheckout extends BaseInlineCheckout{
102
102
  }
103
103
 
104
104
  injectCheckout() {
105
+ console.log("HERE: 1", InlineCheckout.injected)
105
106
  if (InlineCheckout.injected) return
106
107
  const containerTonderCheckout = document.querySelector("#tonder-checkout");
107
108
  if (containerTonderCheckout) {
package/types/index.d.ts CHANGED
@@ -1,14 +1,79 @@
1
- export interface InlineCheckoutOptions {
2
- mode?: string;
3
- apiKey: string;
4
- returnUrl: string;
5
- renderPaymentButton?: boolean;
6
- callBack?: (response: any) => void;
7
- styles?: Record<string, string>;
8
- }
1
+ export class InlineCheckout {
2
+ constructor(options: InlineCheckoutOptions);
3
+ configureCheckout(data: { customer?: Customer }): Promise<void>;
4
+ injectCheckout(): Promise<void>;
5
+ payment(): Promise<void>;
6
+ verify3dsTransaction(): Promise<void>;
7
+ }
8
+
9
+
10
+ export class LiteInlineCheckout {
11
+ constructor(options: InlineLiteCheckoutOptions);
12
+ configureCheckout(data: { customer?: Customer }): void;
13
+ injectCheckout(): Promise<void>;
14
+ payment(): Promise<void>;
15
+ verify3dsTransaction(): Promise<void>;
16
+ getCustomerCards(authToken: string, businessId: string | number): Promise<CustomerCards>;
9
17
 
10
- export class InlineCheckout {
11
- constructor(options: InlineCheckoutOptions);
12
- injectCheckout(): void;
13
- }
14
-
18
+ /**
19
+ * Saves a card to a customer's account. This method can be used to add a new card
20
+ * or update an existing one.
21
+ * @param {string} authToken - The customer's authentication token.
22
+ * @param {string} businessId - The business primary key.
23
+ * @param {Object} card - The card information to be saved.
24
+ * @returns {Promise<Object>} A promise that resolves with the saved card data.
25
+ * @public
26
+ */
27
+ saveCustomerCard(authToken: string, businessId: string, card: { card_number: string; cvv: string; expiration_month: string; expiration_year: string; cardholder_name: string; }): Promise<void>;
28
+ removeCustomerCard(authToken: string, skyflowId: string, businessId: string): Promise<void>;
29
+ getCustomerAPMs(): Promise<void>;
30
+ }
31
+
32
+
33
+ export interface InlineCheckoutOptions {
34
+ mode?: string;
35
+ apiKey: string;
36
+ returnUrl: string;
37
+ renderPaymentButton?: boolean;
38
+ callBack?: (response: any) => void;
39
+ styles?: Record<string, string>;
40
+ }
41
+
42
+ export interface InlineLiteCheckoutOptions {
43
+ mode?: string;
44
+ apiKey: string;
45
+ returnUrl: string;
46
+ renderPaymentButton?: boolean;
47
+ callBack?: (response: any) => void;
48
+ }
49
+
50
+
51
+ export type Customer = {
52
+ firstName: string;
53
+ lastName: string;
54
+ country: string;
55
+ street: string;
56
+ city: string;
57
+ state: string;
58
+ postCode: string;
59
+ email: string;
60
+ phone: string;
61
+ };
62
+
63
+
64
+ interface CardFields {
65
+ card_number: string;
66
+ expiration_month: string;
67
+ expiration_year: string;
68
+ skyflow_id: string;
69
+ card_scheme: string;
70
+ }
71
+
72
+ interface Card {
73
+ fields: CardFields;
74
+ }
75
+
76
+ interface CustomerCards {
77
+ user_id: number;
78
+ cards: Card[];
79
+ }