@yosle/tropipayjs 0.2.1 → 0.2.3

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.
@@ -3,9 +3,7 @@ export declare class ServerSideUtils {
3
3
  private tropipay;
4
4
  constructor(tropipayInstance: Tropipay);
5
5
  /**
6
- * DEPRECATED Verify Topipay's signature on API V2 webhooks.
7
- * @deprecated This method is deprecated and will be removed in future versions.
8
- * Use the `verifySignatureV3` method from the `ServerSideUtils` class instead.
6
+ * Verify Topipay's signature on webhooks.
9
7
  * @param credentials Credential object or Tropipay instance
10
8
  * @param {String} originalCurrencyAmount
11
9
  * @param bankOrderCode
@@ -44,15 +42,4 @@ export declare class ServerSideUtils {
44
42
  * @return {Promise<string>} the valid base64 image
45
43
  */
46
44
  static isValidImage(base64Image: string): boolean;
47
- /**
48
- * Verify Topipay's signature on API V3 webhooks.
49
- * @param {string} originalCurrencyAmount
50
- * @param {string} bankOrderCode
51
- * @param {string} signature signaturev3 field to be verified
52
- * @returns {boolean}
53
- */
54
- static verifySignatureV3(credentials: {
55
- clientId: string;
56
- clientSecret: string;
57
- } | Tropipay, originalCurrencyAmount: string, bankOrderCode: string, signature: string): boolean;
58
45
  }
@@ -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
- }