@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.
- package/README.md +125 -62
- package/lib/commonjs/core/BaseSDK/index.js +6 -0
- package/lib/commonjs/core/BaseSDK/index.js.map +1 -1
- package/lib/commonjs/core/EnrollmentContainer/index.js +12 -0
- package/lib/commonjs/core/EnrollmentContainer/index.js.map +1 -1
- package/lib/commonjs/core/PaymentLiteContainer/index.js +12 -0
- package/lib/commonjs/core/PaymentLiteContainer/index.js.map +1 -1
- package/lib/commonjs/services/CardService.js +18 -0
- package/lib/commonjs/services/CardService.js.map +1 -1
- package/lib/commonjs/shared/enum/ErrorKeyEnum.js +1 -0
- package/lib/commonjs/shared/enum/ErrorKeyEnum.js.map +1 -1
- package/lib/module/core/BaseSDK/index.js +6 -0
- package/lib/module/core/BaseSDK/index.js.map +1 -1
- package/lib/module/core/EnrollmentContainer/index.js +12 -0
- package/lib/module/core/EnrollmentContainer/index.js.map +1 -1
- package/lib/module/core/PaymentLiteContainer/index.js +12 -0
- package/lib/module/core/PaymentLiteContainer/index.js.map +1 -1
- package/lib/module/services/CardService.js +18 -0
- package/lib/module/services/CardService.js.map +1 -1
- package/lib/module/shared/enum/ErrorKeyEnum.js +1 -0
- package/lib/module/shared/enum/ErrorKeyEnum.js.map +1 -1
- package/lib/typescript/commonjs/src/core/BaseSDK/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/core/BaseSDK/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/EnrollmentContainer/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/core/EnrollmentContainer/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/core/PaymentLiteContainer/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/core/PaymentLiteContainer/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/services/CardService.d.ts +6 -1
- package/lib/typescript/commonjs/src/services/CardService.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/shared/enum/ErrorKeyEnum.d.ts +1 -0
- package/lib/typescript/commonjs/src/shared/enum/ErrorKeyEnum.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/card.d.ts +6 -0
- package/lib/typescript/commonjs/src/types/card.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/enrollment.d.ts +9 -1
- package/lib/typescript/commonjs/src/types/enrollment.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/liteCheckout.d.ts +9 -1
- package/lib/typescript/commonjs/src/types/liteCheckout.d.ts.map +1 -1
- package/lib/typescript/module/src/core/BaseSDK/index.d.ts +2 -1
- package/lib/typescript/module/src/core/BaseSDK/index.d.ts.map +1 -1
- package/lib/typescript/module/src/core/EnrollmentContainer/index.d.ts +2 -1
- package/lib/typescript/module/src/core/EnrollmentContainer/index.d.ts.map +1 -1
- package/lib/typescript/module/src/core/PaymentLiteContainer/index.d.ts +2 -1
- package/lib/typescript/module/src/core/PaymentLiteContainer/index.d.ts.map +1 -1
- package/lib/typescript/module/src/services/CardService.d.ts +6 -1
- package/lib/typescript/module/src/services/CardService.d.ts.map +1 -1
- package/lib/typescript/module/src/shared/enum/ErrorKeyEnum.d.ts +1 -0
- package/lib/typescript/module/src/shared/enum/ErrorKeyEnum.d.ts.map +1 -1
- package/lib/typescript/module/src/types/card.d.ts +6 -0
- package/lib/typescript/module/src/types/card.d.ts.map +1 -1
- package/lib/typescript/module/src/types/enrollment.d.ts +9 -1
- package/lib/typescript/module/src/types/enrollment.d.ts.map +1 -1
- package/lib/typescript/module/src/types/liteCheckout.d.ts +9 -1
- package/lib/typescript/module/src/types/liteCheckout.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/core/BaseSDK/index.ts +18 -1
- package/src/core/EnrollmentContainer/index.ts +16 -2
- package/src/core/PaymentLiteContainer/index.ts +13 -0
- package/src/services/CardService.ts +28 -0
- package/src/shared/enum/ErrorKeyEnum.ts +1 -0
- package/src/types/card.ts +7 -0
- package/src/types/enrollment.ts +10 -1
- 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;
|
package/src/types/enrollment.ts
CHANGED
|
@@ -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
|
}
|