ggez-banking-sdk 0.3.28 → 0.3.30

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.
@@ -18,12 +18,12 @@ declare class PromotionClient extends BaseClient {
18
18
  data: BaseResult;
19
19
  success: boolean;
20
20
  message: string;
21
- error: null;
21
+ error: string;
22
22
  } | {
23
- data: BaseResult;
23
+ data: string[];
24
24
  success: boolean;
25
25
  message: string;
26
- error: string;
26
+ error: null;
27
27
  }>;
28
28
  incrementPromotionParticipants: (data: GGEZGiftRewards, options?: RequestOptions) => Promise<{
29
29
  data: {
@@ -29,7 +29,7 @@ class PromotionClient extends BaseClient {
29
29
  getTwitterSpotlightPostIds = async (options) => {
30
30
  try {
31
31
  const response = await this.promotionService.getTwitterSpotlightPostIds(options);
32
- return this.responseHelper.getResponse(response);
32
+ return { data: response.data, success: true, message: "", error: null };
33
33
  }
34
34
  catch (error) {
35
35
  const result = fillResultByError(error);
@@ -1,4 +1,4 @@
1
- import type { ErrorHandler, IInquiryTransactionData, TransactionClientData, RequestOptions, ICreateSystemTransactionData, ICreateGatewayCryptoTransactionData, ICreateBlockchainTransactionData } from "../../types";
1
+ import type { ErrorHandler, IInquiryTransactionData, TransactionClientData, RequestOptions, ICreateSystemTransactionData, ICreateGatewayCryptoTransactionData, ICreateBlockchainTransactionData, ICreateBlockchainTransferTransactionData } from "../../types";
2
2
  import { BaseClient } from "./base";
3
3
  declare class TransactionClient extends BaseClient {
4
4
  private transactionService;
@@ -36,6 +36,17 @@ declare class TransactionClient extends BaseClient {
36
36
  message: string;
37
37
  error: string;
38
38
  }>;
39
+ createBlockchainTransferTransaction: (data: ICreateBlockchainTransferTransactionData, options?: RequestOptions) => Promise<{
40
+ data: import("../..").TransactionData;
41
+ success: boolean;
42
+ message: string;
43
+ error: null;
44
+ } | {
45
+ data: import("../..").TransactionData;
46
+ success: boolean;
47
+ message: string;
48
+ error: string;
49
+ }>;
39
50
  createGatewayCryptoTransaction: (data: ICreateGatewayCryptoTransactionData, options?: RequestOptions) => Promise<{
40
51
  data: import("../..").TransactionData;
41
52
  success: boolean;
@@ -1,5 +1,5 @@
1
1
  import { AxiosHelper } from "../../helper/api/axiosHelper";
2
- import { fillCreateBlockchainTransactionData, fillCreateGatewayCryptoTransactionData, fillCreateSystemTransactionData, fillResultByError, createDefaultTransactionData, createDefaultTransactionInquiryResultData, fillTransactionInquiryData, } from "../data";
2
+ import { fillCreateBlockchainTransactionData, fillCreateGatewayCryptoTransactionData, fillCreateSystemTransactionData, fillResultByError, createDefaultTransactionData, createDefaultTransactionInquiryResultData, fillTransactionInquiryData, fillCreateBlockchainTransferTransactionData, } from "../data";
3
3
  import { TransactionService } from "../services";
4
4
  import { BaseClient } from "./base";
5
5
  class TransactionClient extends BaseClient {
@@ -49,6 +49,18 @@ class TransactionClient extends BaseClient {
49
49
  return this.responseHelper.getErrorResponse(transactionData, "createBlockchainTransaction");
50
50
  }
51
51
  };
52
+ createBlockchainTransferTransaction = async (data, options) => {
53
+ try {
54
+ const transactionData = fillCreateBlockchainTransferTransactionData(data);
55
+ const response = await this.transactionService.create(transactionData, options);
56
+ return this.responseHelper.getResponse(response.data);
57
+ }
58
+ catch (error) {
59
+ const result = fillResultByError(error);
60
+ const transactionData = createDefaultTransactionData({ result });
61
+ return this.responseHelper.getErrorResponse(transactionData, "createBlockchainTransferTransaction");
62
+ }
63
+ };
52
64
  createGatewayCryptoTransaction = async (data, options) => {
53
65
  try {
54
66
  const transactionData = fillCreateGatewayCryptoTransactionData(data);
@@ -1,9 +1,10 @@
1
- import type { ICreateBlockchainTransactionData, ICreateGatewayCryptoTransactionData, ICreateSystemTransactionData, IInquiryTransactionData, TransactionResultInquiry } from "../../types";
1
+ import type { ICreateBlockchainTransactionData, ICreateBlockchainTransferTransactionData, ICreateGatewayCryptoTransactionData, ICreateSystemTransactionData, IInquiryTransactionData, TransactionResultInquiry } from "../../types";
2
2
  import type { TransactionData, TransactionInquiry } from "../../types";
3
3
  declare const createDefaultTransactionData: (overrides?: Partial<TransactionData>) => TransactionData;
4
4
  declare const createDefaultTransactionInquiryResultData: (overrides?: Partial<TransactionResultInquiry>) => TransactionResultInquiry;
5
5
  declare const fillTransactionInquiryData: (data: IInquiryTransactionData) => TransactionInquiry;
6
6
  declare const fillCreateBlockchainTransactionData: (data: ICreateBlockchainTransactionData) => TransactionData;
7
+ declare const fillCreateBlockchainTransferTransactionData: (data: ICreateBlockchainTransferTransactionData) => TransactionData;
7
8
  declare const fillCreateGatewayCryptoTransactionData: (data: ICreateGatewayCryptoTransactionData) => TransactionData;
8
9
  declare const fillCreateSystemTransactionData: (data: ICreateSystemTransactionData) => TransactionData;
9
- export { createDefaultTransactionData, createDefaultTransactionInquiryResultData, fillTransactionInquiryData, fillCreateSystemTransactionData, fillCreateGatewayCryptoTransactionData, fillCreateBlockchainTransactionData, };
10
+ export { createDefaultTransactionData, createDefaultTransactionInquiryResultData, fillTransactionInquiryData, fillCreateSystemTransactionData, fillCreateGatewayCryptoTransactionData, fillCreateBlockchainTransactionData, fillCreateBlockchainTransferTransactionData, };
@@ -99,7 +99,6 @@ const fillCreateBlockchainTransactionData = (data) => {
99
99
  amount: data.amount,
100
100
  currency: data.currency,
101
101
  notes: data.note,
102
- wire_transfer_type: data.wireTransferType,
103
102
  request_id: data?.requestId,
104
103
  },
105
104
  account: {
@@ -121,6 +120,47 @@ const fillCreateBlockchainTransactionData = (data) => {
121
120
  };
122
121
  return transactionData;
123
122
  };
123
+ const fillCreateBlockchainTransferTransactionData = (data) => {
124
+ const transactionData = {
125
+ info: {
126
+ type: data.type,
127
+ amount: data.amount,
128
+ currency: data.currency,
129
+ notes: data.note,
130
+ },
131
+ account: {
132
+ info: {
133
+ id: data.accountId,
134
+ },
135
+ },
136
+ transfer: {
137
+ account_info: {
138
+ chain_address: data?.receiverChainAddress,
139
+ },
140
+ },
141
+ validate: data.validate,
142
+ };
143
+ return transactionData;
144
+ };
145
+ // {
146
+ // "info": {
147
+ // "currency": "GBPV",
148
+ // "type": "208",
149
+ // "amount": "10",
150
+ // "note": "Test Transfer"
151
+ // },
152
+ // "account": {
153
+ // "info": {
154
+ // "id": 21859
155
+ // }
156
+ // },
157
+ // "transfer": {
158
+ // "account_info": {
159
+ // "chain_address": "vvtx1vrw6qxw4lnlwrwqws7aanxlg06ayaj7u7fq6cj"
160
+ // }
161
+ // },
162
+ // "validate": 0
163
+ // }
124
164
  const fillCreateGatewayCryptoTransactionData = (data) => {
125
165
  return createDefaultTransactionData({
126
166
  info: {
@@ -165,4 +205,4 @@ const fillCreateSystemTransactionData = (data) => {
165
205
  };
166
206
  return transactionData;
167
207
  };
168
- export { createDefaultTransactionData, createDefaultTransactionInquiryResultData, fillTransactionInquiryData, fillCreateSystemTransactionData, fillCreateGatewayCryptoTransactionData, fillCreateBlockchainTransactionData, };
208
+ export { createDefaultTransactionData, createDefaultTransactionInquiryResultData, fillTransactionInquiryData, fillCreateSystemTransactionData, fillCreateGatewayCryptoTransactionData, fillCreateBlockchainTransactionData, fillCreateBlockchainTransferTransactionData, };
@@ -17,12 +17,20 @@ interface ICreateBlockchainTransactionData {
17
17
  accountId: number;
18
18
  validate: string;
19
19
  bankId?: number;
20
- wireTransferType?: number;
21
20
  requestId?: number;
22
21
  blockchainHash?: string;
23
22
  blockchainNetworkId?: number;
24
23
  blockchainAccountId?: number;
25
24
  }
25
+ interface ICreateBlockchainTransferTransactionData {
26
+ type: number;
27
+ amount: number;
28
+ currency: string;
29
+ note: string;
30
+ accountId: number;
31
+ validate: string;
32
+ receiverChainAddress: string;
33
+ }
26
34
  interface ICreateSystemTransactionData {
27
35
  type: number;
28
36
  amount: number;
@@ -46,4 +54,4 @@ interface ICreateGatewayCryptoTransactionData {
46
54
  bankSortCode: string;
47
55
  bankAccountType: number;
48
56
  }
49
- export type { IInquiryTransactionData, ICreateSystemTransactionData, ICreateBlockchainTransactionData, ICreateGatewayCryptoTransactionData, };
57
+ export type { IInquiryTransactionData, ICreateSystemTransactionData, ICreateBlockchainTransactionData, ICreateBlockchainTransferTransactionData, ICreateGatewayCryptoTransactionData, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ggez-banking-sdk",
3
- "version": "0.3.28",
3
+ "version": "0.3.30",
4
4
  "description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",