@yosle/tropipayjs 0.2.0 → 0.2.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.
@@ -0,0 +1,52 @@
1
+ import { Tropipay } from "../api/TropipayAPI";
2
+ export interface PaymentMethod {
3
+ slug: string;
4
+ name: string;
5
+ enabled: boolean;
6
+ allowedCurrencies: string[];
7
+ }
8
+ export interface ServiceLimit {
9
+ value: number | null;
10
+ currency: string;
11
+ }
12
+ export interface ServiceLimits {
13
+ min: ServiceLimit;
14
+ max: ServiceLimit;
15
+ }
16
+ export interface Service {
17
+ slug: string;
18
+ enabled: boolean;
19
+ allowed_currencies: string[];
20
+ limits: ServiceLimits;
21
+ }
22
+ export interface TropiCard {
23
+ }
24
+ export interface Account {
25
+ id: number;
26
+ accountNumber: string;
27
+ userId: string;
28
+ alias: string;
29
+ balance: number;
30
+ pendingIn: number;
31
+ pendingOut: number;
32
+ state: number;
33
+ paymentEntityId: number;
34
+ currency: string;
35
+ type: number;
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ isDefault: boolean;
39
+ groupId: number | null;
40
+ TropiCards: TropiCard[];
41
+ services: Service[];
42
+ paymentMethods: PaymentMethod[];
43
+ }
44
+ export default class Accounts {
45
+ private tropipay;
46
+ constructor(tropipayInstance: Tropipay);
47
+ /**
48
+ * List all accounts of the authenticated user
49
+ * @returns Array of Account objects
50
+ */
51
+ list(): Promise<Account[]>;
52
+ }
@@ -11,6 +11,7 @@ import TropipayHooks from "../hooks/TropipayHooks";
11
11
  import PaymentCard from "../paymentcard/PaymentCard";
12
12
  import MediationPaymentCard from "../mediationPaymentCard/MediationPaymentCard";
13
13
  import DepositAccounts from "../depositAccount/depositAccounts";
14
+ import Accounts from "../accounts/accounts";
14
15
  export declare class Tropipay {
15
16
  readonly clientId: string;
16
17
  readonly clientSecret: string;
@@ -25,6 +26,7 @@ export declare class Tropipay {
25
26
  paymentCards: PaymentCard;
26
27
  depositAccounts: DepositAccounts;
27
28
  mediationPaymentCard: MediationPaymentCard;
29
+ accounts: Accounts;
28
30
  /**
29
31
  * Initializes a new instance of the Tropipay class.
30
32
  *
package/index.d.ts CHANGED
@@ -39,37 +39,71 @@ interface UserHookSubscribed extends UserHook {
39
39
  createdAt: string;
40
40
  updatedAt: string;
41
41
  }
42
+ /**
43
+ * Interface for creating payment links/cards
44
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
45
+ */
42
46
  interface PaymentLinkPayload {
43
- accountId: number;
47
+ /** Account ID where the funds will be received if compatible */
48
+ accountId?: number;
49
+ /** Reference code for the payment, preferred to be unique */
44
50
  reference: string;
51
+ /** Short description of the payment */
45
52
  concept: string;
53
+ /** Whether to mark this payment link as favorite */
46
54
  favorite: boolean;
55
+ /** Amount to charge in the specified currency */
47
56
  amount: number;
57
+ /** Currency code (EUR, USD, etc.) */
48
58
  currency: string;
59
+ /** Detailed description of the payment */
49
60
  description: string;
61
+ /** If true, the payment link can only be used once */
50
62
  singleUse: boolean;
63
+ /** Reason ID for the payment */
51
64
  reasonId: number;
65
+ /** Number of days until the payment link expires */
52
66
  expirationDays: number;
67
+ /** Language code for the payment page (en, es, etc.) */
53
68
  lang: string;
69
+ /** URL to redirect after successful payment */
54
70
  urlSuccess: string;
71
+ /** URL to redirect after failed payment */
55
72
  urlFailed: string;
73
+ /** Webhook URL for payment notifications */
56
74
  urlNotification: string;
75
+ /** Date when the service will be provided (ISO format) */
57
76
  serviceDate: string;
77
+ /** Client information for the payment */
58
78
  client?: {
79
+ /** Client's first name */
59
80
  name?: string;
81
+ /** Client's last name */
60
82
  lastName?: string;
83
+ /** Client's address */
61
84
  address?: string;
85
+ /** Client's phone number */
62
86
  phone?: string;
87
+ /** Client's email address */
63
88
  email?: string;
89
+ /** Client's country ID */
64
90
  countryId?: number;
91
+ /** Client's country ISO code */
65
92
  countryIso?: string;
93
+ /** Client's city */
66
94
  city: string;
95
+ /** Client's postal code */
67
96
  postCode: string;
97
+ /** Whether client accepted terms and conditions */
68
98
  termsAndConditions: boolean;
69
99
  } | null;
100
+ /** @deprecated If true, redirects directly to payment page */
70
101
  directPayment: boolean;
102
+ /** List of allowed payment methods */
71
103
  paymentMethods?: string[];
104
+ /** Base64 encoded image for the payment page */
72
105
  imageBase?: string;
106
+ /** Whether to save the payment token for future use */
73
107
  saveToken?: boolean;
74
108
  }
75
109
  interface PaymentLink extends PaymentLinkPayload {
@@ -320,6 +354,58 @@ declare class DepositAccounts {
320
354
  delete(id: number): Promise<any>;
321
355
  }
322
356
 
357
+ interface PaymentMethod {
358
+ slug: string;
359
+ name: string;
360
+ enabled: boolean;
361
+ allowedCurrencies: string[];
362
+ }
363
+ interface ServiceLimit {
364
+ value: number | null;
365
+ currency: string;
366
+ }
367
+ interface ServiceLimits {
368
+ min: ServiceLimit;
369
+ max: ServiceLimit;
370
+ }
371
+ interface Service {
372
+ slug: string;
373
+ enabled: boolean;
374
+ allowed_currencies: string[];
375
+ limits: ServiceLimits;
376
+ }
377
+ interface TropiCard {
378
+ }
379
+ interface Account {
380
+ id: number;
381
+ accountNumber: string;
382
+ userId: string;
383
+ alias: string;
384
+ balance: number;
385
+ pendingIn: number;
386
+ pendingOut: number;
387
+ state: number;
388
+ paymentEntityId: number;
389
+ currency: string;
390
+ type: number;
391
+ createdAt: string;
392
+ updatedAt: string;
393
+ isDefault: boolean;
394
+ groupId: number | null;
395
+ TropiCards: TropiCard[];
396
+ services: Service[];
397
+ paymentMethods: PaymentMethod[];
398
+ }
399
+ declare class Accounts {
400
+ private tropipay;
401
+ constructor(tropipayInstance: Tropipay);
402
+ /**
403
+ * List all accounts of the authenticated user
404
+ * @returns Array of Account objects
405
+ */
406
+ list(): Promise<Account[]>;
407
+ }
408
+
323
409
  /**
324
410
  * Tropipayjs is a Typescript/Javascript library for the Tropipay API.
325
411
  *
@@ -343,6 +429,7 @@ declare class Tropipay {
343
429
  paymentCards: PaymentCard;
344
430
  depositAccounts: DepositAccounts;
345
431
  mediationPaymentCard: MediationPaymentCard;
432
+ accounts: Accounts;
346
433
  /**
347
434
  * Initializes a new instance of the Tropipay class.
348
435
  *
package/index.js CHANGED
@@ -468,6 +468,35 @@ class DepositAccounts {
468
468
  }
469
469
  }
470
470
 
471
+ class Accounts {
472
+ tropipay;
473
+ constructor(tropipayInstance) {
474
+ this.tropipay = tropipayInstance;
475
+ }
476
+ /**
477
+ * List all accounts of the authenticated user
478
+ * @returns Array of Account objects
479
+ */
480
+ async list() {
481
+ if (!Tropipay.accessToken) {
482
+ await this.tropipay.login();
483
+ }
484
+ try {
485
+ const accounts = await this.tropipay.request.get(`/api/v3/accounts/`, {
486
+ headers: {
487
+ "Content-Type": "application/json",
488
+ Authorization: `Bearer ${Tropipay.accessToken}`,
489
+ Accept: "application/json",
490
+ },
491
+ });
492
+ return accounts.data;
493
+ }
494
+ catch (error) {
495
+ throw handleExceptions(error);
496
+ }
497
+ }
498
+ }
499
+
471
500
  /**
472
501
  * Tropipayjs is a Typescript/Javascript library for the Tropipay API.
473
502
  *
@@ -488,6 +517,7 @@ class Tropipay {
488
517
  paymentCards;
489
518
  depositAccounts;
490
519
  mediationPaymentCard;
520
+ accounts;
491
521
  /**
492
522
  * Initializes a new instance of the Tropipay class.
493
523
  *
@@ -558,6 +588,7 @@ class Tropipay {
558
588
  this.paymentCards = new PaymentCard(this);
559
589
  this.mediationPaymentCard = new MediationPaymentCard(this);
560
590
  this.depositAccounts = new DepositAccounts(this);
591
+ this.accounts = new Accounts(this);
561
592
  }
562
593
  async login() {
563
594
  try {
@@ -35,37 +35,71 @@ export interface UserHookSubscribed extends UserHook {
35
35
  createdAt: string;
36
36
  updatedAt: string;
37
37
  }
38
+ /**
39
+ * Interface for creating payment links/cards
40
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
41
+ */
38
42
  export interface PaymentLinkPayload {
39
- accountId: number;
43
+ /** Account ID where the funds will be received if compatible */
44
+ accountId?: number;
45
+ /** Reference code for the payment, preferred to be unique */
40
46
  reference: string;
47
+ /** Short description of the payment */
41
48
  concept: string;
49
+ /** Whether to mark this payment link as favorite */
42
50
  favorite: boolean;
51
+ /** Amount to charge in the specified currency */
43
52
  amount: number;
53
+ /** Currency code (EUR, USD, etc.) */
44
54
  currency: string;
55
+ /** Detailed description of the payment */
45
56
  description: string;
57
+ /** If true, the payment link can only be used once */
46
58
  singleUse: boolean;
59
+ /** Reason ID for the payment */
47
60
  reasonId: number;
61
+ /** Number of days until the payment link expires */
48
62
  expirationDays: number;
63
+ /** Language code for the payment page (en, es, etc.) */
49
64
  lang: string;
65
+ /** URL to redirect after successful payment */
50
66
  urlSuccess: string;
67
+ /** URL to redirect after failed payment */
51
68
  urlFailed: string;
69
+ /** Webhook URL for payment notifications */
52
70
  urlNotification: string;
71
+ /** Date when the service will be provided (ISO format) */
53
72
  serviceDate: string;
73
+ /** Client information for the payment */
54
74
  client?: {
75
+ /** Client's first name */
55
76
  name?: string;
77
+ /** Client's last name */
56
78
  lastName?: string;
79
+ /** Client's address */
57
80
  address?: string;
81
+ /** Client's phone number */
58
82
  phone?: string;
83
+ /** Client's email address */
59
84
  email?: string;
85
+ /** Client's country ID */
60
86
  countryId?: number;
87
+ /** Client's country ISO code */
61
88
  countryIso?: string;
89
+ /** Client's city */
62
90
  city: string;
91
+ /** Client's postal code */
63
92
  postCode: string;
93
+ /** Whether client accepted terms and conditions */
64
94
  termsAndConditions: boolean;
65
95
  } | null;
96
+ /** @deprecated If true, redirects directly to payment page */
66
97
  directPayment: boolean;
98
+ /** List of allowed payment methods */
67
99
  paymentMethods?: string[];
100
+ /** Base64 encoded image for the payment page */
68
101
  imageBase?: string;
102
+ /** Whether to save the payment token for future use */
69
103
  saveToken?: boolean;
70
104
  }
71
105
  export interface PaymentLink extends PaymentLinkPayload {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yosle/tropipayjs",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Javascript / Typescript SDK for the Tropipay API",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,86 @@
1
+ import { Tropipay } from "../api/TropipayAPI";
2
+ import { handleExceptions } from "../utils/errors";
3
+
4
+ // Account interfaces
5
+ export interface PaymentMethod {
6
+ slug: string;
7
+ name: string;
8
+ enabled: boolean;
9
+ allowedCurrencies: string[];
10
+ }
11
+
12
+ export interface ServiceLimit {
13
+ value: number | null;
14
+ currency: string;
15
+ }
16
+
17
+ export interface ServiceLimits {
18
+ min: ServiceLimit;
19
+ max: ServiceLimit;
20
+ }
21
+
22
+ export interface Service {
23
+ slug: string;
24
+ enabled: boolean;
25
+ allowed_currencies: string[];
26
+ limits: ServiceLimits;
27
+ }
28
+
29
+ export interface TropiCard {
30
+ // TropiCard properties can be added here as needed
31
+ }
32
+
33
+ export interface Account {
34
+ id: number;
35
+ accountNumber: string;
36
+ userId: string;
37
+ alias: string;
38
+ balance: number;
39
+ pendingIn: number;
40
+ pendingOut: number;
41
+ state: number;
42
+ paymentEntityId: number;
43
+ currency: string;
44
+ type: number;
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ isDefault: boolean;
48
+ groupId: number | null;
49
+ TropiCards: TropiCard[];
50
+ services: Service[];
51
+ paymentMethods: PaymentMethod[];
52
+ }
53
+
54
+ export default class Accounts {
55
+ private tropipay: Tropipay;
56
+
57
+ constructor(tropipayInstance: Tropipay) {
58
+ this.tropipay = tropipayInstance;
59
+ }
60
+
61
+ /**
62
+ * List all accounts of the authenticated user
63
+ * @returns Array of Account objects
64
+ */
65
+ public async list(): Promise<Account[]> {
66
+ if (!Tropipay.accessToken) {
67
+ await this.tropipay.login();
68
+ }
69
+
70
+ try {
71
+ const accounts = await this.tropipay.request.get(
72
+ `/api/v3/accounts/`,
73
+ {
74
+ headers: {
75
+ "Content-Type": "application/json",
76
+ Authorization: `Bearer ${Tropipay.accessToken}`,
77
+ Accept: "application/json",
78
+ },
79
+ }
80
+ );
81
+ return accounts.data;
82
+ } catch (error) {
83
+ throw handleExceptions(error as unknown as any);
84
+ }
85
+ }
86
+ }
@@ -22,6 +22,7 @@ import PaymentCard from "../paymentcard/PaymentCard";
22
22
  import MediationPaymentCard from "../mediationPaymentCard/MediationPaymentCard";
23
23
  import DepositAccounts from "../depositAccount/depositAccounts";
24
24
  import { TropipayJSException, handleExceptions } from "../utils/errors";
25
+ import Accounts from "../accounts/accounts";
25
26
  export class Tropipay {
26
27
  readonly clientId: string;
27
28
  readonly clientSecret: string;
@@ -36,6 +37,7 @@ export class Tropipay {
36
37
  public paymentCards: PaymentCard;
37
38
  public depositAccounts: DepositAccounts;
38
39
  public mediationPaymentCard: MediationPaymentCard;
40
+ public accounts: Accounts;
39
41
 
40
42
  /**
41
43
  * Initializes a new instance of the Tropipay class.
@@ -122,6 +124,7 @@ export class Tropipay {
122
124
  this.mediationPaymentCard = new MediationPaymentCard(this);
123
125
 
124
126
  this.depositAccounts = new DepositAccounts(this);
127
+ this.accounts = new Accounts(this)
125
128
  }
126
129
 
127
130
  public async login() {
@@ -1,202 +1,264 @@
1
- import { ServerMode } from "../constants/TropipayConstants";
2
-
3
- export type AccountBalance = {
4
- balance: number;
5
- pendingIn: number;
6
- pendingOut: number;
7
- };
8
-
9
- export interface TropipayConfig {
10
- clientId: string;
11
- clientSecret: string;
12
- scopes?: string[];
13
- serverMode?: ServerMode;
14
- // Custom tropipay environment for testing
15
- customTropipayUrl?: string;
16
- }
17
-
18
- export type TropipayCredentials = { clientId: string; clientSecret: string };
19
- export type HookEventType =
20
- | "transaction_completed"
21
- | "transaction_charged"
22
- | "transaction_guarded"
23
- | "user_signup"
24
- | "user_kyc"
25
- | "payment_in_state_change"
26
- | "payment_out_state_change"
27
- | "beneficiary_added"
28
- | "beneficiary_updated"
29
- | "beneficiary_deleted"
30
- | "transaction_new"
31
- | "transaction_preauthorized"
32
- | "transaction_pendingin"
33
- | "transaction_processing"
34
- | "transaction_error"
35
- | "transaction_bloqued"
36
- | "transaction_guarded_send"
37
- | "transaction_guarded_mediation"
38
- | "user_after_update"
39
- | "user_after_create"
40
- | "userDetail_after_create"
41
- | "userDetail_after_update"
42
- | "tpv_callback_ok"
43
- | "fraud_state_on_change";
44
-
45
- export type HookTargetType = "web" | "email";
46
- export interface UserHook {
47
- event: HookEventType;
48
- target: string;
49
- value: string;
50
- }
51
- export interface UserHookSubscribed extends UserHook {
52
- createdAt: string;
53
- updatedAt: string;
54
- }
55
-
56
- export interface UserHook {
57
- event: HookEventType;
58
- target: string;
59
- value: string;
60
- }
61
- export interface UserHookSubscribed extends UserHook {
62
- createdAt: string;
63
- updatedAt: string;
64
- }
65
-
66
- export interface PaymentLinkPayload {
67
- accountId: number;
68
- reference: string;
69
- concept: string;
70
- favorite: boolean;
71
- amount: number;
72
- currency: string;
73
- description: string;
74
- singleUse: boolean;
75
- reasonId: number;
76
- expirationDays: number;
77
- lang: string;
78
- urlSuccess: string;
79
- urlFailed: string;
80
- urlNotification: string;
81
- serviceDate: string;
82
- client?: {
83
- name?: string;
84
- lastName?: string;
85
- address?: string;
86
- phone?: string;
87
- email?: string;
88
- countryId?: number;
89
- countryIso?: string;
90
- city: string;
91
- postCode: string;
92
- termsAndConditions: boolean;
93
- } | null;
94
- directPayment: boolean;
95
- paymentMethods?: string[];
96
- imageBase?: string;
97
- saveToken?: boolean;
98
- }
99
-
100
- export interface PaymentLink extends PaymentLinkPayload {
101
- expirationDate: string;
102
- hasClient: boolean;
103
- updatedAt: string;
104
- createdAt: string;
105
- qrImage: string;
106
- shortUrl: string;
107
- paymentUrl: string;
108
- }
109
-
110
- export interface MediationPaymentCardConfig {
111
- amount: number;
112
- currency: "EUR" | "USD";
113
- concept: string;
114
- description: string;
115
- reference: string;
116
- singleUse: boolean;
117
- lang: string;
118
- productUrl?: string;
119
- buyer: null | any;
120
- seller: {
121
- sellerId?: number;
122
- type?: number;
123
- email?: string;
124
- };
125
- feePercent?: number;
126
- feeFixed?: number;
127
- sendMail: boolean;
128
- }
129
-
130
- export type LoginResponse = {
131
- access_token: string;
132
- refresh_token: string;
133
- token_type: "Bearer";
134
- expires_in: number;
135
- scope: string;
136
- };
137
-
138
- export type LoginError = {
139
- error: string;
140
- };
141
-
142
- export type Country = {
143
- id: number;
144
- name: string;
145
- sepaZone: boolean;
146
- state: number;
147
- slug: string;
148
- slugn: number;
149
- callingCode: number;
150
- isDestination: boolean;
151
- isRisky: boolean;
152
- currentCurrency: string | null;
153
- createdAt: string;
154
- updatedAt: string;
155
- isFavorite: boolean;
156
- position: any;
157
- };
158
-
159
- export type Deposit = {
160
- id: number;
161
- accountNumber: string;
162
- alias: string;
163
- swift: string;
164
- type: number;
165
- country: number | null;
166
- firstName: string;
167
- default: null;
168
- state: number;
169
- userId: string;
170
- countryDestinationId: number;
171
- lastName: string;
172
- documentNumber: number;
173
- userRelationTypeId: number;
174
- city: string;
175
- postalCode: string;
176
- address: string;
177
- phone: string;
178
- checked: boolean;
179
- province: string;
180
- beneficiaryType: number;
181
- relatedUserId: null | string;
182
- currency: string;
183
- correspondent?: any;
184
- location: any;
185
- office: any;
186
- officeValue: any;
187
- paymentType: number;
188
- paymentEntityBeneficiaryId: number;
189
- paymentEntityAccountId: number;
190
- verified: any;
191
- paymentEntityInfo: any;
192
- documentTypeId: any;
193
- documentExpirationDate: Date;
194
- createdAt: Date;
195
- updatedAt: Date;
196
- countryDestination: Country;
197
- };
198
-
199
- export type AccountDeposits = {
200
- count: number;
201
- rows: Deposit[];
202
- };
1
+ import { ServerMode } from "../constants/TropipayConstants";
2
+
3
+ export type AccountBalance = {
4
+ balance: number;
5
+ pendingIn: number;
6
+ pendingOut: number;
7
+ };
8
+
9
+ export interface TropipayConfig {
10
+ clientId: string;
11
+ clientSecret: string;
12
+ scopes?: string[];
13
+ serverMode?: ServerMode;
14
+ // Custom tropipay environment for testing
15
+ customTropipayUrl?: string;
16
+ }
17
+
18
+ export type TropipayCredentials = { clientId: string; clientSecret: string };
19
+ export type HookEventType =
20
+ | "transaction_completed"
21
+ | "transaction_charged"
22
+ | "transaction_guarded"
23
+ | "user_signup"
24
+ | "user_kyc"
25
+ | "payment_in_state_change"
26
+ | "payment_out_state_change"
27
+ | "beneficiary_added"
28
+ | "beneficiary_updated"
29
+ | "beneficiary_deleted"
30
+ | "transaction_new"
31
+ | "transaction_preauthorized"
32
+ | "transaction_pendingin"
33
+ | "transaction_processing"
34
+ | "transaction_error"
35
+ | "transaction_bloqued"
36
+ | "transaction_guarded_send"
37
+ | "transaction_guarded_mediation"
38
+ | "user_after_update"
39
+ | "user_after_create"
40
+ | "userDetail_after_create"
41
+ | "userDetail_after_update"
42
+ | "tpv_callback_ok"
43
+ | "fraud_state_on_change";
44
+
45
+ export type HookTargetType = "web" | "email";
46
+ export interface UserHook {
47
+ event: HookEventType;
48
+ target: string;
49
+ value: string;
50
+ }
51
+ export interface UserHookSubscribed extends UserHook {
52
+ createdAt: string;
53
+ updatedAt: string;
54
+ }
55
+
56
+ export interface UserHook {
57
+ event: HookEventType;
58
+ target: string;
59
+ value: string;
60
+ }
61
+ export interface UserHookSubscribed extends UserHook {
62
+ createdAt: string;
63
+ updatedAt: string;
64
+ }
65
+
66
+ /**
67
+ * Interface for creating payment links/cards
68
+ * @see https://tpp.stoplight.io/docs/tropipay-api-doc/b3A6ODgyNTM3OQ-create-a-new-pay-link-charge
69
+ */
70
+ export interface PaymentLinkPayload {
71
+ /** Account ID where the funds will be received if compatible */
72
+ accountId?: number;
73
+
74
+ /** Reference code for the payment, preferred to be unique */
75
+ reference: string;
76
+
77
+ /** Short description of the payment */
78
+ concept: string;
79
+
80
+ /** Whether to mark this payment link as favorite */
81
+ favorite: boolean;
82
+
83
+ /** Amount to charge in the specified currency */
84
+ amount: number;
85
+
86
+ /** Currency code (EUR, USD, etc.) */
87
+ currency: string;
88
+
89
+ /** Detailed description of the payment */
90
+ description: string;
91
+
92
+ /** If true, the payment link can only be used once */
93
+ singleUse: boolean;
94
+
95
+ /** Reason ID for the payment */
96
+ reasonId: number;
97
+
98
+ /** Number of days until the payment link expires */
99
+ expirationDays: number;
100
+
101
+ /** Language code for the payment page (en, es, etc.) */
102
+ lang: string;
103
+
104
+ /** URL to redirect after successful payment */
105
+ urlSuccess: string;
106
+
107
+ /** URL to redirect after failed payment */
108
+ urlFailed: string;
109
+
110
+ /** Webhook URL for payment notifications */
111
+ urlNotification: string;
112
+
113
+ /** Date when the service will be provided (ISO format) */
114
+ serviceDate: string;
115
+
116
+ /** Client information for the payment */
117
+ client?: {
118
+ /** Client's first name */
119
+ name?: string;
120
+
121
+ /** Client's last name */
122
+ lastName?: string;
123
+
124
+ /** Client's address */
125
+ address?: string;
126
+
127
+ /** Client's phone number */
128
+ phone?: string;
129
+
130
+ /** Client's email address */
131
+ email?: string;
132
+
133
+ /** Client's country ID */
134
+ countryId?: number;
135
+
136
+ /** Client's country ISO code */
137
+ countryIso?: string;
138
+
139
+ /** Client's city */
140
+ city: string;
141
+
142
+ /** Client's postal code */
143
+ postCode: string;
144
+
145
+ /** Whether client accepted terms and conditions */
146
+ termsAndConditions: boolean;
147
+ } | null;
148
+
149
+ /** @deprecated If true, redirects directly to payment page */
150
+ directPayment: boolean;
151
+
152
+ /** List of allowed payment methods */
153
+ paymentMethods?: string[];
154
+
155
+ /** Base64 encoded image for the payment page */
156
+ imageBase?: string;
157
+
158
+ /** Whether to save the payment token for future use */
159
+ saveToken?: boolean;
160
+ }
161
+
162
+ export interface PaymentLink extends PaymentLinkPayload {
163
+ expirationDate: string;
164
+ hasClient: boolean;
165
+ updatedAt: string;
166
+ createdAt: string;
167
+ qrImage: string;
168
+ shortUrl: string;
169
+ paymentUrl: string;
170
+ }
171
+
172
+ export interface MediationPaymentCardConfig {
173
+ amount: number;
174
+ currency: "EUR" | "USD";
175
+ concept: string;
176
+ description: string;
177
+ reference: string;
178
+ singleUse: boolean;
179
+ lang: string;
180
+ productUrl?: string;
181
+ buyer: null | any;
182
+ seller: {
183
+ sellerId?: number;
184
+ type?: number;
185
+ email?: string;
186
+ };
187
+ feePercent?: number;
188
+ feeFixed?: number;
189
+ sendMail: boolean;
190
+ }
191
+
192
+ export type LoginResponse = {
193
+ access_token: string;
194
+ refresh_token: string;
195
+ token_type: "Bearer";
196
+ expires_in: number;
197
+ scope: string;
198
+ };
199
+
200
+ export type LoginError = {
201
+ error: string;
202
+ };
203
+
204
+ export type Country = {
205
+ id: number;
206
+ name: string;
207
+ sepaZone: boolean;
208
+ state: number;
209
+ slug: string;
210
+ slugn: number;
211
+ callingCode: number;
212
+ isDestination: boolean;
213
+ isRisky: boolean;
214
+ currentCurrency: string | null;
215
+ createdAt: string;
216
+ updatedAt: string;
217
+ isFavorite: boolean;
218
+ position: any;
219
+ };
220
+
221
+ export type Deposit = {
222
+ id: number;
223
+ accountNumber: string;
224
+ alias: string;
225
+ swift: string;
226
+ type: number;
227
+ country: number | null;
228
+ firstName: string;
229
+ default: null;
230
+ state: number;
231
+ userId: string;
232
+ countryDestinationId: number;
233
+ lastName: string;
234
+ documentNumber: number;
235
+ userRelationTypeId: number;
236
+ city: string;
237
+ postalCode: string;
238
+ address: string;
239
+ phone: string;
240
+ checked: boolean;
241
+ province: string;
242
+ beneficiaryType: number;
243
+ relatedUserId: null | string;
244
+ currency: string;
245
+ correspondent?: any;
246
+ location: any;
247
+ office: any;
248
+ officeValue: any;
249
+ paymentType: number;
250
+ paymentEntityBeneficiaryId: number;
251
+ paymentEntityAccountId: number;
252
+ verified: any;
253
+ paymentEntityInfo: any;
254
+ documentTypeId: any;
255
+ documentExpirationDate: Date;
256
+ createdAt: Date;
257
+ updatedAt: Date;
258
+ countryDestination: Country;
259
+ };
260
+
261
+ export type AccountDeposits = {
262
+ count: number;
263
+ rows: Deposit[];
264
+ };