@yosle/tropipayjs 0.2.1 → 0.2.2

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,52 +0,0 @@
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
- }
@@ -1,86 +0,0 @@
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
- }