@teamdigipay/dgepay-customer-transaction-package 0.0.1 → 0.0.3

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.
@@ -621,70 +621,88 @@ TransactionController.validateThresholdWise = (config, payload, onData, onError)
621
621
  product_code: productCode,
622
622
  currency_id: currencyId
623
623
  }, (userThresholdData) => __awaiter(void 0, void 0, void 0, function* () {
624
+ console.log("userThresholdData ::::::::::", JSON.stringify(userThresholdData));
624
625
  thresholdType = userThresholdData === null || userThresholdData === void 0 ? void 0 : userThresholdData.threshold_type;
625
626
  userThresholdAmount = userThresholdData === null || userThresholdData === void 0 ? void 0 : userThresholdData.threshold_amount;
626
627
  userThresholdTxn = userThresholdData === null || userThresholdData === void 0 ? void 0 : userThresholdData.threshold_no_txn;
627
- if (userThresholdData) {
628
- yield (0, ProfileThresholdHelpers_1.profileThresholdDetailsHelper)(config, {
629
- id: userThresholdData === null || userThresholdData === void 0 ? void 0 : userThresholdData.threshold_detail_id,
630
- }, (thresholdData) => __awaiter(void 0, void 0, void 0, function* () {
631
- thresholdAmount = thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.threshold_amount;
632
- thresholdTxn = thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.threshold_no_txn;
633
- if ((thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.max_amount) && amount > (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.max_amount)) {
634
- onError("You can not enter amount more than " +
635
- (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.max_amount));
636
- return;
637
- }
638
- else if ((thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.min_amount) && amount < (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.min_amount)) {
639
- onError("You can not enter amount less then " +
640
- (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.min_amount));
641
- }
642
- else if (thresholdType && thresholdType === __1.txnConstants.THRESHOLD_TYPE.AMOUNT) {
643
- if (amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.daily_usage) > parseFloat(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.daily_limit) ||
644
- amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.monthly_usage) > parseFloat(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.monthly_limit) ||
645
- amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.weekly_usage) > parseFloat(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.weekly_limit)) {
646
- onError(Strings_1.default.PACKAGE_THRESHOLD_LIMIT_EXCEEDED);
647
- return;
648
- }
649
- else {
650
- onData(true);
651
- }
652
- }
653
- else if (thresholdType && thresholdType === __1.txnConstants.THRESHOLD_TYPE.NO_OF_TXN) {
654
- if (1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.daily_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.daily_limit) ||
655
- 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.monthly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.monthly_limit) ||
656
- 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.weekly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.weekly_limit)) {
657
- onError(Strings_1.default.PACKAGE_THRESHOLD_LIMIT_EXCEEDED);
658
- return;
659
- }
660
- else {
661
- onData(true);
662
- }
663
- }
664
- else if (thresholdType && thresholdType === __1.txnConstants.THRESHOLD_TYPE.BOTH) {
665
- if (amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.daily_usage) > parseInt(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.daily_limit) ||
666
- amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.monthly_usage) > parseInt(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.monthly_limit) ||
667
- amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.weekly_usage) > parseInt(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.weekly_limit) ||
668
- 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.daily_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.daily_limit) ||
669
- 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.monthly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.monthly_limit) ||
670
- 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.weekly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.weekly_limit)) {
671
- onError(Strings_1.default.PACKAGE_THRESHOLD_LIMIT_EXCEEDED);
672
- return;
628
+ (0, ProfileThresholdHelpers_1.getUserProfileHelper)(config, {
629
+ userId: userId,
630
+ userType: constants_1.USER_TYPE.MERCHANT,
631
+ currencyId: currencyId
632
+ }, (data) => {
633
+ data.then((userProfile) => __awaiter(void 0, void 0, void 0, function* () {
634
+ (0, ProfileThresholdHelpers_1.getProfileListHelper)(config, { id: userProfile === null || userProfile === void 0 ? void 0 : userProfile.profile_id }, (data) => __awaiter(void 0, void 0, void 0, function* () {
635
+ if (data) {
636
+ console.log("userThresholdData ::::::::::", JSON.stringify(userThresholdData));
637
+ yield (0, ProfileThresholdHelpers_1.profileThresholdDetailsHelper)(config, {
638
+ Threshold_id: data === null || data === void 0 ? void 0 : data.threshold_id,
639
+ product_code: productCode,
640
+ }, (thresholdData) => __awaiter(void 0, void 0, void 0, function* () {
641
+ console.log("thresholdData ::::::::::", JSON.stringify(thresholdData));
642
+ thresholdAmount = thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.threshold_amount;
643
+ thresholdTxn = thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.threshold_no_txn;
644
+ if ((amount > (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.max_amount)) && ((thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.max_amount) !== null)) {
645
+ onError("You can not enter amount more than " +
646
+ (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.max_amount));
647
+ return;
648
+ }
649
+ else if ((amount < (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.min_amount)) && ((thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.min_amount) !== null)) {
650
+ onError("You can not enter amount less then " +
651
+ (thresholdData === null || thresholdData === void 0 ? void 0 : thresholdData.min_amount));
652
+ }
653
+ else if (thresholdType && thresholdType === constants_1.THRESHOLD_TYPE.AMOUNT) {
654
+ if (amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.daily_usage) > parseFloat(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.daily_limit) ||
655
+ amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.monthly_usage) > parseFloat(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.monthly_limit) ||
656
+ amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.weekly_usage) > parseFloat(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.weekly_limit)) {
657
+ onError("Your threshold limit is exceeded.");
658
+ return;
659
+ }
660
+ else {
661
+ onData(true);
662
+ }
663
+ }
664
+ else if (thresholdType && thresholdType === constants_1.THRESHOLD_TYPE.NO_OF_TXN) {
665
+ if (1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.daily_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.daily_limit) ||
666
+ 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.monthly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.monthly_limit) ||
667
+ 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.weekly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.weekly_limit)) {
668
+ onError("Your threshold limit is exceeded.");
669
+ return;
670
+ }
671
+ else {
672
+ onData(true);
673
+ }
674
+ }
675
+ else if (thresholdType && thresholdType === constants_1.THRESHOLD_TYPE.BOTH) {
676
+ if (amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.daily_usage) > parseInt(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.daily_limit) ||
677
+ amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.monthly_usage) > parseInt(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.monthly_limit) ||
678
+ amount + parseFloat(userThresholdAmount === null || userThresholdAmount === void 0 ? void 0 : userThresholdAmount.weekly_usage) > parseInt(thresholdAmount === null || thresholdAmount === void 0 ? void 0 : thresholdAmount.weekly_limit) ||
679
+ 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.daily_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.daily_limit) ||
680
+ 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.monthly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.monthly_limit) ||
681
+ 1 + parseInt(userThresholdTxn === null || userThresholdTxn === void 0 ? void 0 : userThresholdTxn.weekly_usage) > parseInt(thresholdTxn === null || thresholdTxn === void 0 ? void 0 : thresholdTxn.weekly_limit)) {
682
+ onError("Your threshold limit is exceeded.");
683
+ return;
684
+ }
685
+ else {
686
+ onData(true);
687
+ }
688
+ }
689
+ else {
690
+ onData(true);
691
+ }
692
+ }), (error) => __awaiter(void 0, void 0, void 0, function* () {
693
+ onData(true);
694
+ }));
673
695
  }
674
696
  else {
675
697
  onData(true);
676
698
  }
677
- }
678
- else {
679
- onData(true);
680
- }
681
- }), (error) => __awaiter(void 0, void 0, void 0, function* () {
682
- onData(true);
699
+ }), (error) => {
700
+ console.log("errrrroe =====", error);
701
+ });
683
702
  }));
684
- }
685
- else {
686
- onData(true);
687
- }
703
+ }, (error) => {
704
+ console.log("error========", error);
705
+ });
688
706
  }), (error) => __awaiter(void 0, void 0, void 0, function* () {
689
707
  onData(true);
690
708
  }));
@@ -37,10 +37,11 @@ export declare namespace API_ENDPOINTS {
37
37
  const PROFILE_THRESHOLD = "profile_threshold/threshold_detail";
38
38
  const USER_PROFILE = "profile_threshold/user_profile";
39
39
  const PROFILE_THRESHOLD_DETAILS = "profile_threshold/threshold";
40
+ const PROFILE = "profile_threshold/profile";
40
41
  }
41
42
  namespace PAYMENT_GATEWAY_DOCKER {
42
- const BANK_PAYMENT_FOR_MERCHANT = "payment_gateway/bank_payment_merchant";
43
- const BANK_SETTLEMENT_FOR_MERCHANT = "payment_gateway/bank_settlement_merchant";
43
+ const BANK_PAYMENT_FOR_MERCHANT = "payment_gateway/nrb_bank_payment_merchant";
44
+ const BANK_SETTLEMENT_FOR_MERCHANT = "payment_gateway/nrb_bank_settlement_merchant";
44
45
  }
45
46
  namespace SUB_WALLET_DOCKER {
46
47
  const SUB_WALLET_CATEGORY = "base/sub_wallet_category";
@@ -44,11 +44,12 @@ var API_ENDPOINTS;
44
44
  PROFILE_THRESHOLD_DOCKER.PROFILE_THRESHOLD = "profile_threshold/threshold_detail";
45
45
  PROFILE_THRESHOLD_DOCKER.USER_PROFILE = "profile_threshold/user_profile";
46
46
  PROFILE_THRESHOLD_DOCKER.PROFILE_THRESHOLD_DETAILS = "profile_threshold/threshold";
47
+ PROFILE_THRESHOLD_DOCKER.PROFILE = "profile_threshold/profile";
47
48
  })(PROFILE_THRESHOLD_DOCKER = API_ENDPOINTS.PROFILE_THRESHOLD_DOCKER || (API_ENDPOINTS.PROFILE_THRESHOLD_DOCKER = {}));
48
49
  let PAYMENT_GATEWAY_DOCKER;
49
50
  (function (PAYMENT_GATEWAY_DOCKER) {
50
- PAYMENT_GATEWAY_DOCKER.BANK_PAYMENT_FOR_MERCHANT = "payment_gateway/bank_payment_merchant";
51
- PAYMENT_GATEWAY_DOCKER.BANK_SETTLEMENT_FOR_MERCHANT = "payment_gateway/bank_settlement_merchant";
51
+ PAYMENT_GATEWAY_DOCKER.BANK_PAYMENT_FOR_MERCHANT = "payment_gateway/nrb_bank_payment_merchant";
52
+ PAYMENT_GATEWAY_DOCKER.BANK_SETTLEMENT_FOR_MERCHANT = "payment_gateway/nrb_bank_settlement_merchant";
52
53
  })(PAYMENT_GATEWAY_DOCKER = API_ENDPOINTS.PAYMENT_GATEWAY_DOCKER || (API_ENDPOINTS.PAYMENT_GATEWAY_DOCKER = {}));
53
54
  let SUB_WALLET_DOCKER;
54
55
  (function (SUB_WALLET_DOCKER) {
@@ -3,10 +3,11 @@ export declare function userProfileThresholdDetailsHelper(config: BasicAPIConfig
3
3
  export declare function profileThresholdDetailsHelper(config: BasicAPIConfig, payload: any, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
4
4
  export declare function getThreshHoldMasterHelper(config: BasicAPIConfig, payload: any, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
5
5
  interface GetUserProfileInterface {
6
- userId: string;
6
+ userId: any;
7
7
  currencyId?: string;
8
8
  userType?: number;
9
9
  }
10
10
  export declare function getUserProfileHelper(config: BasicAPIConfig, payload: GetUserProfileInterface, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
11
11
  export declare function getProfileProductsHelper(config: BasicAPIConfig, profileId: string, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
12
+ export declare function getProfileListHelper(config: BasicAPIConfig, payload: any, onData: (data: any) => void, onError: (error: any) => void): Promise<void>;
12
13
  export {};
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getProfileProductsHelper = exports.getUserProfileHelper = exports.getThreshHoldMasterHelper = exports.profileThresholdDetailsHelper = exports.userProfileThresholdDetailsHelper = void 0;
12
+ exports.getProfileListHelper = exports.getProfileProductsHelper = exports.getUserProfileHelper = exports.getThreshHoldMasterHelper = exports.profileThresholdDetailsHelper = exports.userProfileThresholdDetailsHelper = void 0;
13
13
  const APICall_1 = require("../APICall");
14
14
  const APIEndpoints_1 = require("../APIEndpoints");
15
15
  function userProfileThresholdDetailsHelper(config, payload, onData, onError) {
@@ -94,3 +94,18 @@ function getProfileProductsHelper(config, profileId, onData, onError) {
94
94
  });
95
95
  }
96
96
  exports.getProfileProductsHelper = getProfileProductsHelper;
97
+ function getProfileListHelper(config, payload, onData, onError) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ console.log("payload ======", payload);
100
+ let endPoint = (payload === null || payload === void 0 ? void 0 : payload.id) ? `${APIEndpoints_1.API_ENDPOINTS.PROFILE_THRESHOLD_DOCKER.PROFILE}/${payload.id}` : APIEndpoints_1.API_ENDPOINTS.PROFILE_THRESHOLD_DOCKER.PROFILE;
101
+ yield (0, APICall_1.GET)(Object.assign(Object.assign({}, config), { endPoint: endPoint }), {
102
+ params: (payload === null || payload === void 0 ? void 0 : payload.id) ? "" : payload === null || payload === void 0 ? void 0 : payload.params
103
+ }, (data) => __awaiter(this, void 0, void 0, function* () {
104
+ var _a;
105
+ onData((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.profile);
106
+ }), (error) => __awaiter(this, void 0, void 0, function* () {
107
+ onError(error);
108
+ }));
109
+ });
110
+ }
111
+ exports.getProfileListHelper = getProfileListHelper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamdigipay/dgepay-customer-transaction-package",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "author": "RM (peerbits)",
5
5
  "license": "MIT",
6
6
  "main": "src/index.ts",
@@ -20,7 +20,7 @@
20
20
  "lodash": "^4.17.21",
21
21
  "typescript": "^4.9.4"
22
22
  },
23
- "description": "> This package contains all the necessary Transaction controllers, helpers and constants for Digipay Customer Application.",
23
+ "description": "> This package contains all the necessary Transaction controllers, helpers and constants for DGePay Customer Application.",
24
24
  "devDependencies": {},
25
25
  "repository": {
26
26
  "type": "git",
@@ -7,7 +7,7 @@ import {
7
7
  USER_ACCOUNT_STATUS,
8
8
  USER_TYPE,
9
9
  TXN_TYPE,
10
- PAYMENT_STATUS, PACKAGE_NO_USER,
10
+ PAYMENT_STATUS, PACKAGE_NO_USER, THRESHOLD_TYPE,
11
11
  } from "../utils/constants"
12
12
  import { txnNavigationConstants } from "../utils/NavigationConstants";
13
13
  import Strings from "../utils/Strings";
@@ -16,7 +16,13 @@ import * as _ from "lodash";
16
16
  import { addRequestMoneyUsersHelper, getDisplayNameForUser, paymentRequestAddUserPayloadInterface, paymentRequestPayloadInterface, remindRequestPaymentUserHelper, requestMoneyHelper, searchUserHelper, updatePaymentRequest, getUserDetailsHelper } from "../network/Helpers/UserAPIHelpers";
17
17
  import { ProfileThresholdResponseModels } from "../network/APIModels/APIModels";
18
18
  import { txnConstants } from "..";
19
- import { getThreshHoldMasterHelper, profileThresholdDetailsHelper, userProfileThresholdDetailsHelper } from "../network/Helpers/ProfileThresholdHelpers";
19
+ import {
20
+ getProfileListHelper,
21
+ getThreshHoldMasterHelper,
22
+ getUserProfileHelper,
23
+ profileThresholdDetailsHelper,
24
+ userProfileThresholdDetailsHelper
25
+ } from "../network/Helpers/ProfileThresholdHelpers";
20
26
 
21
27
  interface ValidateWalletTransferFields {
22
28
  dialCode: string,
@@ -465,7 +471,7 @@ export class TransactionController {
465
471
  }
466
472
 
467
473
 
468
-
474
+
469
475
  static async walletTransferRequestUserSearch(
470
476
  config: BasicAPIConfig,
471
477
  payload: any,
@@ -500,10 +506,10 @@ export class TransactionController {
500
506
  }
501
507
  else{
502
508
  data && data[0].user_type==USER_TYPE.AGENT?onError(Strings.PACKAGE_CANT_REQUEST_TO_AGENT):onError(Strings.PACKAGE_CANT_REQUEST_TO_MERCHANT)
503
- }
509
+ }
504
510
  }
505
511
 
506
-
512
+
507
513
  });
508
514
  }
509
515
 
@@ -741,7 +747,7 @@ export class TransactionController {
741
747
  user_id: user_id,
742
748
  },
743
749
  (data: any) => {
744
-
750
+
745
751
  this.checkUserStatus(data?.data?.user_detail, onError, onData, isAgentAsMerchant,qrId,amount)
746
752
 
747
753
  },
@@ -785,10 +791,10 @@ export class TransactionController {
785
791
 
786
792
 
787
793
  static validateThresholdWise = async (
788
- config: BasicAPIConfig,
789
- payload: ValidateThresholdPayload,
790
- onData: (data: boolean) => void,
791
- onError: (error: string) => void,
794
+ config: BasicAPIConfig,
795
+ payload: ValidateThresholdPayload,
796
+ onData: (data: boolean) => void,
797
+ onError: (error: string) => void,
792
798
  ) => {
793
799
 
794
800
  let amount = payload?.amount;
@@ -809,92 +815,118 @@ export class TransactionController {
809
815
  let thresholdTxn: any | null = null;
810
816
 
811
817
  await userProfileThresholdDetailsHelper(
812
- config,
813
- {
814
- user_id: userId,
815
- product_code: productCode,
816
- currency_id: currencyId
817
- },
818
- async (userThresholdData: any) => {
818
+ config,
819
+ {
820
+ user_id: userId,
821
+ product_code: productCode,
822
+ currency_id: currencyId
823
+ },
824
+ async (userThresholdData: any) => {
819
825
 
820
- thresholdType = userThresholdData?.threshold_type;
826
+ console.log("userThresholdData ::::::::::", JSON.stringify(userThresholdData))
821
827
 
822
- userThresholdAmount = userThresholdData?.threshold_amount;
823
- userThresholdTxn = userThresholdData?.threshold_no_txn;
828
+ thresholdType = userThresholdData?.threshold_type;
824
829
 
825
- if (userThresholdData) {
826
- await profileThresholdDetailsHelper(
827
- config,
828
- {
829
- id: userThresholdData?.threshold_detail_id,
830
- },
831
- async (thresholdData: any) => {
830
+ userThresholdAmount = userThresholdData?.threshold_amount;
831
+ userThresholdTxn = userThresholdData?.threshold_no_txn;
832
832
 
833
- thresholdAmount = thresholdData?.threshold_amount;
834
- thresholdTxn = thresholdData?.threshold_no_txn;
833
+ getUserProfileHelper(config,
834
+ {
835
+ userId: userId,
836
+ userType: USER_TYPE.MERCHANT,
837
+ currencyId: currencyId},
838
+ (data)=>{
839
+ data.then(async (userProfile: any) => {
840
+ getProfileListHelper(config,{id:userProfile?.profile_id},async (data)=>{
841
+ if (data) {
842
+ console.log("userThresholdData ::::::::::", JSON.stringify(userThresholdData))
843
+ await profileThresholdDetailsHelper(
844
+ config,
845
+ {
846
+ Threshold_id: data?.threshold_id,
847
+ product_code:productCode,
848
+ },
849
+ async (thresholdData: any) => {
850
+
851
+ console.log("thresholdData ::::::::::", JSON.stringify(thresholdData))
852
+
853
+ thresholdAmount = thresholdData?.threshold_amount;
854
+ thresholdTxn = thresholdData?.threshold_no_txn;
855
+
856
+
857
+ if ((amount > thresholdData?.max_amount) && (thresholdData?.max_amount !== null)) {
858
+ onError(
859
+ "You can not enter amount more than " +
860
+ thresholdData?.max_amount
861
+ );
862
+ return;
863
+ } else if ((amount < thresholdData?.min_amount) && (thresholdData?.min_amount !== null)) {
864
+ onError(
865
+ "You can not enter amount less then " +
866
+ thresholdData?.min_amount
867
+ );
868
+
869
+ } else if (thresholdType && thresholdType === THRESHOLD_TYPE.AMOUNT) {
870
+ if (
871
+ amount + parseFloat(userThresholdAmount?.daily_usage) > parseFloat(thresholdAmount?.daily_limit) ||
872
+ amount + parseFloat(userThresholdAmount?.monthly_usage) > parseFloat(thresholdAmount?.monthly_limit) ||
873
+ amount + parseFloat(userThresholdAmount?.weekly_usage) > parseFloat(thresholdAmount?.weekly_limit)
874
+ ) {
875
+ onError("Your threshold limit is exceeded.");
876
+ return;
877
+ } else {
878
+ onData(true)
879
+ }
880
+ } else if (thresholdType && thresholdType === THRESHOLD_TYPE.NO_OF_TXN) {
881
+ if (
882
+ 1 + parseInt(userThresholdTxn?.daily_usage) > parseInt(thresholdTxn?.daily_limit) ||
883
+ 1 + parseInt(userThresholdTxn?.monthly_usage) > parseInt(thresholdTxn?.monthly_limit) ||
884
+ 1 + parseInt(userThresholdTxn?.weekly_usage) > parseInt(thresholdTxn?.weekly_limit)
885
+ ) {
886
+ onError("Your threshold limit is exceeded.");
887
+ return;
888
+ } else {
889
+ onData(true)
890
+ }
891
+ } else if (thresholdType && thresholdType === THRESHOLD_TYPE.BOTH) {
892
+ if (
893
+ amount + parseFloat(userThresholdAmount?.daily_usage) > parseInt(thresholdAmount?.daily_limit) ||
894
+ amount + parseFloat(userThresholdAmount?.monthly_usage) > parseInt(thresholdAmount?.monthly_limit) ||
895
+ amount + parseFloat(userThresholdAmount?.weekly_usage) > parseInt(thresholdAmount?.weekly_limit) ||
896
+ 1 + parseInt(userThresholdTxn?.daily_usage) > parseInt(thresholdTxn?.daily_limit) ||
897
+ 1 + parseInt(userThresholdTxn?.monthly_usage) > parseInt(thresholdTxn?.monthly_limit) ||
898
+ 1 + parseInt(userThresholdTxn?.weekly_usage) > parseInt(thresholdTxn?.weekly_limit)
899
+ ) {
900
+ onError("Your threshold limit is exceeded.");
901
+ return;
902
+ } else {
903
+ onData(true)
904
+ }
905
+ } else {
906
+ onData(true);
907
+ }
908
+ },
909
+ async (error: any) => {
910
+ onData(true);
911
+ }
912
+ );
913
+ } else {
914
+ onData(true);
915
+ }
835
916
 
836
- if (thresholdData?.max_amount && amount > thresholdData?.max_amount) {
837
- onError(
838
- "You can not enter amount more than " +
839
- thresholdData?.max_amount
840
- );
841
- return;
842
- } else if (thresholdData?.min_amount && amount < thresholdData?.min_amount) {
843
- onError(
844
- "You can not enter amount less then " +
845
- thresholdData?.min_amount
846
- );
847
- } else if (thresholdType && thresholdType === txnConstants.THRESHOLD_TYPE.AMOUNT) {
848
- if (
849
- amount + parseFloat(userThresholdAmount?.daily_usage) > parseFloat(thresholdAmount?.daily_limit) ||
850
- amount + parseFloat(userThresholdAmount?.monthly_usage) > parseFloat(thresholdAmount?.monthly_limit) ||
851
- amount + parseFloat(userThresholdAmount?.weekly_usage) > parseFloat(thresholdAmount?.weekly_limit)
852
- ) {
853
- onError(Strings.PACKAGE_THRESHOLD_LIMIT_EXCEEDED);
854
- return;
855
- } else {
856
- onData(true)
857
- }
858
- } else if (thresholdType && thresholdType === txnConstants.THRESHOLD_TYPE.NO_OF_TXN) {
859
- if (
860
- 1 + parseInt(userThresholdTxn?.daily_usage) > parseInt(thresholdTxn?.daily_limit) ||
861
- 1 + parseInt(userThresholdTxn?.monthly_usage) > parseInt(thresholdTxn?.monthly_limit) ||
862
- 1 + parseInt(userThresholdTxn?.weekly_usage) > parseInt(thresholdTxn?.weekly_limit)
863
- ) {
864
- onError(Strings.PACKAGE_THRESHOLD_LIMIT_EXCEEDED);
865
- return;
866
- } else {
867
- onData(true)
868
- }
869
- } else if (thresholdType && thresholdType === txnConstants.THRESHOLD_TYPE.BOTH) {
870
- if (
871
- amount + parseFloat(userThresholdAmount?.daily_usage) > parseInt(thresholdAmount?.daily_limit) ||
872
- amount + parseFloat(userThresholdAmount?.monthly_usage) > parseInt(thresholdAmount?.monthly_limit) ||
873
- amount + parseFloat(userThresholdAmount?.weekly_usage) > parseInt(thresholdAmount?.weekly_limit) ||
874
- 1 + parseInt(userThresholdTxn?.daily_usage) > parseInt(thresholdTxn?.daily_limit) ||
875
- 1 + parseInt(userThresholdTxn?.monthly_usage) > parseInt(thresholdTxn?.monthly_limit) ||
876
- 1 + parseInt(userThresholdTxn?.weekly_usage) > parseInt(thresholdTxn?.weekly_limit)
877
- ) {
878
- onError(Strings.PACKAGE_THRESHOLD_LIMIT_EXCEEDED);
879
- return;
880
- } else {
881
- onData(true)
882
- }
883
- } else {
884
- onData(true);
885
- }
886
- },
887
- async (error: any) => {
888
- onData(true);
889
- }
890
- );
891
- } else {
917
+ },(error)=>{
918
+ console.log("errrrroe =====",error)})
919
+ })
920
+
921
+ },(error)=>{
922
+ console.log("error========",error)
923
+ })
924
+
925
+
926
+ },
927
+ async (error: any) => {
892
928
  onData(true);
893
929
  }
894
- },
895
- async (error: any) => {
896
- onData(true);
897
- }
898
930
  );
899
931
  };
900
932
 
@@ -42,17 +42,18 @@ export namespace API_ENDPOINTS {
42
42
  export const PROFILE_THRESHOLD = "profile_threshold/threshold_detail";
43
43
  export const USER_PROFILE = "profile_threshold/user_profile";
44
44
  export const PROFILE_THRESHOLD_DETAILS = "profile_threshold/threshold";
45
+ export const PROFILE = "profile_threshold/profile";
45
46
 
46
47
  }
47
48
 
48
49
  export namespace PAYMENT_GATEWAY_DOCKER {
49
- export const BANK_PAYMENT_FOR_MERCHANT = "payment_gateway/bank_payment_merchant";
50
- export const BANK_SETTLEMENT_FOR_MERCHANT = "payment_gateway/bank_settlement_merchant";
50
+ export const BANK_PAYMENT_FOR_MERCHANT = "payment_gateway/nrb_bank_payment_merchant";
51
+ export const BANK_SETTLEMENT_FOR_MERCHANT = "payment_gateway/nrb_bank_settlement_merchant";
51
52
  }
52
53
 
53
54
 
54
55
  export namespace SUB_WALLET_DOCKER {
55
56
  export const SUB_WALLET_CATEGORY = "base/sub_wallet_category";
56
-
57
+
57
58
  }
58
- }
59
+ }
@@ -79,7 +79,7 @@ export async function getThreshHoldMasterHelper(
79
79
  }
80
80
 
81
81
  interface GetUserProfileInterface {
82
- userId: string,
82
+ userId: any,
83
83
  currencyId?: string,
84
84
  userType?: number
85
85
  }
@@ -146,4 +146,30 @@ export async function getProfileProductsHelper(
146
146
  onError(error);
147
147
  }
148
148
  );
149
- }
149
+ }
150
+
151
+ export async function getProfileListHelper(
152
+ config: BasicAPIConfig,
153
+ payload: any,
154
+ onData: (data: any) => void,
155
+ onError: (error: any) => void
156
+ ) {
157
+
158
+ console.log("payload ======",payload)
159
+ let endPoint = payload?.id ? `${API_ENDPOINTS.PROFILE_THRESHOLD_DOCKER.PROFILE}/${payload.id}` : API_ENDPOINTS.PROFILE_THRESHOLD_DOCKER.PROFILE
160
+ await GET(
161
+ {
162
+ ...config,
163
+ endPoint: endPoint,
164
+ },
165
+ {
166
+ params: payload?.id ? "" : payload?.params
167
+ },
168
+ async (data: any) => {
169
+ onData(data?.data?.profile);
170
+ },
171
+ async (error: IError) => {
172
+ onError(error);
173
+ }
174
+ );
175
+ }
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/dipon_customer_transaction_package_v3.iml" filepath="$PROJECT_DIR$/.idea/dipon_customer_transaction_package_v3.iml" />
6
- </modules>
7
- </component>
8
- </project>