react-memory-optimization 0.0.82 → 0.0.84

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.
@@ -8,8 +8,8 @@ exports.PAYMENT_REQUEST_PATHS = {
8
8
  path: types_1.EApiPath.FlashPayUpiDepositCreate,
9
9
  adapterFn: utils_1.upiFlashPayRestAdapterDeposit,
10
10
  },
11
- [types_1.EPaymentRequestPath.FlashPayUpiWithdraw]: {
11
+ [types_1.EPaymentRequestPath.FlashPayImpusWithdraw]: {
12
12
  path: types_1.EApiPath.FlashPayUpiWithdrawCreate,
13
- adapterFn: utils_1.upiFlashPayRestAdapterDeposit,
13
+ adapterFn: utils_1.impusFlashPayRestAdapterWithdraw,
14
14
  },
15
15
  };
@@ -1,7 +1,7 @@
1
1
  export declare enum EApiPath {
2
2
  AccrualHistory = "/ref_service/api/v1/client/accural_bonus",
3
3
  FlashPayUpiDepositCreate = "/pay-service-dev/api/v2/deposit/create",
4
- FlashPayUpiWithdrawCreate = "/pay-service-dev/api/v2/withdraw/create"
4
+ FlashPayUpiWithdrawCreate = "/pay-service-dev/api/v2/withdrawal/create"
5
5
  }
6
6
  export type RestCommandDataProps = {
7
7
  [key: string]: string | number | any[];
@@ -13,7 +13,7 @@ export declare enum EValidationCommandDataProps {
13
13
  export declare enum EPaymentRequestPath {
14
14
  Unknown = "",
15
15
  FlashPayUpiDeposit = "flash_pay_upi_deposit",
16
- FlashPayUpiWithdraw = "flash_pay_impus_withdraw"
16
+ FlashPayImpusWithdraw = "flash_pay_impus_withdraw"
17
17
  }
18
18
  export type ApiList = {
19
19
  [key: string]: {
@@ -40,3 +40,8 @@ export type ResponseFlashPayUpiDeposit = {
40
40
  upi_paytm: string;
41
41
  };
42
42
  };
43
+ export type ResponseFlashPayUpiWithdraw = {
44
+ status: keyof typeof EFlashPayStatusCode;
45
+ code: string;
46
+ postponed: boolean;
47
+ };
@@ -5,7 +5,7 @@ var EApiPath;
5
5
  (function (EApiPath) {
6
6
  EApiPath["AccrualHistory"] = "/ref_service/api/v1/client/accural_bonus";
7
7
  EApiPath["FlashPayUpiDepositCreate"] = "/pay-service-dev/api/v2/deposit/create";
8
- EApiPath["FlashPayUpiWithdrawCreate"] = "/pay-service-dev/api/v2/withdraw/create";
8
+ EApiPath["FlashPayUpiWithdrawCreate"] = "/pay-service-dev/api/v2/withdrawal/create";
9
9
  })(EApiPath || (exports.EApiPath = EApiPath = {}));
10
10
  var EValidationCommandDataProps;
11
11
  (function (EValidationCommandDataProps) {
@@ -16,7 +16,7 @@ var EPaymentRequestPath;
16
16
  (function (EPaymentRequestPath) {
17
17
  EPaymentRequestPath["Unknown"] = "";
18
18
  EPaymentRequestPath["FlashPayUpiDeposit"] = "flash_pay_upi_deposit";
19
- EPaymentRequestPath["FlashPayUpiWithdraw"] = "flash_pay_impus_withdraw";
19
+ EPaymentRequestPath["FlashPayImpusWithdraw"] = "flash_pay_impus_withdraw";
20
20
  })(EPaymentRequestPath || (exports.EPaymentRequestPath = EPaymentRequestPath = {}));
21
21
  // FlashPayUpiDeposit
22
22
  var EFlashPayStatusCode;
@@ -1,6 +1,10 @@
1
1
  import { ParseBaseResponseType } from 'service/moneyResponse/types';
2
- import { ResponseFlashPayUpiDeposit } from './types';
2
+ import { ResponseFlashPayUpiDeposit, ResponseFlashPayUpiWithdraw } from './types';
3
3
  export declare const upiFlashPayRestAdapterDeposit: (data: ResponseFlashPayUpiDeposit | null) => {
4
4
  key: 'deposit';
5
5
  responseData: ParseBaseResponseType;
6
6
  };
7
+ export declare const impusFlashPayRestAdapterWithdraw: (data: ResponseFlashPayUpiWithdraw | null) => {
8
+ key: 'withdraw';
9
+ responseData: ParseBaseResponseType;
10
+ };
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.upiFlashPayRestAdapterDeposit = void 0;
3
+ exports.impusFlashPayRestAdapterWithdraw = exports.upiFlashPayRestAdapterDeposit = void 0;
4
4
  const types_1 = require("service/moneyResponse/types");
5
5
  const types_2 = require("../../binary/types");
6
6
  const types_3 = require("./types");
7
+ const moneyResponse_1 = require("service/moneyResponse");
7
8
  const upiFlashPayRestAdapterDeposit = (data) => {
8
9
  var _a, _b;
9
10
  const key = 'deposit';
@@ -42,3 +43,59 @@ const upiFlashPayRestAdapterDeposit = (data) => {
42
43
  return { key, responseData };
43
44
  };
44
45
  exports.upiFlashPayRestAdapterDeposit = upiFlashPayRestAdapterDeposit;
46
+ const impusFlashPayRestAdapterWithdraw = (data) => {
47
+ const key = 'withdraw';
48
+ if (!data) {
49
+ return {
50
+ key,
51
+ responseData: {
52
+ text: 'responseMoney.OperatorResponseError',
53
+ url: '',
54
+ isQR: false,
55
+ iconType: types_1.EIconType.Error,
56
+ requestId: types_2.ERequestIds.WithdrawRequest,
57
+ isError: true,
58
+ },
59
+ };
60
+ }
61
+ if (data.status === types_3.EFlashPayStatusCode[0]) {
62
+ if (data.postponed) {
63
+ return {
64
+ key,
65
+ responseData: {
66
+ text: 'responseMoney.Postponed',
67
+ url: '',
68
+ isQR: false,
69
+ iconType: types_1.EIconType.Wait,
70
+ requestId: types_2.ERequestIds.WithdrawRequest,
71
+ // Notice: We can't show waiting notification description because we don't have the notification
72
+ isError: true,
73
+ },
74
+ };
75
+ }
76
+ return {
77
+ key,
78
+ responseData: {
79
+ text: 'responseMoney.successDescription',
80
+ url: '',
81
+ isQR: false,
82
+ iconType: types_1.EIconType.Success,
83
+ requestId: types_2.ERequestIds.WithdrawRequest,
84
+ isError: false,
85
+ },
86
+ };
87
+ }
88
+ const statusCode = +data.code;
89
+ const instanceMoneyResponse = new moneyResponse_1.MoneyResponse();
90
+ const { text, iconType, isError } = instanceMoneyResponse.getErrorCodeByStatus(statusCode);
91
+ const responseData = {
92
+ text,
93
+ url: '',
94
+ isQR: false,
95
+ iconType,
96
+ requestId: types_2.ERequestIds.WithdrawRequest,
97
+ isError,
98
+ };
99
+ return { key, responseData };
100
+ };
101
+ exports.impusFlashPayRestAdapterWithdraw = impusFlashPayRestAdapterWithdraw;
@@ -1,8 +1,20 @@
1
- import { TWithdrawResponse, ParseResponseType, TQrFormResponse, HandleDepositQrFormResponse } from './types';
1
+ import { EIconType, EWithdrawStatusCode, TWithdrawResponse, ParseResponseType, TQrFormResponse, HandleDepositQrFormResponse } from './types';
2
2
  export declare class MoneyResponse {
3
3
  qrFormResponse(data: TQrFormResponse): HandleDepositQrFormResponse;
4
4
  private isQRMethod;
5
5
  private getQrInfo;
6
6
  parseResponse(data: TWithdrawResponse): ParseResponseType;
7
- private getErrorCodeByStatus;
7
+ getErrorCodeByStatus(status: EWithdrawStatusCode): {
8
+ text: string;
9
+ iconType?: undefined;
10
+ isError?: undefined;
11
+ } | {
12
+ text: string;
13
+ iconType: EIconType;
14
+ isError: boolean;
15
+ } | {
16
+ text: string;
17
+ iconType: EIconType;
18
+ isError?: undefined;
19
+ };
8
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-memory-optimization",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "description": "react memory optimization library",
5
5
  "sideEffects": false,
6
6
  "files": [