@yosle/tropipayjs 0.1.9 → 0.1.11

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.
@@ -1,2 +1,159 @@
1
- import * as countries from './countries';
2
- export { countries };
1
+ import { ServerMode } from "../constants/TropipayConstants";
2
+ export type AccountBalance = {
3
+ balance: number;
4
+ pendingIn: number;
5
+ pendingOut: number;
6
+ };
7
+ export interface TropipayConfig {
8
+ clientId: string;
9
+ clientSecret: string;
10
+ serverMode?: ServerMode;
11
+ }
12
+ export type TropipayCredentials = {
13
+ clientId: string;
14
+ clientSecret: string;
15
+ };
16
+ export type HookEventType = "transaction_completed" | "transaction_charged" | "transaction_guarded" | "user_signup" | "user_kyc" | "payment_in_state_change" | "payment_out_state_change" | "beneficiary_added" | "beneficiary_updated" | "beneficiary_deleted" | "transaction_new" | "transaction_preauthorized" | "transaction_pendingin" | "transaction_processing" | "transaction_error" | "transaction_bloqued" | "transaction_guarded_send" | "transaction_guarded_mediation" | "user_after_update" | "user_after_create" | "userDetail_after_create" | "userDetail_after_update" | "tpv_callback_ok" | "fraud_state_on_change";
17
+ export type HookTargetType = "web" | "email";
18
+ export interface UserHook {
19
+ event: HookEventType;
20
+ target: string;
21
+ value: string;
22
+ }
23
+ export interface UserHookSubscribed extends UserHook {
24
+ createdAt: string;
25
+ updatedAt: string;
26
+ }
27
+ export interface UserHook {
28
+ event: HookEventType;
29
+ target: string;
30
+ value: string;
31
+ }
32
+ export interface UserHookSubscribed extends UserHook {
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
36
+ export interface PaymentLinkPayload {
37
+ reference: string;
38
+ concept: string;
39
+ favorite: boolean;
40
+ amount: number;
41
+ currency: string;
42
+ description: string;
43
+ singleUse: boolean;
44
+ reasonId: number;
45
+ expirationDays: number;
46
+ lang: string;
47
+ urlSuccess: string;
48
+ urlFailed: string;
49
+ urlNotification: string;
50
+ serviceDate: string;
51
+ client: {
52
+ name: string;
53
+ lastName: string;
54
+ address: string;
55
+ phone: string;
56
+ email: string;
57
+ countryId: number;
58
+ termsAndConditions: boolean;
59
+ };
60
+ directPayment: boolean;
61
+ paymentMethods?: string[];
62
+ }
63
+ export interface PaymentLink extends PaymentLinkPayload {
64
+ expirationDate: string;
65
+ hasClient: boolean;
66
+ updatedAt: string;
67
+ createdAt: string;
68
+ qrImage: string;
69
+ shortUrl: string;
70
+ paymentUrl: string;
71
+ }
72
+ export interface mediationPaymentCardConfig {
73
+ amount: number;
74
+ currency: "EUR" | "USD";
75
+ concept: string;
76
+ description: string;
77
+ reference: string;
78
+ singleUse: boolean;
79
+ lang: string;
80
+ productUrl?: string;
81
+ buyer: null | any;
82
+ seller: {
83
+ sellerId?: number;
84
+ type?: number;
85
+ email?: string;
86
+ };
87
+ feePercent?: number;
88
+ feeFixed?: number;
89
+ sendMail: boolean;
90
+ }
91
+ export type LoginResponse = {
92
+ access_token: string;
93
+ refresh_token: string;
94
+ token_type: "Bearer";
95
+ expires_in: number;
96
+ scope: string;
97
+ };
98
+ export type LoginError = {
99
+ error: string;
100
+ };
101
+ export type Country = {
102
+ id: number;
103
+ name: string;
104
+ sepaZone: boolean;
105
+ state: number;
106
+ slug: string;
107
+ slugn: number;
108
+ callingCode: number;
109
+ isDestination: boolean;
110
+ isRisky: boolean;
111
+ currentCurrency: string | null;
112
+ createdAt: string;
113
+ updatedAt: string;
114
+ isFavorite: boolean;
115
+ position: any;
116
+ };
117
+ export type Deposit = {
118
+ id: number;
119
+ accountNumber: string;
120
+ alias: string;
121
+ swift: string;
122
+ type: number;
123
+ country: number | null;
124
+ firstName: string;
125
+ default: null;
126
+ state: number;
127
+ userId: string;
128
+ countryDestinationId: number;
129
+ lastName: string;
130
+ documentNumber: number;
131
+ userRelationTypeId: number;
132
+ city: string;
133
+ postalCode: string;
134
+ address: string;
135
+ phone: string;
136
+ checked: boolean;
137
+ province: string;
138
+ beneficiaryType: number;
139
+ relatedUserId: null | string;
140
+ currency: string;
141
+ correspondent?: any;
142
+ location: any;
143
+ office: any;
144
+ officeValue: any;
145
+ paymentType: number;
146
+ paymentEntityBeneficiaryId: number;
147
+ paymentEntityAccountId: number;
148
+ verified: any;
149
+ paymentEntityInfo: any;
150
+ documentTypeId: any;
151
+ documentExpirationDate: Date;
152
+ createdAt: Date;
153
+ updatedAt: Date;
154
+ countryDestination: Country;
155
+ };
156
+ export type AccountDeposits = {
157
+ count: number;
158
+ rows: Deposit[];
159
+ };
@@ -1,3 +1,50 @@
1
+ type PaymentMethodElement = "EXT" | "TPP";
2
+ export type PaymentMethods = Element | [PaymentMethodElement, PaymentMethodElement];
3
+ declare enum Reasons {
4
+ HOUSING_ARRANGEMENT = 1,
5
+ FINANCIAL_AID = 2,
6
+ FAMILY_SUPPORT = 3,
7
+ TRAVEL_FUND = 4,
8
+ REAL_ESTATE_PURCHASE = 5,
9
+ FURNITURE_PURCHASE = 6,
10
+ EDUCATION = 7,
11
+ MEDICAL_EXPENSES = 8,
12
+ OTHER = 9,
13
+ DEBT_PAYMENT = 10,
14
+ TOURISM = 11,
15
+ SELF_SHIPPING = 12,
16
+ ACCOUNT_ACTIVATION = 13,
17
+ SPORTS_ACTIVITIES = 14,
18
+ DONATION = 15,
19
+ AFFILIATE_COMMISSION = 16,
20
+ SALARY = 17,
21
+ SAVINGS = 18,
22
+ RENT_AND_LEASING = 19,
23
+ SHARED_EXPENSES = 20,
24
+ SERVICE_PAYMENT = 21,
25
+ GIFT = 22,
26
+ CRYPTOCURRENCY_PURCHASE = 23,
27
+ OPERATING_EXPENSES = 24,
28
+ CURRENCY_EXCHANGE = 25,
29
+ ACCOMMODATION = 26,
30
+ EQUIPMENT_PURCHASE = 27,
31
+ CONSULTING = 28,
32
+ SOFTWARE_DEVELOPMENT = 29,
33
+ REFUND = 30,
34
+ PACKAGE_DELIVERY = 31,
35
+ PERSONAL_EXPENSES = 32,
36
+ INVESTMENT = 33,
37
+ BILL_PAYMENT = 34,
38
+ HOST_PAYMENT = 35,
39
+ TRANSPORTATION = 36,
40
+ LOAN = 37,
41
+ BONUS = 38,
42
+ HALLOWEEN_REMITTANCE = 39,
43
+ PLINK_REMITTANCE = 41,
44
+ R1_2023 = 78,
45
+ HAPPYWEEK = 79,
46
+ SENDING_YOU_A_KISS = 80
47
+ }
1
48
  export interface PaymentLinkPayload {
2
49
  reference: string;
3
50
  concept: string;
@@ -6,14 +53,17 @@ export interface PaymentLinkPayload {
6
53
  currency: string;
7
54
  description: string;
8
55
  singleUse: boolean;
9
- reasonId: number;
56
+ reasonId: Reasons;
10
57
  expirationDays: number;
11
58
  lang: string;
12
59
  urlSuccess: string;
13
60
  urlFailed: string;
14
61
  urlNotification: string;
15
62
  serviceDate: string;
16
- client: {
63
+ /**
64
+ * fgfsgdfgdfgd
65
+ */
66
+ client?: {
17
67
  name: string;
18
68
  lastName: string;
19
69
  address: string;
@@ -21,9 +71,9 @@ export interface PaymentLinkPayload {
21
71
  email: string;
22
72
  countryId: number;
23
73
  termsAndConditions: boolean;
24
- };
25
- directPayment: boolean;
26
- paymentMethods?: string[];
74
+ } | null;
75
+ directPayment?: boolean;
76
+ paymentMethods?: PaymentMethods;
27
77
  }
28
78
  export interface PaymentLink extends PaymentLinkPayload {
29
79
  expirationDate: string;
@@ -34,3 +84,4 @@ export interface PaymentLink extends PaymentLinkPayload {
34
84
  shortUrl: string;
35
85
  paymentUrl: string;
36
86
  }
87
+ export {};
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
- {
2
- "name": "@yosle/tropipayjs",
3
- "version": "0.1.9",
4
- "description": "Javascript / Typescript SDK for the Tropipay API",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "_clear": "rimraf src/dist/*",
9
- "_tsc": "tsc",
10
- "_make-bundle": "rollup --config",
11
- "build": "yarn _clear && yarn _tsc && yarn _make-bundle"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/yosle/tropipayjs"
16
- },
17
- "keywords": [
18
- "Javascript",
19
- "Typescript",
20
- "Tropipay",
21
- "payments",
22
- "gateway",
23
- "API"
24
- ],
25
- "author": "Yosleivy Baez Acosta <yosle007@gmail.com>",
26
- "license": "MIT",
27
- "dependencies": {
28
- "axios": "^0.27.2",
29
- "tslib": "^2.4.0"
30
- },
31
- "devDependencies": {
32
- "@rollup/plugin-typescript": "^8.5.0",
33
- "rimraf": "^3.0.2",
34
- "rollup": "^2.79.1",
35
- "rollup-plugin-dts": "^4.2.2",
36
- "run-s": "^0.0.0",
37
- "typescript": "^5.0.4"
38
- },
39
- "funding": {
40
- "type": "individual",
41
- "url": "https://tppay.me/l94qaa3h"
42
- }
43
- }
1
+ {
2
+ "name": "@yosle/tropipayjs",
3
+ "version": "0.1.11",
4
+ "description": "Javascript / Typescript SDK for the Tropipay API",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "_clear": "rimraf src/dist/*",
9
+ "_tsc": "tsc",
10
+ "_make-bundle": "rollup --config",
11
+ "build": "yarn _clear && yarn _tsc && yarn _make-bundle"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/yosle/tropipayjs"
16
+ },
17
+ "keywords": [
18
+ "Javascript",
19
+ "Typescript",
20
+ "Tropipay",
21
+ "payments",
22
+ "gateway",
23
+ "API"
24
+ ],
25
+ "author": "Yosleivy Baez Acosta <yosle007@gmail.com>",
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "axios": "^0.27.2",
29
+ "tslib": "^2.4.0"
30
+ },
31
+ "devDependencies": {
32
+ "@rollup/plugin-typescript": "^8.5.0",
33
+ "rimraf": "^3.0.2",
34
+ "rollup": "^2.79.1",
35
+ "rollup-plugin-dts": "^4.2.2",
36
+ "run-s": "^0.0.0",
37
+ "typescript": "^5.0.4"
38
+ },
39
+ "funding": {
40
+ "type": "individual",
41
+ "url": "https://tppay.me/l94qaa3h"
42
+ }
43
+ }
package/rollup.config.js CHANGED
@@ -1,23 +1,24 @@
1
- // Contents of the file /rollup.config.js
2
- import typescript from '@rollup/plugin-typescript';
3
- import dts from "rollup-plugin-dts";
4
- const config = [
5
- {
6
- input: 'dist/index.js',
7
- output: {
8
- file: 'index.js',
9
- format: 'cjs',
10
- sourcemap: true,
11
- },
12
- external: ['axios'],
13
- plugins: [typescript()]
14
- }, {
15
- input: 'dist/index.d.ts',
16
- output: {
17
- file: 'index.d.ts',
18
- format: 'es'
19
- },
20
- plugins: [dts()]
21
- }
22
- ];
23
- export default config;
1
+ // Contents of the file /rollup.config.js
2
+ import typescript from "@rollup/plugin-typescript";
3
+ import dts from "rollup-plugin-dts";
4
+ const config = [
5
+ {
6
+ input: "dist/index.js",
7
+ output: {
8
+ file: "index.js",
9
+ format: "cjs",
10
+ sourcemap: true,
11
+ },
12
+ external: ["axios", "crypto"],
13
+ plugins: [typescript()],
14
+ },
15
+ {
16
+ input: "dist/index.d.ts",
17
+ output: {
18
+ file: "index.d.ts",
19
+ format: "es",
20
+ },
21
+ plugins: [dts()],
22
+ },
23
+ ];
24
+ export default config;
@@ -0,0 +1,317 @@
1
+ /**
2
+ * Tropipayjs is a Typescript/Javascript library for the Tropipay API.
3
+ *
4
+ * @author Yosleivy Baez Acosta
5
+ *
6
+ */
7
+
8
+ import axios, { Axios } from "axios";
9
+ import {
10
+ TropipayConfig,
11
+ AccountBalance,
12
+ Country,
13
+ PaymentLinkPayload,
14
+ PaymentLink,
15
+ mediationPaymentCardConfig,
16
+ LoginResponse,
17
+ AccountDeposits,
18
+ } from "../interfaces";
19
+ type ServerMode = "Development" | "Production";
20
+ import { TropipayHooks } from "../hooks/TropipayHooks";
21
+ export class Tropipay {
22
+ readonly clientId: string;
23
+ readonly clientSecret: string;
24
+ public request: Axios;
25
+ public static accessToken: string | undefined;
26
+ public static refreshToken: string | undefined;
27
+ public serverMode: ServerMode;
28
+ public hooks: TropipayHooks;
29
+
30
+ constructor(config: TropipayConfig) {
31
+ this.clientId = config.clientId;
32
+ this.clientSecret = config.clientSecret;
33
+ this.serverMode = config.serverMode || "Development";
34
+ this.request = axios.create({
35
+ baseURL:
36
+ this.serverMode === "Production"
37
+ ? "https://www.tropipay.com"
38
+ : "https://tropipay-dev.herokuapp.com",
39
+ headers: {
40
+ "Content-Type": "application/json",
41
+ Accept: "application/json",
42
+ Authorization: `Bearer ${Tropipay.accessToken}`,
43
+ },
44
+ });
45
+ this.hooks = new TropipayHooks(this);
46
+ }
47
+
48
+ public async login() {
49
+ try {
50
+ const { data } = await this.request.post<LoginResponse>(
51
+ "/api/v2/access/token",
52
+ {
53
+ client_id: this.clientId,
54
+ client_secret: this.clientSecret,
55
+ grant_type: "client_credentials",
56
+ scope:
57
+ "ALLOW_GET_PROFILE_DATA ALLOW_PAYMENT_IN ALLOW_EXTERNAL_CHARGE KYC3_FULL_ALLOW ALLOW_PAYMENT_OUT ALLOW_MARKET_PURCHASES ALLOW_GET_BALANCE ALLOW_GET_MOVEMENT_LIST ALLOW_GET_CREDENTIAL",
58
+ },
59
+ {
60
+ headers: {
61
+ "Content-Type": "application/json",
62
+ Accept: "application/json",
63
+ },
64
+ }
65
+ );
66
+
67
+ Tropipay.accessToken = data.access_token;
68
+ Tropipay.refreshToken = data.refresh_token;
69
+ return data;
70
+ } catch (error) {
71
+ if (axios.isAxiosError(error)) {
72
+ throw new Error(
73
+ `Could not obtain the access token from credentials ${error}`
74
+ );
75
+ }
76
+ throw new Error(
77
+ `Could not obtain the access token from credentials ${error}`
78
+ );
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Create a paymentLink with the specified options.
84
+ * @param payload PaymentLinkPayload Object.
85
+ * @returns Promise<PaymentLink> or throws an Exception.
86
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
87
+ */
88
+ async createPaymentCard(payload: PaymentLinkPayload): Promise<PaymentLink> {
89
+ if (!Tropipay.accessToken) {
90
+ await this.login();
91
+ }
92
+ try {
93
+ const paylink = await this.request.post("/api/v2/paymentcards", payload, {
94
+ headers: {
95
+ "Content-Type": "application/json",
96
+ Authorization: `Bearer ${Tropipay.accessToken}`,
97
+ Accept: "application/json",
98
+ },
99
+ });
100
+ return paylink.data as PaymentLink;
101
+ } catch (error) {
102
+ throw new Error(`TropipayJS - Error creating the Payment Card.`);
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Get all deposits in this account.
108
+ * @returns A Promise of an Array of AccountDeposits or throws an Exception
109
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6OTgyOTQ1Mg-get-deposit-accounts-list
110
+ */
111
+ async getDepositAccounts(): Promise<AccountDeposits[] | Error> {
112
+ if (!Tropipay.accessToken) {
113
+ await this.login();
114
+ }
115
+ try {
116
+ const deposits = await this.request.get("/api/v2/deposit_accounts", {
117
+ headers: {
118
+ "Content-Type": "application/json",
119
+ Authorization: `Bearer ${Tropipay.accessToken}`,
120
+ Accept: "application/json",
121
+ },
122
+ });
123
+ return deposits.data;
124
+ } catch (error) {
125
+ throw new Error(`Could not retrieve the account deposits ${error}`);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Get the list of all supported countries by Tropipay.
131
+ * @returns Array of Countries Data
132
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/bfac21259e2ff-getting-users-countries-list
133
+ */
134
+ async countries(): Promise<Country[]> {
135
+ try {
136
+ const countries = await this.request.get("/api/v2/countries");
137
+ return countries.data;
138
+ } catch (error) {
139
+ throw new Error(`Could not retrieve the countries list`);
140
+ }
141
+ }
142
+ /**
143
+ * Get user balance
144
+ * @returns balance Object { balance: number, pendingIn: number, pendingOut: number }
145
+ */
146
+ async getBalance(): Promise<AccountBalance> {
147
+ if (!Tropipay.accessToken) {
148
+ await this.login();
149
+ }
150
+ try {
151
+ const balance = await this.request.get("/api/v2/users/balance", {
152
+ headers: {
153
+ "Content-Type": "application/json",
154
+ Authorization: `Bearer ${Tropipay.accessToken}`,
155
+ Accept: "application/json",
156
+ },
157
+ });
158
+ return balance.data;
159
+ } catch (error) {
160
+ throw new Error(
161
+ `TropipayJS Error - Could not retrieve the user's balance`
162
+ );
163
+ }
164
+ }
165
+
166
+ /**
167
+ * Get the list of all detination countries supported by Tropipay.
168
+ * Obtaining the list of valid countries to send funds to. Useful
169
+ * when adding new beneficiaries to some user.
170
+ *
171
+ * @returns Array of Country Objects
172
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/3cfe5504f0524-getting-list-of-beneficiary-countries
173
+ */
174
+ async destinations(): Promise<Country[]> {
175
+ try {
176
+ const countries = await this.request.get(
177
+ "/api/v2/countries/destinations"
178
+ );
179
+ return countries.data;
180
+ } catch (error) {
181
+ throw new Error(`Could not retrieve the destination countries list`);
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Get list of all the favorites payment links.
187
+ * @returns Array of account Object or throws an error
188
+ */
189
+ async favorites() {
190
+ if (!Tropipay.accessToken) {
191
+ await this.login();
192
+ }
193
+ try {
194
+ const favoritesList = await this.request.get(
195
+ "/api/v2/paymentcards/favorites",
196
+ {
197
+ headers: {
198
+ "Content-Type": "application/json",
199
+ Authorization: `Bearer ${Tropipay.accessToken}`,
200
+ Accept: "application/json",
201
+ },
202
+ }
203
+ );
204
+ return favoritesList?.data?.rows;
205
+ } catch (error) {
206
+ throw new Error(`Could not retrieve favorites list ${error}`);
207
+ }
208
+ }
209
+
210
+ /**
211
+ * List all account movements. You can optionaly specify
212
+ * offset and limit params for pagination.
213
+ * @returns
214
+ */
215
+ async movements(offset = 0, limit = 10) {
216
+ if (!Tropipay.accessToken) await this.login();
217
+
218
+ try {
219
+ const movements = await this.request.get("/api/v2/movements", {
220
+ params: { limit: limit, offset: offset },
221
+ headers: {
222
+ "Content-Type": "application/json",
223
+ Accept: "application/json",
224
+ Authorization: `Bearer ${Tropipay.accessToken}`,
225
+ },
226
+ });
227
+ return movements.data;
228
+ } catch (error) {
229
+ throw new Error(`Could not retrieve movements list ${error}`);
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Return profile data for current Tropipay account.
235
+ * @returns account object
236
+ */
237
+ async profile() {
238
+ if (!Tropipay.accessToken) await this.login();
239
+ try {
240
+ const profile = await this.request.get("/api/users/profile");
241
+ return profile.data;
242
+ } catch (error) {
243
+ throw new Error(`Could not retrieve movements list ${error}`);
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Obtain current Tropipay conversion rate. For example USD to EUR
249
+ * targetCurrency must be 'EUR'
250
+ * @param originCurrency Target currency code supported by Tropipay.
251
+ * @param targetCurrency Must be 'EUR'? (not documented by Tropipay)
252
+ * @returns Conversion rate (number)
253
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/85163f6f28b23-get-rate
254
+ */
255
+ async rates(
256
+ originCurrency: string,
257
+ targetCurrency: string = "EUR"
258
+ ): Promise<number | Error> {
259
+ if (!Tropipay.accessToken) {
260
+ await this.login();
261
+ }
262
+ try {
263
+ const rates = await this.request.post(
264
+ "/api/v2/movements/get_rate",
265
+ {
266
+ currencyFrom: originCurrency,
267
+ currencyTo: targetCurrency,
268
+ },
269
+ {
270
+ headers: {
271
+ "Content-Type": "application/json",
272
+ Accept: "application/json",
273
+ Authorization: `Bearer ${Tropipay.accessToken}`,
274
+ },
275
+ }
276
+ );
277
+ return rates.data.rate;
278
+ } catch (error) {
279
+ throw new Error(`Could not retrieve rates ${error}`);
280
+ }
281
+ }
282
+
283
+ /**
284
+ * (ONLY in Bussiness Accounts)
285
+ * An escrow payment link. This allows a payment to be made to persons
286
+ * belonging or not to the TropiPay platform with the particularity
287
+ * that the payment will be held in custody or retained until it is
288
+ * released with the approval of the payer.
289
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/12a128ff971e4-creating-a-mediation-payment-card
290
+ * @param config Payload with the payment details
291
+ */
292
+ async createMediationPaymentCard(
293
+ config: mediationPaymentCardConfig
294
+ ): Promise<PaymentLink> {
295
+ if (!Tropipay.accessToken) await this.login();
296
+ try {
297
+ const mediation = await this.request.post(
298
+ "/api/v2/paymentcards/mediation",
299
+ config,
300
+ {
301
+ headers: {
302
+ "Content-Type": "application/json",
303
+ Authorization: `Bearer ${Tropipay.accessToken}`,
304
+ Accept: "application/json",
305
+ },
306
+ }
307
+ );
308
+ return mediation.data as PaymentLink;
309
+ } catch (error) {
310
+ throw new Error(`Could not create mediation payment card`);
311
+ }
312
+ }
313
+ }
314
+
315
+ export class ClientSideUtils {
316
+ constructor(tropipayInstance: Tropipay) {}
317
+ }