@arbiwallet/contracts 1.0.210 → 1.0.211

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.
@@ -12,6 +12,22 @@ import { Struct } from "./google/protobuf/struct";
12
12
 
13
13
  export const protobufPackage = "exchange_core";
14
14
 
15
+ export enum ExchangeDealStatus {
16
+ EXCHANGE_DEAL_STATUS_UNSPECIFIED = 0,
17
+ EXCHANGE_DEAL_STATUS_NO_DEAL = 1,
18
+ EXCHANGE_DEAL_STATUS_IN_PROGRESS = 2,
19
+ EXCHANGE_DEAL_STATUS_COMPLETED = 3,
20
+ EXCHANGE_DEAL_STATUS_CANCELLED = 4,
21
+ UNRECOGNIZED = -1,
22
+ }
23
+
24
+ export enum ExchangeDealAction {
25
+ EXCHANGE_DEAL_ACTION_UNSPECIFIED = 0,
26
+ EXCHANGE_DEAL_ACTION_CREATE_DEAL = 1,
27
+ EXCHANGE_DEAL_ACTION_OPEN_DEAL = 2,
28
+ UNRECOGNIZED = -1,
29
+ }
30
+
15
31
  export interface CreateExchangeOrderRequest {
16
32
  inputAmount: number;
17
33
  outputAmount: number;
@@ -98,7 +114,7 @@ export interface GetExchangePaymentsResponse {
98
114
  }
99
115
 
100
116
  export interface CreateExchangeDealRequest {
101
- managerUserId?: string | undefined;
117
+ managerUserId: string;
102
118
  managerId?: string | undefined;
103
119
  calculationId?: string | undefined;
104
120
  paymentId?: string | undefined;
@@ -141,52 +157,259 @@ export interface CreateExchangeDealResponse {
141
157
  validationErrors?: { [key: string]: any } | undefined;
142
158
  }
143
159
 
160
+ export interface GetExchangeDealsRequest {
161
+ fromDate?: string | undefined;
162
+ toDate?: string | undefined;
163
+ manager?: number | undefined;
164
+ customer?: number | undefined;
165
+ page?: number | undefined;
166
+ pageSize?: number | undefined;
167
+ ordering?: string | undefined;
168
+ }
169
+
170
+ export interface GetExchangeDealsManager {
171
+ id: number;
172
+ email: string;
173
+ }
174
+
175
+ export interface GetExchangeDealsItem {
176
+ id: number;
177
+ customerId: number;
178
+ paymentId?: number | undefined;
179
+ inputAmount: number;
180
+ inputCurrencyId: number;
181
+ outputAmount: number;
182
+ outputCurrencyId: number;
183
+ factOutputAmount: number;
184
+ status: boolean;
185
+ exchangeStatusName: string;
186
+ calculationSourceId?: number | undefined;
187
+ manager?: GetExchangeDealsManager | undefined;
188
+ createdAt: string;
189
+ }
190
+
191
+ export interface GetExchangeDealsResponse {
192
+ count: number;
193
+ next?: string | undefined;
194
+ previous?: string | undefined;
195
+ results: GetExchangeDealsItem[];
196
+ }
197
+
198
+ export interface UpdateExchangeDealRequest {
199
+ id: number;
200
+ customerId?: number | undefined;
201
+ inputAmount?: number | undefined;
202
+ inputCurrencyId?: number | undefined;
203
+ inputWalletId?: number | undefined;
204
+ methodId?: number | undefined;
205
+ outputCurrencyId?: number | undefined;
206
+ outputAmount?: number | undefined;
207
+ factOutputAmount?: number | undefined;
208
+ outputWalletId?: number | undefined;
209
+ exchangeStatusId?: number | undefined;
210
+ payed?: boolean | undefined;
211
+ managerPersonId?: number | undefined;
212
+ exchangeRate1Iter?: number | undefined;
213
+ exchangeRate2Iter?: number | undefined;
214
+ usdtRate?: number | undefined;
215
+ includeInTotalCalculation?: boolean | undefined;
216
+ receipts: number[];
217
+ customerDocName?: string | undefined;
218
+ customerDocNationality?: string | undefined;
219
+ customerDocNumber?: string | undefined;
220
+ priorityManagerId?: number | undefined;
221
+ priorityOutcomeWalletId?: number | undefined;
222
+ }
223
+
224
+ export interface UpdateExchangeDealResult {
225
+ id: number;
226
+ customerId: number;
227
+ inputAmount: number;
228
+ inputCurrencyId: number;
229
+ outputAmount: number;
230
+ outputCurrencyId: number;
231
+ factOutputAmount: number;
232
+ exchangeStatusId: number;
233
+ payed: boolean;
234
+ includeInTotalCalculation: boolean;
235
+ }
236
+
237
+ export interface UpdateExchangeDealResponse {
238
+ ok: boolean;
239
+ result?: UpdateExchangeDealResult | undefined;
240
+ error?: string | undefined;
241
+ validationErrors?: { [key: string]: any } | undefined;
242
+ }
243
+
244
+ export interface CompleteExchangeDealRequest {
245
+ id: number;
246
+ }
247
+
248
+ export interface CompleteExchangeDealResponse {
249
+ success: boolean;
250
+ message?: string | undefined;
251
+ error?: string | undefined;
252
+ }
253
+
254
+ export interface CancelExchangeDealRequest {
255
+ id: number;
256
+ }
257
+
258
+ export interface CancelExchangeDealResponse {
259
+ success: boolean;
260
+ message?: string | undefined;
261
+ error?: string | undefined;
262
+ }
263
+
264
+ export interface GetExchangeDealStatesByCalculationIdsRequest {
265
+ calculationIds: string[];
266
+ }
267
+
268
+ export interface ExchangeDealStateByCalculation {
269
+ calculationId: string;
270
+ dealId?: number | undefined;
271
+ status: ExchangeDealStatus;
272
+ allowedActions: ExchangeDealAction[];
273
+ }
274
+
275
+ export interface GetExchangeDealStatesByCalculationIdsResponse {
276
+ items: ExchangeDealStateByCalculation[];
277
+ notFoundCalculationIds: string[];
278
+ }
279
+
280
+ export interface GetTransactionsRequest {
281
+ startDate?: string | undefined;
282
+ endDate?: string | undefined;
283
+ userId?: number | undefined;
284
+ currencyId?: number | undefined;
285
+ walletId?: number | undefined;
286
+ type?: number | undefined;
287
+ accountType?: number | undefined;
288
+ categoryId?: number | undefined;
289
+ businessUnitId?: number | undefined;
290
+ search?: string | undefined;
291
+ page?: number | undefined;
292
+ pageSize?: number | undefined;
293
+ }
294
+
295
+ export interface GetTransactionsSummaryItem {
296
+ currency: string;
297
+ totalIncome: number;
298
+ totalExpense: number;
299
+ }
300
+
301
+ export interface GetTransactionsItem {
302
+ id: number;
303
+ transactionDatetime: string;
304
+ createdAt: string;
305
+ amount: number;
306
+ currency?: string | undefined;
307
+ usdtAmount?: number | undefined;
308
+ status: boolean;
309
+ walletId?: number | undefined;
310
+ walletName?: string | undefined;
311
+ moveWalletId?: number | undefined;
312
+ moveWalletName?: string | undefined;
313
+ type: number;
314
+ typeName?: string | undefined;
315
+ categoryId?: number | undefined;
316
+ categoryName?: string | undefined;
317
+ businessUnitId?: number | undefined;
318
+ businessUnitName?: string | undefined;
319
+ name: string;
320
+ comment?: string | undefined;
321
+ exchangeId?: number | undefined;
322
+ exchangeUrl?: string | undefined;
323
+ userId?: number | undefined;
324
+ username?: string | undefined;
325
+ accountType: number;
326
+ }
327
+
328
+ export interface GetTransactionsResponse {
329
+ count: number;
330
+ next?: string | undefined;
331
+ previous?: string | undefined;
332
+ results: GetTransactionsItem[];
333
+ summary: GetTransactionsSummaryItem[];
334
+ }
335
+
144
336
  export const EXCHANGE_CORE_PACKAGE_NAME = "exchange_core";
145
337
 
146
338
  wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any;
147
339
 
340
+ /**
341
+ * rpc CreateExchangePayment(CreateExchangePaymentRequest) returns (CreateExchangePaymentResponse);
342
+ * rpc HandlePaymentWebhook(HandlePaymentWebhookRequest) returns (HandlePaymentWebhookResponse);
343
+ * rpc GetExchangePayments(GetExchangePaymentsRequest) returns (GetExchangePaymentsResponse);
344
+ */
345
+
148
346
  export interface ExchangeCoreServiceClient {
149
- createExchangeOrder(request: CreateExchangeOrderRequest): Observable<CreateExchangeOrderResponse>;
347
+ createExchangeDeal(request: CreateExchangeDealRequest): Observable<CreateExchangeDealResponse>;
150
348
 
151
- createExchangePayment(request: CreateExchangePaymentRequest): Observable<CreateExchangePaymentResponse>;
349
+ getExchangeDeals(request: GetExchangeDealsRequest): Observable<GetExchangeDealsResponse>;
152
350
 
153
- handlePaymentWebhook(request: HandlePaymentWebhookRequest): Observable<HandlePaymentWebhookResponse>;
351
+ updateExchangeDeal(request: UpdateExchangeDealRequest): Observable<UpdateExchangeDealResponse>;
154
352
 
155
- getExchangePayments(request: GetExchangePaymentsRequest): Observable<GetExchangePaymentsResponse>;
353
+ completeExchangeDeal(request: CompleteExchangeDealRequest): Observable<CompleteExchangeDealResponse>;
156
354
 
157
- createExchangeDeal(request: CreateExchangeDealRequest): Observable<CreateExchangeDealResponse>;
158
- }
355
+ cancelExchangeDeal(request: CancelExchangeDealRequest): Observable<CancelExchangeDealResponse>;
159
356
 
160
- export interface ExchangeCoreServiceController {
161
- createExchangeOrder(
162
- request: CreateExchangeOrderRequest,
163
- ): Promise<CreateExchangeOrderResponse> | Observable<CreateExchangeOrderResponse> | CreateExchangeOrderResponse;
357
+ getExchangeDealStatesByCalculationIds(
358
+ request: GetExchangeDealStatesByCalculationIdsRequest,
359
+ ): Observable<GetExchangeDealStatesByCalculationIdsResponse>;
164
360
 
165
- createExchangePayment(
166
- request: CreateExchangePaymentRequest,
167
- ): Promise<CreateExchangePaymentResponse> | Observable<CreateExchangePaymentResponse> | CreateExchangePaymentResponse;
168
-
169
- handlePaymentWebhook(
170
- request: HandlePaymentWebhookRequest,
171
- ): Promise<HandlePaymentWebhookResponse> | Observable<HandlePaymentWebhookResponse> | HandlePaymentWebhookResponse;
361
+ getTransactions(request: GetTransactionsRequest): Observable<GetTransactionsResponse>;
362
+ }
172
363
 
173
- getExchangePayments(
174
- request: GetExchangePaymentsRequest,
175
- ): Promise<GetExchangePaymentsResponse> | Observable<GetExchangePaymentsResponse> | GetExchangePaymentsResponse;
364
+ /**
365
+ * rpc CreateExchangePayment(CreateExchangePaymentRequest) returns (CreateExchangePaymentResponse);
366
+ * rpc HandlePaymentWebhook(HandlePaymentWebhookRequest) returns (HandlePaymentWebhookResponse);
367
+ * rpc GetExchangePayments(GetExchangePaymentsRequest) returns (GetExchangePaymentsResponse);
368
+ */
176
369
 
370
+ export interface ExchangeCoreServiceController {
177
371
  createExchangeDeal(
178
372
  request: CreateExchangeDealRequest,
179
373
  ): Promise<CreateExchangeDealResponse> | Observable<CreateExchangeDealResponse> | CreateExchangeDealResponse;
374
+
375
+ getExchangeDeals(
376
+ request: GetExchangeDealsRequest,
377
+ ): Promise<GetExchangeDealsResponse> | Observable<GetExchangeDealsResponse> | GetExchangeDealsResponse;
378
+
379
+ updateExchangeDeal(
380
+ request: UpdateExchangeDealRequest,
381
+ ): Promise<UpdateExchangeDealResponse> | Observable<UpdateExchangeDealResponse> | UpdateExchangeDealResponse;
382
+
383
+ completeExchangeDeal(
384
+ request: CompleteExchangeDealRequest,
385
+ ): Promise<CompleteExchangeDealResponse> | Observable<CompleteExchangeDealResponse> | CompleteExchangeDealResponse;
386
+
387
+ cancelExchangeDeal(
388
+ request: CancelExchangeDealRequest,
389
+ ): Promise<CancelExchangeDealResponse> | Observable<CancelExchangeDealResponse> | CancelExchangeDealResponse;
390
+
391
+ getExchangeDealStatesByCalculationIds(
392
+ request: GetExchangeDealStatesByCalculationIdsRequest,
393
+ ):
394
+ | Promise<GetExchangeDealStatesByCalculationIdsResponse>
395
+ | Observable<GetExchangeDealStatesByCalculationIdsResponse>
396
+ | GetExchangeDealStatesByCalculationIdsResponse;
397
+
398
+ getTransactions(
399
+ request: GetTransactionsRequest,
400
+ ): Promise<GetTransactionsResponse> | Observable<GetTransactionsResponse> | GetTransactionsResponse;
180
401
  }
181
402
 
182
403
  export function ExchangeCoreServiceControllerMethods() {
183
404
  return function (constructor: Function) {
184
405
  const grpcMethods: string[] = [
185
- "createExchangeOrder",
186
- "createExchangePayment",
187
- "handlePaymentWebhook",
188
- "getExchangePayments",
189
406
  "createExchangeDeal",
407
+ "getExchangeDeals",
408
+ "updateExchangeDeal",
409
+ "completeExchangeDeal",
410
+ "cancelExchangeDeal",
411
+ "getExchangeDealStatesByCalculationIds",
412
+ "getTransactions",
190
413
  ];
191
414
  for (const method of grpcMethods) {
192
415
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arbiwallet/contracts",
3
3
  "descriptions": "Generate and manage smart contracts for ArbiWallet",
4
- "version": "1.0.210",
4
+ "version": "1.0.211",
5
5
  "scripts": {
6
6
  "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
7
7
  },
@@ -9,13 +9,19 @@ option java_multiple_files = true;
9
9
  option java_package = "com.arbiwallet.exchange.core";
10
10
 
11
11
  service ExchangeCoreService {
12
- rpc CreateExchangeOrder(CreateExchangeOrderRequest) returns (CreateExchangeOrderResponse);
13
-
14
- rpc CreateExchangePayment(CreateExchangePaymentRequest) returns (CreateExchangePaymentResponse);
15
- rpc HandlePaymentWebhook(HandlePaymentWebhookRequest) returns (HandlePaymentWebhookResponse);
16
- rpc GetExchangePayments(GetExchangePaymentsRequest) returns (GetExchangePaymentsResponse);
17
-
12
+ // rpc CreateExchangePayment(CreateExchangePaymentRequest) returns (CreateExchangePaymentResponse);
13
+ // rpc HandlePaymentWebhook(HandlePaymentWebhookRequest) returns (HandlePaymentWebhookResponse);
14
+ // rpc GetExchangePayments(GetExchangePaymentsRequest) returns (GetExchangePaymentsResponse);
15
+
18
16
  rpc CreateExchangeDeal(CreateExchangeDealRequest) returns (CreateExchangeDealResponse);
17
+ rpc GetExchangeDeals(GetExchangeDealsRequest) returns (GetExchangeDealsResponse);
18
+ rpc UpdateExchangeDeal(UpdateExchangeDealRequest) returns (UpdateExchangeDealResponse);
19
+ rpc CompleteExchangeDeal(CompleteExchangeDealRequest) returns (CompleteExchangeDealResponse);
20
+ rpc CancelExchangeDeal(CancelExchangeDealRequest) returns (CancelExchangeDealResponse);
21
+
22
+ rpc GetExchangeDealStatesByCalculationIds(GetExchangeDealStatesByCalculationIdsRequest) returns (GetExchangeDealStatesByCalculationIdsResponse);
23
+
24
+ rpc GetTransactions(GetTransactionsRequest) returns (GetTransactionsResponse);
19
25
  }
20
26
 
21
27
  message CreateExchangeOrderRequest {
@@ -105,7 +111,7 @@ message GetExchangePaymentsResponse {
105
111
  }
106
112
 
107
113
  message CreateExchangeDealRequest {
108
- optional string manager_user_id = 1;
114
+ string manager_user_id = 1;
109
115
  optional string manager_id = 2;
110
116
 
111
117
  optional string calculation_id = 3;
@@ -156,3 +162,195 @@ message CreateExchangeDealResponse {
156
162
  optional string error = 3;
157
163
  optional google.protobuf.Struct validationErrors = 4;
158
164
  }
165
+
166
+ message GetExchangeDealsRequest {
167
+ optional string from_date = 1;
168
+ optional string to_date = 2;
169
+ optional int32 manager = 3;
170
+ optional int32 customer = 4;
171
+ optional int32 page = 5;
172
+ optional int32 page_size = 6;
173
+ optional string ordering = 7;
174
+ }
175
+
176
+ message GetExchangeDealsManager {
177
+ int32 id = 1;
178
+ string email = 2;
179
+ }
180
+
181
+ message GetExchangeDealsItem {
182
+ int32 id = 1;
183
+ int32 customer_id = 2;
184
+ optional int32 payment_id = 3;
185
+ double input_amount = 4;
186
+ int32 input_currency_id = 5;
187
+ double output_amount = 6;
188
+ int32 output_currency_id = 7;
189
+ double fact_output_amount = 8;
190
+ bool status = 9;
191
+ string exchange_status_name = 10;
192
+ optional int32 calculation_source_id = 11;
193
+ optional GetExchangeDealsManager manager = 12;
194
+ string created_at = 13;
195
+ }
196
+
197
+ message GetExchangeDealsResponse {
198
+ int32 count = 1;
199
+ optional string next = 2;
200
+ optional string previous = 3;
201
+ repeated GetExchangeDealsItem results = 4;
202
+ }
203
+
204
+ message UpdateExchangeDealRequest {
205
+ int32 id = 1;
206
+
207
+ optional int32 customer_id = 2;
208
+ optional double input_amount = 3;
209
+ optional int32 input_currency_id = 4;
210
+ optional int32 input_wallet_id = 5;
211
+ optional int32 method_id = 6;
212
+ optional int32 output_currency_id = 7;
213
+ optional double output_amount = 8;
214
+ optional double fact_output_amount = 9;
215
+ optional int32 output_wallet_id = 10;
216
+ optional int32 exchange_status_id = 11;
217
+ optional bool payed = 12;
218
+ optional int32 manager_person_id = 13;
219
+ optional double exchange_rate_1_iter = 14;
220
+ optional double exchange_rate_2_iter = 15;
221
+ optional double usdt_rate = 16;
222
+ optional bool include_in_total_calculation = 17;
223
+
224
+ repeated double receipts = 18;
225
+ optional string customer_doc_name = 19;
226
+ optional string customer_doc_nationality = 20;
227
+ optional string customer_doc_number = 21;
228
+ optional int32 priority_manager_id = 22;
229
+ optional int32 priority_outcome_wallet_id = 23;
230
+ }
231
+
232
+ message UpdateExchangeDealResult {
233
+ int32 id = 1;
234
+ int32 customer_id = 2;
235
+ double input_amount = 3;
236
+ int32 input_currency_id = 4;
237
+ double output_amount = 5;
238
+ int32 output_currency_id = 6;
239
+ double fact_output_amount = 7;
240
+ int32 exchange_status_id = 8;
241
+ bool payed = 9;
242
+ bool include_in_total_calculation = 10;
243
+ }
244
+
245
+ message UpdateExchangeDealResponse {
246
+ bool ok = 1;
247
+ optional UpdateExchangeDealResult result = 2;
248
+ optional string error = 3;
249
+ optional google.protobuf.Struct validationErrors = 4;
250
+ }
251
+
252
+ message CompleteExchangeDealRequest {
253
+ int32 id = 1;
254
+ }
255
+
256
+ message CompleteExchangeDealResponse {
257
+ bool success = 1;
258
+ optional string message = 2;
259
+ optional string error = 3;
260
+ }
261
+
262
+ message CancelExchangeDealRequest {
263
+ int32 id = 1;
264
+ }
265
+
266
+ message CancelExchangeDealResponse {
267
+ bool success = 1;
268
+ optional string message = 2;
269
+ optional string error = 3;
270
+ }
271
+
272
+ message GetExchangeDealStatesByCalculationIdsRequest {
273
+ repeated string calculation_ids = 1;
274
+ }
275
+
276
+ enum ExchangeDealStatus {
277
+ EXCHANGE_DEAL_STATUS_UNSPECIFIED = 0;
278
+ EXCHANGE_DEAL_STATUS_NO_DEAL = 1;
279
+ EXCHANGE_DEAL_STATUS_IN_PROGRESS = 2;
280
+ EXCHANGE_DEAL_STATUS_COMPLETED = 3;
281
+ EXCHANGE_DEAL_STATUS_CANCELLED = 4;
282
+ }
283
+
284
+ enum ExchangeDealAction {
285
+ EXCHANGE_DEAL_ACTION_UNSPECIFIED = 0;
286
+ EXCHANGE_DEAL_ACTION_CREATE_DEAL = 1;
287
+ EXCHANGE_DEAL_ACTION_OPEN_DEAL = 2;
288
+ }
289
+
290
+ message ExchangeDealStateByCalculation {
291
+ string calculation_id = 1;
292
+ optional int32 deal_id = 2;
293
+ ExchangeDealStatus status = 3;
294
+ repeated ExchangeDealAction allowed_actions = 4;
295
+ }
296
+
297
+ message GetExchangeDealStatesByCalculationIdsResponse {
298
+ repeated ExchangeDealStateByCalculation items = 1;
299
+ repeated string not_found_calculation_ids = 2;
300
+ }
301
+
302
+ message GetTransactionsRequest {
303
+ optional string start_date = 1;
304
+ optional string end_date = 2;
305
+ optional int32 user_id = 3;
306
+ optional int32 currency_id = 4;
307
+ optional int32 wallet_id = 5;
308
+ optional int32 type = 6;
309
+ optional int32 account_type = 7;
310
+ optional int32 category_id = 8;
311
+ optional int32 business_unit_id = 9;
312
+ optional string search = 10;
313
+ optional int32 page = 11;
314
+ optional int32 page_size = 12;
315
+ }
316
+
317
+ message GetTransactionsSummaryItem {
318
+ string currency = 1;
319
+ double total_income = 2;
320
+ double total_expense = 3;
321
+ }
322
+
323
+ message GetTransactionsItem {
324
+ int32 id = 1;
325
+ string transaction_datetime = 2;
326
+ string created_at = 3;
327
+ double amount = 4;
328
+ optional string currency = 5;
329
+ optional double usdt_amount = 6;
330
+ bool status = 7;
331
+ optional int32 wallet_id = 8;
332
+ optional string wallet_name = 9;
333
+ optional int32 move_wallet_id = 10;
334
+ optional string move_wallet_name = 11;
335
+ int32 type = 12;
336
+ optional string type_name = 13;
337
+ optional int32 category_id = 14;
338
+ optional string category_name = 15;
339
+ optional int32 business_unit_id = 16;
340
+ optional string business_unit_name = 17;
341
+ string name = 18;
342
+ optional string comment = 19;
343
+ optional int32 exchange_id = 20;
344
+ optional string exchange_url = 21;
345
+ optional int32 user_id = 22;
346
+ optional string username = 23;
347
+ int32 account_type = 24;
348
+ }
349
+
350
+ message GetTransactionsResponse {
351
+ int32 count = 1;
352
+ optional string next = 2;
353
+ optional string previous = 3;
354
+ repeated GetTransactionsItem results = 4;
355
+ repeated GetTransactionsSummaryItem summary = 5;
356
+ }