@tonder.io/rn-sdk 0.1.6 → 0.1.7-beta.DEV1799.f93aa5e

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 (62) hide show
  1. package/README.md +125 -62
  2. package/lib/commonjs/core/BaseSDK/index.js +6 -0
  3. package/lib/commonjs/core/BaseSDK/index.js.map +1 -1
  4. package/lib/commonjs/core/EnrollmentContainer/index.js +12 -0
  5. package/lib/commonjs/core/EnrollmentContainer/index.js.map +1 -1
  6. package/lib/commonjs/core/PaymentLiteContainer/index.js +12 -0
  7. package/lib/commonjs/core/PaymentLiteContainer/index.js.map +1 -1
  8. package/lib/commonjs/services/CardService.js +18 -0
  9. package/lib/commonjs/services/CardService.js.map +1 -1
  10. package/lib/commonjs/shared/enum/ErrorKeyEnum.js +1 -0
  11. package/lib/commonjs/shared/enum/ErrorKeyEnum.js.map +1 -1
  12. package/lib/module/core/BaseSDK/index.js +6 -0
  13. package/lib/module/core/BaseSDK/index.js.map +1 -1
  14. package/lib/module/core/EnrollmentContainer/index.js +12 -0
  15. package/lib/module/core/EnrollmentContainer/index.js.map +1 -1
  16. package/lib/module/core/PaymentLiteContainer/index.js +12 -0
  17. package/lib/module/core/PaymentLiteContainer/index.js.map +1 -1
  18. package/lib/module/services/CardService.js +18 -0
  19. package/lib/module/services/CardService.js.map +1 -1
  20. package/lib/module/shared/enum/ErrorKeyEnum.js +1 -0
  21. package/lib/module/shared/enum/ErrorKeyEnum.js.map +1 -1
  22. package/lib/typescript/commonjs/src/core/BaseSDK/index.d.ts +2 -1
  23. package/lib/typescript/commonjs/src/core/BaseSDK/index.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/src/core/EnrollmentContainer/index.d.ts +2 -1
  25. package/lib/typescript/commonjs/src/core/EnrollmentContainer/index.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/src/core/PaymentLiteContainer/index.d.ts +2 -1
  27. package/lib/typescript/commonjs/src/core/PaymentLiteContainer/index.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/src/services/CardService.d.ts +6 -1
  29. package/lib/typescript/commonjs/src/services/CardService.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/src/shared/enum/ErrorKeyEnum.d.ts +1 -0
  31. package/lib/typescript/commonjs/src/shared/enum/ErrorKeyEnum.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/src/types/card.d.ts +6 -0
  33. package/lib/typescript/commonjs/src/types/card.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/src/types/enrollment.d.ts +9 -1
  35. package/lib/typescript/commonjs/src/types/enrollment.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/src/types/liteCheckout.d.ts +9 -1
  37. package/lib/typescript/commonjs/src/types/liteCheckout.d.ts.map +1 -1
  38. package/lib/typescript/module/src/core/BaseSDK/index.d.ts +2 -1
  39. package/lib/typescript/module/src/core/BaseSDK/index.d.ts.map +1 -1
  40. package/lib/typescript/module/src/core/EnrollmentContainer/index.d.ts +2 -1
  41. package/lib/typescript/module/src/core/EnrollmentContainer/index.d.ts.map +1 -1
  42. package/lib/typescript/module/src/core/PaymentLiteContainer/index.d.ts +2 -1
  43. package/lib/typescript/module/src/core/PaymentLiteContainer/index.d.ts.map +1 -1
  44. package/lib/typescript/module/src/services/CardService.d.ts +6 -1
  45. package/lib/typescript/module/src/services/CardService.d.ts.map +1 -1
  46. package/lib/typescript/module/src/shared/enum/ErrorKeyEnum.d.ts +1 -0
  47. package/lib/typescript/module/src/shared/enum/ErrorKeyEnum.d.ts.map +1 -1
  48. package/lib/typescript/module/src/types/card.d.ts +6 -0
  49. package/lib/typescript/module/src/types/card.d.ts.map +1 -1
  50. package/lib/typescript/module/src/types/enrollment.d.ts +9 -1
  51. package/lib/typescript/module/src/types/enrollment.d.ts.map +1 -1
  52. package/lib/typescript/module/src/types/liteCheckout.d.ts +9 -1
  53. package/lib/typescript/module/src/types/liteCheckout.d.ts.map +1 -1
  54. package/package.json +5 -5
  55. package/src/core/BaseSDK/index.ts +18 -1
  56. package/src/core/EnrollmentContainer/index.ts +16 -2
  57. package/src/core/PaymentLiteContainer/index.ts +13 -0
  58. package/src/services/CardService.ts +28 -0
  59. package/src/shared/enum/ErrorKeyEnum.ts +1 -0
  60. package/src/types/card.ts +7 -0
  61. package/src/types/enrollment.ts +10 -1
  62. package/src/types/liteCheckout.ts +10 -0
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ ICardsSummaryResponse,
2
3
  ICustomerCardsResponse,
3
4
  ISaveCardResponse,
4
5
  ISaveCardSkyflowRequest,
@@ -97,6 +98,33 @@ export class CardService {
97
98
  }
98
99
  }
99
100
 
101
+ /**
102
+ * get a card summary
103
+ * @throws {TonderError} If the request fails
104
+ */
105
+ async getCardSummary(
106
+ customerToken: string,
107
+ secureToken: string,
108
+ skyflowId: string,
109
+ businessId: string | number
110
+ ): Promise<ICardsSummaryResponse> {
111
+ this.validateSecureToken(secureToken);
112
+
113
+ try {
114
+ return await this.http.get(
115
+ `${this.BASE_PATH}/${businessId}/cards/${skyflowId}/summary`,
116
+ {
117
+ headers: this.buildAuthHeaders(secureToken, customerToken),
118
+ }
119
+ );
120
+ } catch (error) {
121
+ throw new TonderError({
122
+ code: ErrorKeyEnum.SAVE_CARD_ERROR,
123
+ details: error,
124
+ });
125
+ }
126
+ }
127
+
100
128
  private validateSecureToken(token: string): void {
101
129
  if (!token) {
102
130
  throw new TonderError({ code: ErrorKeyEnum.SECURE_TOKEN_INVALID });
@@ -16,6 +16,7 @@ export enum ErrorKeyEnum {
16
16
  CUSTOMER_AUTH_TOKEN_NOT_VALID = 'CUSTOMER_AUTH_TOKEN_NOT_VALID',
17
17
  SAVE_CARD_ERROR = 'SAVE_CARD_ERROR',
18
18
  REMOVE_CARD_ERROR = 'REMOVE_CARD_ERROR',
19
+ SUMMARY_CARD_ERROR = 'SUMMARY_CARD_ERROR',
19
20
  CREATE_PAYMENT_ERROR = 'CREATE_PAYMENT_ERROR',
20
21
  PAYMENT_PROCESS_ERROR = 'PAYMENT_PROCESS_ERROR',
21
22
  INVALID_CARD_DATA = 'INVALID_CARD_DATA',
package/src/types/card.ts CHANGED
@@ -28,6 +28,13 @@ export interface ICustomerCardsResponse {
28
28
  cards: ICard[];
29
29
  }
30
30
 
31
+ export interface ICardsSummaryResponse {
32
+ user_id: number;
33
+ card: {
34
+ fields: ICardSkyflowFields;
35
+ };
36
+ }
37
+
31
38
  export interface ISaveCardResponse {
32
39
  skyflow_id: string;
33
40
  user_id: number;
@@ -1,7 +1,7 @@
1
1
  import type { IBaseCreateOptions, IBaseResponse, IEvents, SDKOptions } from './base';
2
2
  import type { IBaseEnrollmentState } from './baseEnrollment';
3
3
  import { SDKType } from './base';
4
- import type { ISaveCardResponse } from './card';
4
+ import type { ICardsSummaryResponse, ISaveCardResponse } from './card';
5
5
  import type { IFormLabels, IFormPlaceholder, IStyles } from './common';
6
6
  import type { ICustomer } from './customer';
7
7
  import TonderError from '../shared/utils/errors';
@@ -69,4 +69,13 @@ export interface IEnrollment {
69
69
  * @public
70
70
  */
71
71
  reset(): void;
72
+
73
+ /**
74
+ * Retrieves a summary of the card associated with a customer.
75
+ * @param {string} id - The unique identifier of the card to retrieve the summary for.
76
+ * @returns {Promise<IBaseResponse<ICardsSummaryResponse>>} A promise that resolves with the customer's card summary data.
77
+ *
78
+ * @public
79
+ */
80
+ getCardSummary(id: string): Promise<IBaseResponse<ICardsSummaryResponse>>;
72
81
  }
@@ -10,6 +10,7 @@ import type {
10
10
  IBaseCallback,
11
11
  IInlineCallbacks,
12
12
  IBaseResponse,
13
+ ICardsSummaryResponse,
13
14
  } from '.';
14
15
  import { SDKType } from './base';
15
16
  import TonderError from '../shared/utils/errors';
@@ -104,4 +105,13 @@ export interface IPaymentLiteContainer {
104
105
  * @public
105
106
  */
106
107
  reset(): void;
108
+
109
+ /**
110
+ * Retrieves a summary of the card associated with a customer.
111
+ * @param {string} id - The unique identifier of the card to retrieve the summary for.
112
+ * @returns {Promise<IBaseResponse<ICardsSummaryResponse>>} A promise that resolves with the customer's card summary data.
113
+ *
114
+ * @public
115
+ */
116
+ getCardSummary(id: string): Promise<IBaseResponse<ICardsSummaryResponse>>;
107
117
  }