react-memory-optimization 0.0.81 → 0.0.82

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.
@@ -0,0 +1,2 @@
1
+ import { ApiList } from './types';
2
+ export declare const PAYMENT_REQUEST_PATHS: ApiList;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PAYMENT_REQUEST_PATHS = void 0;
4
+ const types_1 = require("./types");
5
+ const utils_1 = require("./utils");
6
+ exports.PAYMENT_REQUEST_PATHS = {
7
+ [types_1.EPaymentRequestPath.FlashPayUpiDeposit]: {
8
+ path: types_1.EApiPath.FlashPayUpiDepositCreate,
9
+ adapterFn: utils_1.upiFlashPayRestAdapterDeposit,
10
+ },
11
+ [types_1.EPaymentRequestPath.FlashPayUpiWithdraw]: {
12
+ path: types_1.EApiPath.FlashPayUpiWithdrawCreate,
13
+ adapterFn: utils_1.upiFlashPayRestAdapterDeposit,
14
+ },
15
+ };
@@ -1,8 +1,10 @@
1
- import { EApiPath, RestCommandDataProps } from './types';
1
+ import { EApiPath, EPaymentRequestPath, RestCommandDataProps } from './types';
2
2
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
3
3
  interface ApiRequestConfig extends RequestInit {
4
4
  method: HttpMethod;
5
- headers?: HeadersInit;
5
+ headers?: HeadersInit & {
6
+ Authorization: string;
7
+ };
6
8
  }
7
9
  declare class Api {
8
10
  private baseUrl;
@@ -10,8 +12,10 @@ declare class Api {
10
12
  constructor();
11
13
  setToken(token: string): void;
12
14
  private request;
13
- get<T>(url: EApiPath | string, config?: Partial<ApiRequestConfig>): Promise<T | null>;
14
- post<T, U = unknown>(url: EApiPath | string, body: U, config?: Partial<ApiRequestConfig>): Promise<T | null>;
15
+ get<T>(url: EApiPath, config?: Partial<ApiRequestConfig>): Promise<T | null>;
16
+ post<T, U = unknown>(url: EApiPath, body: U, config?: Partial<ApiRequestConfig>): Promise<T | null>;
17
+ private getCommandList;
18
+ validationCommand<T = unknown>(command: EPaymentRequestPath, sendData?: any): Promise<T | null>;
15
19
  registration(path: string, sendData: RestCommandDataProps): Promise<any>;
16
20
  }
17
21
  export declare const api: Api;
@@ -1,6 +1,42 @@
1
1
  export declare enum EApiPath {
2
- AccrualHistory = "/ref_service/api/v1/client/accural_bonus"
2
+ AccrualHistory = "/ref_service/api/v1/client/accural_bonus",
3
+ FlashPayUpiDepositCreate = "/pay-service-dev/api/v2/deposit/create",
4
+ FlashPayUpiWithdrawCreate = "/pay-service-dev/api/v2/withdraw/create"
3
5
  }
4
6
  export type RestCommandDataProps = {
5
7
  [key: string]: string | number | any[];
6
8
  };
9
+ export declare enum EValidationCommandDataProps {
10
+ Unknown = 0,
11
+ Payment = "payment"
12
+ }
13
+ export declare enum EPaymentRequestPath {
14
+ Unknown = "",
15
+ FlashPayUpiDeposit = "flash_pay_upi_deposit",
16
+ FlashPayUpiWithdraw = "flash_pay_impus_withdraw"
17
+ }
18
+ export type ApiList = {
19
+ [key: string]: {
20
+ path: string;
21
+ adapterFn: (data: any) => any;
22
+ };
23
+ };
24
+ export type RequestList = ApiList | null;
25
+ export declare enum EFlashPayStatusCode {
26
+ Initiated = 0,
27
+ Success = 1,
28
+ Failed = 2,
29
+ Canceled = 3,
30
+ WaitingNotification = 4
31
+ }
32
+ export type ResponseFlashPayUpiDeposit = {
33
+ status: keyof typeof EFlashPayStatusCode;
34
+ operationId: string;
35
+ paymentUrl: string;
36
+ deepLink: {
37
+ upi_intent: string;
38
+ upi_phonepe: string;
39
+ upi_gpay: string;
40
+ upi_paytm: string;
41
+ };
42
+ };
@@ -1,7 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EApiPath = void 0;
3
+ exports.EFlashPayStatusCode = exports.EPaymentRequestPath = exports.EValidationCommandDataProps = exports.EApiPath = void 0;
4
4
  var EApiPath;
5
5
  (function (EApiPath) {
6
6
  EApiPath["AccrualHistory"] = "/ref_service/api/v1/client/accural_bonus";
7
+ EApiPath["FlashPayUpiDepositCreate"] = "/pay-service-dev/api/v2/deposit/create";
8
+ EApiPath["FlashPayUpiWithdrawCreate"] = "/pay-service-dev/api/v2/withdraw/create";
7
9
  })(EApiPath || (exports.EApiPath = EApiPath = {}));
10
+ var EValidationCommandDataProps;
11
+ (function (EValidationCommandDataProps) {
12
+ EValidationCommandDataProps[EValidationCommandDataProps["Unknown"] = 0] = "Unknown";
13
+ EValidationCommandDataProps["Payment"] = "payment";
14
+ })(EValidationCommandDataProps || (exports.EValidationCommandDataProps = EValidationCommandDataProps = {}));
15
+ var EPaymentRequestPath;
16
+ (function (EPaymentRequestPath) {
17
+ EPaymentRequestPath["Unknown"] = "";
18
+ EPaymentRequestPath["FlashPayUpiDeposit"] = "flash_pay_upi_deposit";
19
+ EPaymentRequestPath["FlashPayUpiWithdraw"] = "flash_pay_impus_withdraw";
20
+ })(EPaymentRequestPath || (exports.EPaymentRequestPath = EPaymentRequestPath = {}));
21
+ // FlashPayUpiDeposit
22
+ var EFlashPayStatusCode;
23
+ (function (EFlashPayStatusCode) {
24
+ EFlashPayStatusCode[EFlashPayStatusCode["Initiated"] = 0] = "Initiated";
25
+ EFlashPayStatusCode[EFlashPayStatusCode["Success"] = 1] = "Success";
26
+ EFlashPayStatusCode[EFlashPayStatusCode["Failed"] = 2] = "Failed";
27
+ EFlashPayStatusCode[EFlashPayStatusCode["Canceled"] = 3] = "Canceled";
28
+ EFlashPayStatusCode[EFlashPayStatusCode["WaitingNotification"] = 4] = "WaitingNotification";
29
+ })(EFlashPayStatusCode || (exports.EFlashPayStatusCode = EFlashPayStatusCode = {}));
@@ -0,0 +1,6 @@
1
+ import { ParseBaseResponseType } from 'service/moneyResponse/types';
2
+ import { ResponseFlashPayUpiDeposit } from './types';
3
+ export declare const upiFlashPayRestAdapterDeposit: (data: ResponseFlashPayUpiDeposit | null) => {
4
+ key: 'deposit';
5
+ responseData: ParseBaseResponseType;
6
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.upiFlashPayRestAdapterDeposit = void 0;
4
+ const types_1 = require("service/moneyResponse/types");
5
+ const types_2 = require("../../binary/types");
6
+ const types_3 = require("./types");
7
+ const upiFlashPayRestAdapterDeposit = (data) => {
8
+ var _a, _b;
9
+ const key = 'deposit';
10
+ // Handle null or undefined data
11
+ if (!data || typeof data !== 'object') {
12
+ const responseData = {
13
+ text: 'responseMoney.OperatorResponseError',
14
+ url: '',
15
+ isQR: false,
16
+ iconType: types_1.EIconType.Error,
17
+ requestId: types_2.ERequestIds.Unknown,
18
+ isError: true,
19
+ };
20
+ return { key, responseData };
21
+ }
22
+ const response = data;
23
+ // Extract common fields with fallbacks
24
+ const status = (_b = (_a = response.status) !== null && _a !== void 0 ? _a : response.code) !== null && _b !== void 0 ? _b : 'Failed';
25
+ const requestId = types_2.ERequestIds.RequestDeposit;
26
+ const url = response.paymentUrl;
27
+ const isSuccess = status === types_3.EFlashPayStatusCode[1];
28
+ // Determine icon type based on status
29
+ const iconType = isSuccess ? types_1.EIconType.Success : types_1.EIconType.Error;
30
+ // Build response text
31
+ const responseText = isSuccess
32
+ ? 'responseMoney.successDescription'
33
+ : 'responseMoney.OperatorResponseError';
34
+ const responseData = {
35
+ text: responseText,
36
+ url: url,
37
+ isQR: false,
38
+ iconType,
39
+ requestId,
40
+ isError: !isSuccess,
41
+ };
42
+ return { key, responseData };
43
+ };
44
+ exports.upiFlashPayRestAdapterDeposit = upiFlashPayRestAdapterDeposit;
@@ -81,14 +81,15 @@ export declare enum EImgType {
81
81
  RedCoin = 1,
82
82
  Pack = 2
83
83
  }
84
- export type ParseResponseType = {
84
+ export type ParseBaseResponseType = {
85
85
  text: string;
86
86
  url: string;
87
87
  isQR: boolean;
88
88
  iconType: EIconType;
89
89
  requestId: ERequestIds;
90
90
  isError: boolean;
91
- } & {
91
+ };
92
+ export type ParseResponseType = ParseBaseResponseType & {
92
93
  requestId: ERequestIds.GetBillingAddress;
93
94
  billingAccount: string;
94
95
  imgType: EImgType;
@@ -158,10 +158,10 @@ export declare enum PaymentChannelType {
158
158
  CreditCard = 29,
159
159
  CreditCardFast = 30,
160
160
  CreditCardAcquirning = 31,
161
- VivaroBkash = 32,
161
+ FlashPayUpi = 32,
162
162
  BKash = 41,
163
163
  Nagad = 42,
164
- VivaroNagad = 43,
164
+ FlashPayIMPUS = 43,
165
165
  BKashFastWellexPayCopy = 62,
166
166
  NagadFastWellexPayCopy = 63,
167
167
  ApayNagad = 64,
@@ -45,11 +45,11 @@ var PaymentChannelType;
45
45
  PaymentChannelType[PaymentChannelType["CreditCard"] = 29] = "CreditCard";
46
46
  PaymentChannelType[PaymentChannelType["CreditCardFast"] = 30] = "CreditCardFast";
47
47
  PaymentChannelType[PaymentChannelType["CreditCardAcquirning"] = 31] = "CreditCardAcquirning";
48
- PaymentChannelType[PaymentChannelType["VivaroBkash"] = 32] = "VivaroBkash";
48
+ PaymentChannelType[PaymentChannelType["FlashPayUpi"] = 32] = "FlashPayUpi";
49
49
  // END RUN
50
50
  PaymentChannelType[PaymentChannelType["BKash"] = 41] = "BKash";
51
51
  PaymentChannelType[PaymentChannelType["Nagad"] = 42] = "Nagad";
52
- PaymentChannelType[PaymentChannelType["VivaroNagad"] = 43] = "VivaroNagad";
52
+ PaymentChannelType[PaymentChannelType["FlashPayIMPUS"] = 43] = "FlashPayIMPUS";
53
53
  PaymentChannelType[PaymentChannelType["BKashFastWellexPayCopy"] = 62] = "BKashFastWellexPayCopy";
54
54
  PaymentChannelType[PaymentChannelType["NagadFastWellexPayCopy"] = 63] = "NagadFastWellexPayCopy";
55
55
  PaymentChannelType[PaymentChannelType["ApayNagad"] = 64] = "ApayNagad";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-memory-optimization",
3
- "version": "0.0.81",
3
+ "version": "0.0.82",
4
4
  "description": "react memory optimization library",
5
5
  "sideEffects": false,
6
6
  "files": [