@tonder.io/rn-sdk 0.1.7-beta.DEV1799.7abf93b → 0.1.7
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 +57 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -523,7 +523,7 @@ import {
|
|
|
523
523
|
} from '@tonder.io/rn-sdk';
|
|
524
524
|
|
|
525
525
|
export default function EnrollmentLiteScreen() {
|
|
526
|
-
const { create, saveCustomerCard, reset } = useTonder<SDKType.ENROLLMENT>();
|
|
526
|
+
const { create, saveCustomerCard, reset, getCardSummary } = useTonder<SDKType.ENROLLMENT>();
|
|
527
527
|
|
|
528
528
|
const customerData: ICustomer = {
|
|
529
529
|
email: 'test@example.com',
|
|
@@ -554,7 +554,8 @@ export default function EnrollmentLiteScreen() {
|
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
556
|
console.log('Card saved successfully:', response);
|
|
557
|
-
|
|
557
|
+
// GET summary card
|
|
558
|
+
await handleGetSummaryCard(response.skyflow_id);
|
|
558
559
|
// Reset and reinitialize for next use
|
|
559
560
|
reset();
|
|
560
561
|
await initializeEnrollment();
|
|
@@ -563,6 +564,17 @@ export default function EnrollmentLiteScreen() {
|
|
|
563
564
|
}
|
|
564
565
|
};
|
|
565
566
|
|
|
567
|
+
const handleGetSummaryCard = async (id: string) => {
|
|
568
|
+
const { response, error } = await getCardSummary(id);
|
|
569
|
+
if (error) {
|
|
570
|
+
//Manage error
|
|
571
|
+
Alert.alert('Error', 'Failed to get summary card');
|
|
572
|
+
console.error('Error get summary card: ', error);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
console.log('Response get summary: ', response);
|
|
576
|
+
};
|
|
577
|
+
|
|
566
578
|
return (
|
|
567
579
|
<SafeAreaView>
|
|
568
580
|
<CardHolderInput />
|
|
@@ -1151,6 +1163,49 @@ The ENROLLMENT integration provides methods for handling full enrollment with bu
|
|
|
1151
1163
|
- saveCustomerCard: Tokenizes and saves the current card information.
|
|
1152
1164
|
- getCardSummary: Retrieves detailed information about a saved card using its Skyflow ID.
|
|
1153
1165
|
|
|
1166
|
+
<details>
|
|
1167
|
+
<summary>Input Interface</summary>
|
|
1168
|
+
|
|
1169
|
+
| Parameter | Type | Description |
|
|
1170
|
+
|-----------|--------|------------------------------------------------|
|
|
1171
|
+
| skyflowId | string | The Skyflow ID of the card to retrieve |
|
|
1172
|
+
|
|
1173
|
+
</details>
|
|
1174
|
+
|
|
1175
|
+
<details>
|
|
1176
|
+
<summary>Response Interface</summary>
|
|
1177
|
+
|
|
1178
|
+
**IBaseResponse<ICardsSummaryResponse>**
|
|
1179
|
+
|
|
1180
|
+
The response follows the base response pattern:
|
|
1181
|
+
|
|
1182
|
+
```typescript
|
|
1183
|
+
export type IBaseResponse<T> =
|
|
1184
|
+
| { response: ICardsSummaryResponse; error?: TonderError }
|
|
1185
|
+
| { response?: never; error: TonderError };
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
**Success Response (ICardsSummaryResponse)**
|
|
1189
|
+
|
|
1190
|
+
| Property | Type | Description |
|
|
1191
|
+
|----------|--------|------------------------------------------------|
|
|
1192
|
+
| user_id | number | The ID of the user who owns the card |
|
|
1193
|
+
| card | object | Object containing the card fields |
|
|
1194
|
+
|
|
1195
|
+
**Card Fields (ICardSkyflowFields)**
|
|
1196
|
+
|
|
1197
|
+
| Property | Type | Description |
|
|
1198
|
+
|-------------------|--------|--------------------------------------------|
|
|
1199
|
+
| card_number | string | The masked card number |
|
|
1200
|
+
| expiration_month | string | The expiration month of the card |
|
|
1201
|
+
| expiration_year | string | The expiration year of the card |
|
|
1202
|
+
| skyflow_id | string | The unique Skyflow identifier for the card |
|
|
1203
|
+
| card_scheme | string | The card brand (e.g., Visa, Mastercard) |
|
|
1204
|
+
| cardholder_name | string | The name of the cardholder |
|
|
1205
|
+
|
|
1206
|
+
</details>
|
|
1207
|
+
|
|
1208
|
+
|
|
1154
1209
|
> **Note:** The saveCustomerCard It is only necessary when you want to control the enrollment button on your own.
|
|
1155
1210
|
|
|
1156
1211
|
> **Note:** For card methods, it is necessary to obtain and use your secure token when calling the create function.
|