@zennify/sdk-js 1.9.0 → 1.10.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "A simple package to work with https://api.zennify.app",
5
5
  "main": "dist/main.js",
6
6
  "keywords": [],
@@ -1,34 +1,39 @@
1
- export type BaseTransaction = {
1
+ export type BaseTransaction<TransactionMetadata extends any = any> = {
2
2
  id: string,
3
3
  created_at: string,
4
4
  entity: 'semiauto' | 'mercadopago',
5
5
  method: 'pix',
6
- managed: null,
6
+ managed?: boolean | null,
7
7
  status: 'approved' | 'cancelled' | 'expired' | 'pending' | 'refused' | 'rejected' | 'analysis',
8
8
  value: number,
9
9
  base_value: number,
10
10
  refunded_value: number,
11
- refund_reason: null,
12
- refund_comment: null,
13
- refund_requested_by: null,
14
- pix_e2eid: null,
15
- pix_qrcode: null,
16
- payer_bank: null
11
+ refund_reason?: string | null,
12
+ refund_comment?: string | null,
13
+ refund_requested_by?: string | null,
14
+ pix_e2eid?: string | null,
15
+ pix_qrcode?: string | null,
16
+ payer_bank?: string | null,
17
+ metadata?: TransactionMetadata | null
18
+ };
19
+
20
+ type DiscordOrder = {
21
+ platform: 'discord',
22
+ discord_guild_id?: string | null,
23
+ discord_channel_id?: string | null,
24
+ discord_channel_message_id?: string | null
17
25
  }
18
26
 
19
27
  export type SaleTransaction = BaseTransaction & {
20
28
  type: 'sale',
21
- order: {
29
+ order: DiscordOrder & {
22
30
  id: string,
23
31
  created_at: string,
24
- platform: 'discord',
25
- discord_guild_id: null,
26
32
  discount: number,
27
33
  subtotal: number,
28
34
  total_value: number,
29
- rating: null,
30
- rating_message: null,
31
- metadata: null,
35
+ rating?: number | null,
36
+ rating_message?: number | null,
32
37
  payer: {
33
38
  id: number,
34
39
  username: string,
@@ -42,16 +47,16 @@ export type SaleTransaction = BaseTransaction & {
42
47
  store: {
43
48
  id: number,
44
49
  name: string,
45
- icon_id: null,
46
- banner_id: null
50
+ icon_id?: number | null,
51
+ banner_id?: number | null
47
52
  },
48
53
  products: [
49
54
  {
50
55
  id: number,
51
56
  name: string,
52
57
  value: number,
53
- icon_id: null,
54
- banner_id: null,
58
+ icon_id?: number | null,
59
+ banner_id?: number | null
55
60
  amount: number,
56
61
  delivered: string[]
57
62
  }
@@ -59,4 +64,4 @@ export type SaleTransaction = BaseTransaction & {
59
64
  }
60
65
  };
61
66
 
62
- export type FullTransaction = BaseTransaction & SaleTransaction;
67
+ export type FullTransaction<TransactionMetadata extends any = any> = BaseTransaction<TransactionMetadata> & SaleTransaction;
@@ -1,33 +1,37 @@
1
- export type BaseTransaction = {
1
+ export type BaseTransaction<TransactionMetadata extends any = any> = {
2
2
  id: string;
3
3
  created_at: string;
4
4
  entity: 'semiauto' | 'mercadopago';
5
5
  method: 'pix';
6
- managed: null;
6
+ managed?: boolean | null;
7
7
  status: 'approved' | 'cancelled' | 'expired' | 'pending' | 'refused' | 'rejected' | 'analysis';
8
8
  value: number;
9
9
  base_value: number;
10
10
  refunded_value: number;
11
- refund_reason: null;
12
- refund_comment: null;
13
- refund_requested_by: null;
14
- pix_e2eid: null;
15
- pix_qrcode: null;
16
- payer_bank: null;
11
+ refund_reason?: string | null;
12
+ refund_comment?: string | null;
13
+ refund_requested_by?: string | null;
14
+ pix_e2eid?: string | null;
15
+ pix_qrcode?: string | null;
16
+ payer_bank?: string | null;
17
+ metadata?: TransactionMetadata | null;
18
+ };
19
+ type DiscordOrder = {
20
+ platform: 'discord';
21
+ discord_guild_id?: string | null;
22
+ discord_channel_id?: string | null;
23
+ discord_channel_message_id?: string | null;
17
24
  };
18
25
  export type SaleTransaction = BaseTransaction & {
19
26
  type: 'sale';
20
- order: {
27
+ order: DiscordOrder & {
21
28
  id: string;
22
29
  created_at: string;
23
- platform: 'discord';
24
- discord_guild_id: null;
25
30
  discount: number;
26
31
  subtotal: number;
27
32
  total_value: number;
28
- rating: null;
29
- rating_message: null;
30
- metadata: null;
33
+ rating?: number | null;
34
+ rating_message?: number | null;
31
35
  payer: {
32
36
  id: number;
33
37
  username: string;
@@ -41,20 +45,21 @@ export type SaleTransaction = BaseTransaction & {
41
45
  store: {
42
46
  id: number;
43
47
  name: string;
44
- icon_id: null;
45
- banner_id: null;
48
+ icon_id?: number | null;
49
+ banner_id?: number | null;
46
50
  };
47
51
  products: [
48
52
  {
49
53
  id: number;
50
54
  name: string;
51
55
  value: number;
52
- icon_id: null;
53
- banner_id: null;
56
+ icon_id?: number | null;
57
+ banner_id?: number | null;
54
58
  amount: number;
55
59
  delivered: string[];
56
60
  }
57
61
  ];
58
62
  };
59
63
  };
60
- export type FullTransaction = BaseTransaction & SaleTransaction;
64
+ export type FullTransaction<TransactionMetadata extends any = any> = BaseTransaction<TransactionMetadata> & SaleTransaction;
65
+ export {};