@wenex/sdk 0.8.1 → 0.8.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,6 +1,6 @@
1
1
  import type { Document } from 'mongoose';
2
2
  import { Pay, PayDto } from './common';
3
- import { Core, Dto, Properties } from '../common';
3
+ import { Core, Dto, MakeOptional, Properties } from '../common';
4
4
  import { TransactionReason, TransactionState, TransactionType } from '../../enums';
5
5
  export interface Transaction<Props extends Properties = Properties> extends Core<Props> {
6
6
  type: TransactionType;
@@ -9,8 +9,10 @@ export interface Transaction<Props extends Properties = Properties> extends Core
9
9
  amount: number;
10
10
  payees?: Pay[];
11
11
  payers?: Pay[];
12
+ failed_at?: Date;
12
13
  verified_at?: Date;
13
14
  canceled_at?: Date;
15
+ rollbacked_at?: Date;
14
16
  invoice?: string;
15
17
  }
16
18
  export type TransactionDoc = Transaction & Document;
@@ -18,3 +20,4 @@ export type TransactionDto = Dto<Omit<Transaction, 'payers' | 'payees'>> & {
18
20
  payees?: PayDto[];
19
21
  payers?: PayDto[];
20
22
  };
23
+ export type TransactionInitDto = MakeOptional<TransactionDto, 'state' | 'failed_at' | 'verified_at' | 'canceled_at' | 'rollbacked_at'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wenex/sdk",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Wenex SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,7 +1,10 @@
1
1
  import type { AxiosInstance } from 'axios';
2
- import { RestfulService } from '../../common/classes';
3
- import { Transaction, TransactionDto } from '../../common/interfaces';
2
+ import { Serializer, Transaction, TransactionDto, TransactionInitDto } from '../../common/interfaces';
3
+ import { RequestConfig, RestfulService } from '../../common/classes';
4
4
  export declare class TransactionsService extends RestfulService<Transaction, TransactionDto> {
5
5
  protected axios: AxiosInstance;
6
6
  constructor(axios: AxiosInstance);
7
+ init(data: TransactionInitDto, config?: RequestConfig<Transaction>): Promise<Serializer<Transaction>>;
8
+ abort(id: string, config?: RequestConfig<Transaction>): Promise<Serializer<Transaction>>;
9
+ verify(id: string, config?: RequestConfig<Transaction>): Promise<Serializer<Transaction>>;
7
10
  }
@@ -1,4 +1,13 @@
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.TransactionsService = void 0;
4
13
  const classes_1 = require("../../common/classes");
@@ -7,6 +16,21 @@ class TransactionsService extends classes_1.RestfulService {
7
16
  super('transactions', axios);
8
17
  this.axios = axios;
9
18
  }
19
+ init(data, config) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ return (yield this.post(this.url('init'), data, config)).data;
22
+ });
23
+ }
24
+ abort(id, config) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return (yield this.patch(this.url(`${id}/abort`), undefined, config)).data;
27
+ });
28
+ }
29
+ verify(id, config) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ return (yield this.patch(this.url(`${id}/verify`), undefined, config)).data;
32
+ });
33
+ }
10
34
  }
11
35
  exports.TransactionsService = TransactionsService;
12
36
  //# sourceMappingURL=transactions.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactions.service.js","sourceRoot":"","sources":["../../src/services/financial/transactions.service.ts"],"names":[],"mappings":";;;AAGA,kDAAsD;AAGtD,MAAa,mBAAoB,SAAQ,wBAA2C;IAClF,YAAsB,KAAoB;QACxC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QADT,UAAK,GAAL,KAAK,CAAe;IAE1C,CAAC;CACF;AAJD,kDAIC"}
1
+ {"version":3,"file":"transactions.service.js","sourceRoot":"","sources":["../../src/services/financial/transactions.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,kDAAqE;AAErE,MAAa,mBAAoB,SAAQ,wBAA2C;IAClF,YAAsB,KAAoB;QACxC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QADT,UAAK,GAAL,KAAK,CAAe;IAE1C,CAAC;IAEK,IAAI,CACR,IAAwB,EACxB,MAAmC;;YAEnC,OAAO,CACL,MAAM,IAAI,CAAC,IAAI,CACb,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAChB,IAAI,EACJ,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;IAEK,KAAK,CACT,EAAU,EACV,MAAmC;;YAEnC,OAAO,CACL,MAAM,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,EACvB,SAAS,EACT,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;IAEK,MAAM,CACV,EAAU,EACV,MAAmC;;YAEnC,OAAO,CACL,MAAM,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,EACxB,SAAS,EACT,MAAM,CACP,CACF,CAAC,IAAI,CAAC;QACT,CAAC;KAAA;CACF;AA3CD,kDA2CC"}
@@ -1,17 +0,0 @@
1
- export declare enum SagaHistoryFn {
2
- Count = "count",
3
- Create = "create",
4
- CreateBulk = "create-bulk",
5
- Find = "find",
6
- FindOne = "find-one",
7
- FindById = "find-by-id",
8
- DeleteOne = "delete-one",
9
- DeleteById = "delete-by-id",
10
- RestoreOne = "restore-one",
11
- RestoreById = "restore-by-id",
12
- DestroyOne = "destroy-one",
13
- DestroyById = "destroy-by-id",
14
- UpdateOne = "update-one",
15
- UpdateById = "update-by-id",
16
- UpdateBulk = "update-bulk"
17
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SagaHistoryFn = void 0;
4
- var SagaHistoryFn;
5
- (function (SagaHistoryFn) {
6
- SagaHistoryFn["Count"] = "count";
7
- SagaHistoryFn["Create"] = "create";
8
- SagaHistoryFn["CreateBulk"] = "create-bulk";
9
- SagaHistoryFn["Find"] = "find";
10
- SagaHistoryFn["FindOne"] = "find-one";
11
- SagaHistoryFn["FindById"] = "find-by-id";
12
- SagaHistoryFn["DeleteOne"] = "delete-one";
13
- SagaHistoryFn["DeleteById"] = "delete-by-id";
14
- SagaHistoryFn["RestoreOne"] = "restore-one";
15
- SagaHistoryFn["RestoreById"] = "restore-by-id";
16
- SagaHistoryFn["DestroyOne"] = "destroy-one";
17
- SagaHistoryFn["DestroyById"] = "destroy-by-id";
18
- SagaHistoryFn["UpdateOne"] = "update-one";
19
- SagaHistoryFn["UpdateById"] = "update-by-id";
20
- SagaHistoryFn["UpdateBulk"] = "update-bulk";
21
- })(SagaHistoryFn || (exports.SagaHistoryFn = SagaHistoryFn = {}));
22
- //# sourceMappingURL=fn.enum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fn.enum.js","sourceRoot":"","sources":["../../../../../src/common/enums/special/sagas/histories/fn.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAqBX;AArBD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,kCAAiB,CAAA;IACjB,2CAA0B,CAAA;IAE1B,8BAAa,CAAA;IACb,qCAAoB,CAAA;IACpB,wCAAuB,CAAA;IAEvB,yCAAwB,CAAA;IACxB,4CAA2B,CAAA;IAE3B,2CAA0B,CAAA;IAC1B,8CAA6B,CAAA;IAE7B,2CAA0B,CAAA;IAC1B,8CAA6B,CAAA;IAE7B,yCAAwB,CAAA;IACxB,4CAA2B,CAAA;IAC3B,2CAA0B,CAAA;AAC5B,CAAC,EArBW,aAAa,6BAAb,aAAa,QAqBxB"}