@ariary/pay 1.0.0 → 1.0.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.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  type Data = {
2
- body?: Record<string, any>;
3
- params?: Record<string, any>;
2
+ body?: Record<string, unknown>;
3
+ params?: Record<string, string>;
4
4
  public?: boolean;
5
5
  };
6
6
  type PData = Omit<Data, 'body'>;
@@ -10,11 +10,11 @@ type Config = {
10
10
  baseUrl?: string;
11
11
  };
12
12
  declare const createRequester: (config: Config) => {
13
- get: <T = any>(url: string, data?: PData) => Promise<T>;
14
- post: <T = any>(url: string, data?: Data) => Promise<T>;
15
- patch: <T = any>(url: string, data?: Data) => Promise<T>;
16
- put: <T = any>(url: string, data?: Data) => Promise<T>;
17
- delete: <T = any>(url: string, data?: PData) => Promise<T>;
13
+ get: <T>(url: string, data?: PData) => Promise<T>;
14
+ post: <T>(url: string, data?: Data) => Promise<T>;
15
+ patch: <T>(url: string, data?: Data) => Promise<T>;
16
+ put: <T>(url: string, data?: Data) => Promise<T>;
17
+ delete: <T = void>(url: string, data?: PData) => Promise<T>;
18
18
  };
19
19
 
20
20
  declare enum Status {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  type Data = {
2
- body?: Record<string, any>;
3
- params?: Record<string, any>;
2
+ body?: Record<string, unknown>;
3
+ params?: Record<string, string>;
4
4
  public?: boolean;
5
5
  };
6
6
  type PData = Omit<Data, 'body'>;
@@ -10,11 +10,11 @@ type Config = {
10
10
  baseUrl?: string;
11
11
  };
12
12
  declare const createRequester: (config: Config) => {
13
- get: <T = any>(url: string, data?: PData) => Promise<T>;
14
- post: <T = any>(url: string, data?: Data) => Promise<T>;
15
- patch: <T = any>(url: string, data?: Data) => Promise<T>;
16
- put: <T = any>(url: string, data?: Data) => Promise<T>;
17
- delete: <T = any>(url: string, data?: PData) => Promise<T>;
13
+ get: <T>(url: string, data?: PData) => Promise<T>;
14
+ post: <T>(url: string, data?: Data) => Promise<T>;
15
+ patch: <T>(url: string, data?: Data) => Promise<T>;
16
+ put: <T>(url: string, data?: Data) => Promise<T>;
17
+ delete: <T = void>(url: string, data?: PData) => Promise<T>;
18
18
  };
19
19
 
20
20
  declare enum Status {
package/dist/index.js CHANGED
@@ -82,8 +82,7 @@ var Payment = class {
82
82
  return res.data;
83
83
  }
84
84
  async pay(ticketCode) {
85
- const res = await this._requester.put(`/api/payments/${this.id}/pay`, { body: { ticketCode } });
86
- return res.data;
85
+ return this._requester.put(`/api/payments/${this.id}/pay`, { body: { ticketCode } });
87
86
  }
88
87
  };
89
88
  var _Ariari = class _Ariari {
@@ -95,12 +94,10 @@ var _Ariari = class _Ariari {
95
94
  this.getPayment = (id) => new Payment(id, this._requester);
96
95
  this.products = {
97
96
  create: async (data) => {
98
- const res = await this._requester.post("/api/products", { body: data });
99
- return res.data;
97
+ return this._requester.post("/api/products", { body: data });
100
98
  },
101
99
  list: async () => {
102
- const res = await this._requester.get("/api/products");
103
- return res.data;
100
+ return this._requester.get("/api/products");
104
101
  },
105
102
  delete: async (id) => {
106
103
  await this._requester.delete(`/api/products/${id}`);
package/dist/index.mjs CHANGED
@@ -55,8 +55,7 @@ var Payment = class {
55
55
  return res.data;
56
56
  }
57
57
  async pay(ticketCode) {
58
- const res = await this._requester.put(`/api/payments/${this.id}/pay`, { body: { ticketCode } });
59
- return res.data;
58
+ return this._requester.put(`/api/payments/${this.id}/pay`, { body: { ticketCode } });
60
59
  }
61
60
  };
62
61
  var _Ariari = class _Ariari {
@@ -68,12 +67,10 @@ var _Ariari = class _Ariari {
68
67
  this.getPayment = (id) => new Payment(id, this._requester);
69
68
  this.products = {
70
69
  create: async (data) => {
71
- const res = await this._requester.post("/api/products", { body: data });
72
- return res.data;
70
+ return this._requester.post("/api/products", { body: data });
73
71
  },
74
72
  list: async () => {
75
- const res = await this._requester.get("/api/products");
76
- return res.data;
73
+ return this._requester.get("/api/products");
77
74
  },
78
75
  delete: async (id) => {
79
76
  await this._requester.delete(`/api/products/${id}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariary/pay",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Payment SDK pour l'API Ariary",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",