paystack-sdk 2.5.27 → 3.2.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.
@@ -1,48 +1,27 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.PaymentPage = void 0;
13
4
  class PaymentPage {
14
5
  constructor(http) {
15
6
  this.http = http;
16
7
  }
17
- create(data) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- return yield this.http.post('/page', JSON.stringify(data));
20
- });
8
+ async create(data) {
9
+ return await this.http.post('/page', JSON.stringify(data));
21
10
  }
22
- list(queryParams) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- return yield this.http.get('/page', { params: Object.assign({}, queryParams) });
25
- });
11
+ async list(queryParams) {
12
+ return await this.http.get('/page', { params: { ...queryParams } });
26
13
  }
27
- fetch(id) {
28
- return __awaiter(this, void 0, void 0, function* () {
29
- return yield this.http.get(`/page/${id}`);
30
- });
14
+ async fetch(id) {
15
+ return await this.http.get(`/page/${id}`);
31
16
  }
32
- update(id, data) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- return yield this.http.put(`/page/${id}`, JSON.stringify(data));
35
- });
17
+ async update(id, data) {
18
+ return await this.http.put(`/page/${id}`, JSON.stringify(data));
36
19
  }
37
- slugAvailable(slug) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- return yield this.http.get(`/page/check_slug_availability/${slug}`);
40
- });
20
+ async slugAvailable(slug) {
21
+ return await this.http.get(`/page/check_slug_availability/${slug}`);
41
22
  }
42
- addProduct(id, products) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- return yield this.http.post(`/page/${id}/product`, JSON.stringify({ products }));
45
- });
23
+ async addProduct(id, products) {
24
+ return await this.http.post(`/page/${id}/product`, JSON.stringify({ products }));
46
25
  }
47
26
  }
48
27
  exports.PaymentPage = PaymentPage;
@@ -16,6 +16,7 @@ import { Transfer } from './transfer/transfer';
16
16
  import { BulkCharge } from './bulkcharge/bulkcharge';
17
17
  import { Verification } from './verification/verification';
18
18
  import { Refund } from './refund/refund';
19
+ import { Misc } from './misc/misc';
19
20
  /**
20
21
  * Paystack SDK
21
22
  * @author Asaju Enitan <@tPriest>
@@ -41,5 +42,6 @@ export declare class Paystack {
41
42
  recipient: Recipient;
42
43
  refund: Refund;
43
44
  verification: Verification;
45
+ misc: Misc;
44
46
  constructor(key: string);
45
47
  }
package/dist/paystack.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.Paystack = void 0;
4
- const axios_1 = require("axios");
5
7
  const apple_1 = require("./apple/apple");
6
8
  const charge_1 = require("./charge/charge");
7
9
  const customer_1 = require("./customer/customer");
@@ -20,6 +22,8 @@ const transfer_1 = require("./transfer/transfer");
20
22
  const bulkcharge_1 = require("./bulkcharge/bulkcharge");
21
23
  const verification_1 = require("./verification/verification");
22
24
  const refund_1 = require("./refund/refund");
25
+ const misc_1 = require("./misc/misc");
26
+ const axios_1 = __importDefault(require("axios"));
23
27
  /**
24
28
  * Paystack SDK
25
29
  * @author Asaju Enitan <@tPriest>
@@ -27,14 +31,14 @@ const refund_1 = require("./refund/refund");
27
31
  class Paystack {
28
32
  constructor(key) {
29
33
  this.key = key;
30
- this.http = new axios_1.Axios({
34
+ this.http = axios_1.default.create({
31
35
  baseURL: 'https://api.paystack.co',
32
36
  headers: {
33
37
  Authorization: `Bearer ${this.key}`,
34
38
  'Content-Type': 'application/json',
35
39
  },
36
40
  });
37
- this.http.interceptors.response.use((response) => (response.data = JSON.parse(response.data)));
41
+ this.http.interceptors.response.use((response) => response.data);
38
42
  this.bulkcharge = new bulkcharge_1.BulkCharge(this.http);
39
43
  this.charge = new charge_1.Charge(this.http);
40
44
  this.customer = new customer_1.Customer(this.http);
@@ -53,6 +57,7 @@ class Paystack {
53
57
  this.recipient = new recipient_1.Recipient(this.http);
54
58
  this.refund = new refund_1.Refund(this.http);
55
59
  this.verification = new verification_1.Verification(this.http);
60
+ this.misc = new misc_1.Misc(this.http);
56
61
  }
57
62
  }
58
63
  exports.Paystack = Paystack;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/plan/plan.js CHANGED
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Plan = void 0;
13
4
  /**
@@ -26,10 +17,8 @@ class Plan {
26
17
  * @param {CreatePlan} data Body Param
27
18
  * @returns {Promise<PlanResponse | BadRequest>}
28
19
  */
29
- create(data) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- return yield this.http.post('/plan', JSON.stringify(data));
32
- });
20
+ async create(data) {
21
+ return await this.http.post('/plan', JSON.stringify(data));
33
22
  }
34
23
  /**
35
24
  * ### List Plans
@@ -37,11 +26,9 @@ class Plan {
37
26
  * @param queryParams Query Parameters
38
27
  * @returns {Promise<PlanResponse | BadRequest>}
39
28
  */
40
- list(queryParams) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- return yield this.http.get('/plan', {
43
- params: Object.assign({}, queryParams),
44
- });
29
+ async list(queryParams) {
30
+ return await this.http.get('/plan', {
31
+ params: { ...queryParams },
45
32
  });
46
33
  }
47
34
  /**
@@ -50,10 +37,8 @@ class Plan {
50
37
  * @param id The plan `ID` or `code` you want to fetch
51
38
  * @returns {Promise<PlanResponse | BadRequest>}
52
39
  */
53
- fetch(id) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- return yield this.http.get(`/plan/${id}`);
56
- });
40
+ async fetch(id) {
41
+ return await this.http.get(`/plan/${id}`);
57
42
  }
58
43
  /**
59
44
  * ### Update Plan
@@ -62,10 +47,8 @@ class Plan {
62
47
  * @param {UpdatePlan} data Update Plan Data
63
48
  * @returns {Promise<PlanResponse | BadRequest>}
64
49
  */
65
- update(id, data) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- return yield this.http.put(`/plan/${id}`, JSON.stringify(data));
68
- });
50
+ async update(id, data) {
51
+ return await this.http.put(`/plan/${id}`, JSON.stringify(data));
69
52
  }
70
53
  }
71
54
  exports.Plan = Plan;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Product = void 0;
13
4
  /**
@@ -20,27 +11,19 @@ class Product {
20
11
  constructor(http) {
21
12
  this.http = http;
22
13
  }
23
- create(data) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- return yield this.http.post('/product', JSON.stringify(data));
26
- });
14
+ async create(data) {
15
+ return await this.http.post('/product', JSON.stringify(data));
27
16
  }
28
- list(queryParams) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- return yield this.http.get('/product', {
31
- params: Object.assign({}, queryParams),
32
- });
17
+ async list(queryParams) {
18
+ return await this.http.get('/product', {
19
+ params: { ...queryParams },
33
20
  });
34
21
  }
35
- fetch(id) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- return yield this.http.get(`/product/${id}`);
38
- });
22
+ async fetch(id) {
23
+ return await this.http.get(`/product/${id}`);
39
24
  }
40
- update(id, data) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- return yield this.http.put(`/product/${id}`, JSON.stringify(data));
43
- });
25
+ async update(id, data) {
26
+ return await this.http.put(`/product/${id}`, JSON.stringify(data));
44
27
  }
45
28
  }
46
29
  exports.Product = Product;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Recipient = void 0;
13
4
  class Recipient {
@@ -19,39 +10,29 @@ class Recipient {
19
10
  * A duplicate account number will lead to the retrieval of the existing record.
20
11
  * If you set `isBulk` to true, you must set the data as an array of recipients
21
12
  */
22
- create(data, isBulk) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- let body;
25
- let url = '/transferrecipient';
26
- body = data;
27
- if (isBulk) {
28
- url += '/bulk';
29
- body = { batch: data };
30
- }
31
- return yield this.http.post(url, JSON.stringify(body));
32
- });
13
+ async create(data, isBulk) {
14
+ let body;
15
+ let url = '/transferrecipient';
16
+ body = data;
17
+ if (isBulk) {
18
+ url += '/bulk';
19
+ body = { batch: data };
20
+ }
21
+ return await this.http.post(url, JSON.stringify(body));
33
22
  }
34
- list(queryParams) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- return yield this.http.get('/transferrecipient', {
37
- params: Object.assign({}, queryParams),
38
- });
23
+ async list(queryParams) {
24
+ return await this.http.get('/transferrecipient', {
25
+ params: { ...queryParams },
39
26
  });
40
27
  }
41
- fetch(id) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- return yield this.http.get(`/transferrecipient/${id}`);
44
- });
28
+ async fetch(id) {
29
+ return await this.http.get(`/transferrecipient/${id}`);
45
30
  }
46
- update(id, data) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- return yield this.http.put(`/transferrecipient/${id}`, JSON.stringify(data));
49
- });
31
+ async update(id, data) {
32
+ return await this.http.put(`/transferrecipient/${id}`, JSON.stringify(data));
50
33
  }
51
- delete(id) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- return yield this.http.delete(`/transferrecipient/${id}`);
54
- });
34
+ async delete(id) {
35
+ return await this.http.delete(`/transferrecipient/${id}`);
55
36
  }
56
37
  }
57
38
  exports.Recipient = Recipient;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Refund = void 0;
13
4
  class Refund {
@@ -18,30 +9,24 @@ class Refund {
18
9
  * #### Create Refund
19
10
  * Initiate a refund on your integration
20
11
  */
21
- create(data) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- return yield this.http.post('/refund', JSON.stringify(data));
24
- });
12
+ async create(data) {
13
+ return await this.http.post('/refund', JSON.stringify(data));
25
14
  }
26
15
  /**
27
16
  * #### List Refunds
28
17
  * List refunds available on your integration
29
18
  */
30
- list(queryParams) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- return yield this.http.get('/refund', {
33
- params: Object.assign({}, queryParams),
34
- });
19
+ async list(queryParams) {
20
+ return await this.http.get('/refund', {
21
+ params: { ...queryParams },
35
22
  });
36
23
  }
37
24
  /**
38
25
  * #### Fetch Refund
39
26
  * Get details of a refund on your integration
40
27
  */
41
- fetch(reference) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- return yield this.http.get(`/refund/${reference}`);
44
- });
28
+ async fetch(reference) {
29
+ return await this.http.get(`/refund/${reference}`);
45
30
  }
46
31
  }
47
32
  exports.Refund = Refund;
@@ -23,8 +23,8 @@ export interface ListSettlementsResponse extends Response {
23
23
  data: Settlement[];
24
24
  meta: Meta;
25
25
  }
26
- declare type CustomerType = Pick<Customer, 'id' | 'first_name' | 'last_name' | 'email' | 'phone' | 'metadata' | 'customer_code' | 'risk_action'>;
27
- declare type SubAccountType = Pick<SubAccount, 'id' | 'subaccount_code' | 'business_name' | 'description' | 'primary_contact_name' | 'primary_contact_email' | 'primary_contact_phone' | 'metadata' | 'percentage_charge' | 'settlement_bank' | 'account_number'>;
26
+ type CustomerType = Pick<Customer, 'id' | 'first_name' | 'last_name' | 'email' | 'phone' | 'metadata' | 'customer_code' | 'risk_action'>;
27
+ type SubAccountType = Pick<SubAccount, 'id' | 'subaccount_code' | 'business_name' | 'description' | 'primary_contact_name' | 'primary_contact_email' | 'primary_contact_phone' | 'metadata' | 'percentage_charge' | 'settlement_bank' | 'account_number'>;
28
28
  export interface SettlementTransaction {
29
29
  id: number;
30
30
  reference: string;
@@ -1,29 +1,16 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Settlement = void 0;
13
4
  class Settlement {
14
5
  constructor(http) {
15
6
  this.http = http;
16
7
  }
17
- list(queryParams) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- return yield this.http.get('/settlement', { params: Object.assign({}, queryParams) });
20
- });
8
+ async list(queryParams) {
9
+ return await this.http.get('/settlement', { params: { ...queryParams } });
21
10
  }
22
- transactions(id, queryParams) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- return yield this.http.get(`/settlement/${id}/transactions`, {
25
- params: Object.assign({}, queryParams),
26
- });
11
+ async transactions(id, queryParams) {
12
+ return await this.http.get(`/settlement/${id}/transactions`, {
13
+ params: { ...queryParams },
27
14
  });
28
15
  }
29
16
  }
@@ -1,6 +1,6 @@
1
1
  import { Meta } from '../interface';
2
- export declare type SplitCurrrencyType = 'GHS' | 'NGN' | 'ZAR' | 'USD';
3
- export declare type SplitType = 'percentage' | 'flat';
2
+ export type SplitCurrrencyType = 'GHS' | 'NGN' | 'ZAR' | 'USD';
3
+ export type SplitType = 'percentage' | 'flat';
4
4
  interface SubAccount {
5
5
  id: number;
6
6
  subaccount_code: string;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.TransactionSplit = void 0;
13
4
  /**
@@ -22,73 +13,61 @@ class TransactionSplit {
22
13
  /**
23
14
  * Create a split payment on your integration
24
15
  */
25
- create(data) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- return yield this.http.request({
28
- url: '/split',
29
- data: JSON.stringify(data),
30
- method: 'post',
31
- });
16
+ async create(data) {
17
+ return await this.http.request({
18
+ url: '/split',
19
+ data: JSON.stringify(data),
20
+ method: 'post',
32
21
  });
33
22
  }
34
23
  /**
35
24
  * List/search for the transaction splits available on your integration.
36
25
  */
37
- list(queryParams) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- return yield this.http.request({
40
- url: '/split',
41
- params: Object.assign({}, queryParams),
42
- method: 'get',
43
- });
26
+ async list(queryParams) {
27
+ return await this.http.request({
28
+ url: '/split',
29
+ params: { ...queryParams },
30
+ method: 'get',
44
31
  });
45
32
  }
46
33
  /**
47
34
  * Get details of a split on your integration.
48
35
  */
49
- fetch(splitId) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- return yield this.http.request({
52
- url: `/split/${splitId}`,
53
- method: 'get',
54
- });
36
+ async fetch(splitId) {
37
+ return await this.http.request({
38
+ url: `/split/${splitId}`,
39
+ method: 'get',
55
40
  });
56
41
  }
57
42
  /**
58
43
  * Update a transaction split details on your integration
59
44
  */
60
- update(splitId, data) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- return yield this.http.request({
63
- url: `/split/${splitId}`,
64
- data: JSON.stringify(data),
65
- method: 'put',
66
- });
45
+ async update(splitId, data) {
46
+ return await this.http.request({
47
+ url: `/split/${splitId}`,
48
+ data: JSON.stringify(data),
49
+ method: 'put',
67
50
  });
68
51
  }
69
52
  /**
70
53
  * Add a Subaccount to a Transaction Split,
71
54
  * or update the share of an existing Subaccount in a Transaction Split
72
55
  */
73
- add(splitId, data) {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- return yield this.http.request({
76
- url: `/split/${splitId}/subaccount/add`,
77
- data: JSON.stringify(data),
78
- method: 'post',
79
- });
56
+ async add(splitId, data) {
57
+ return await this.http.request({
58
+ url: `/split/${splitId}/subaccount/add`,
59
+ data: JSON.stringify(data),
60
+ method: 'post',
80
61
  });
81
62
  }
82
63
  /**
83
64
  * Remove a subaccount from a transaction split
84
65
  */
85
- remove(splitId, subaccount) {
86
- return __awaiter(this, void 0, void 0, function* () {
87
- return yield this.http.request({
88
- url: `/split/${splitId}/subaccount/remove`,
89
- data: JSON.stringify({ subaccount }),
90
- method: 'post',
91
- });
66
+ async remove(splitId, subaccount) {
67
+ return await this.http.request({
68
+ url: `/split/${splitId}/subaccount/remove`,
69
+ data: JSON.stringify({ subaccount }),
70
+ method: 'post',
92
71
  });
93
72
  }
94
73
  }
@@ -1,38 +1,21 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.SubAccount = void 0;
13
4
  class SubAccount {
14
5
  constructor(http) {
15
6
  this.http = http;
16
7
  }
17
- create(data) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- return yield this.http.post('/subaccount', JSON.stringify(data));
20
- });
8
+ async create(data) {
9
+ return await this.http.post('/subaccount', JSON.stringify(data));
21
10
  }
22
- list(queryParams) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- return yield this.http.get('/subaccount', { params: Object.assign({}, queryParams) });
25
- });
11
+ async list(queryParams) {
12
+ return await this.http.get('/subaccount', { params: { ...queryParams } });
26
13
  }
27
- fetch(id) {
28
- return __awaiter(this, void 0, void 0, function* () {
29
- return yield this.http.get(`/subaccount/${id}`);
30
- });
14
+ async fetch(id) {
15
+ return await this.http.get(`/subaccount/${id}`);
31
16
  }
32
- update(id, data) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- return yield this.http.put(`/subaccount/${id}`, JSON.stringify(data));
35
- });
17
+ async update(id, data) {
18
+ return await this.http.put(`/subaccount/${id}`, JSON.stringify(data));
36
19
  }
37
20
  }
38
21
  exports.SubAccount = SubAccount;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];