@zeniai/client-epic-state 4.8.31 → 4.8.33

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.
@@ -119,6 +119,7 @@ export declare const getBillPayConfigList: (billPayConfigState: BillPayConfigSta
119
119
  export declare const getPaymentMethodType: (billPayConfigState: BillPayConfigState, accType: AccountTypeSubConfigCodeKeyType, paymentMethod?: BillPaymentMethod | undefined, internationalTransferFeeBearerPaymentMethod?: "swift_our" | "swift_sha" | undefined) => BillPayConfig | undefined;
120
120
  export declare function getWhatForSection(updatedWhatForSection: WhatForSection | undefined): WhatForSection;
121
121
  export declare function getPaymentSection(state: RootState, withdrawFromList: TransferMoneyParty[], updatedPaymentSection: PaymentDetailsSection): PaymentDetailsSectionView;
122
+ export declare const getActualPaymentTypeBasedOnAccType: (availablePaymentOptions: BillPayConfig[], withdrawFromAccType: AccountTypeSubConfigCodeKeyType, currentPaymentType?: BillPayConfig | undefined) => BillPayConfig | undefined;
122
123
  export declare function toPaymentToOption(paymentMode: PaymentMode): PaymentToOption;
123
124
  export declare function getCurrentPaymentToOption(state: RootState, id: ID): PaymentToOption | undefined;
124
125
  export interface PaymentDetailsSectionView {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getWithdrawFrom = exports.getRecurringBillLocalData = exports.getCurrentPaymentToOption = exports.toPaymentToOption = exports.getPaymentSection = exports.getWhatForSection = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
6
+ exports.getWithdrawFrom = exports.getRecurringBillLocalData = exports.getCurrentPaymentToOption = exports.toPaymentToOption = exports.getActualPaymentTypeBasedOnAccType = exports.getPaymentSection = exports.getWhatForSection = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const has_1 = __importDefault(require("lodash/has"));
9
9
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
@@ -437,7 +437,7 @@ function getPaymentSection(state, withdrawFromList, updatedPaymentSection) {
437
437
  return {
438
438
  paymentType: isSinglePaymentTypeOption
439
439
  ? availablePaymentOptions[0]
440
- : (_a = updatedPaymentSection.paymentType) !== null && _a !== void 0 ? _a : undefined,
440
+ : (0, exports.getActualPaymentTypeBasedOnAccType)(availablePaymentOptions, (_a = withdrawFrom === null || withdrawFrom === void 0 ? void 0 : withdrawFrom.accType) !== null && _a !== void 0 ? _a : 'depositAccount', updatedPaymentSection.paymentType),
441
441
  paymentDate: (_b = updatedPaymentSection === null || updatedPaymentSection === void 0 ? void 0 : updatedPaymentSection.paymentDate) !== null && _b !== void 0 ? _b : undefined,
442
442
  withdrawFrom: withdrawFrom,
443
443
  withdrawFromAccountingName,
@@ -449,6 +449,21 @@ function getPaymentSection(state, withdrawFromList, updatedPaymentSection) {
449
449
  };
450
450
  }
451
451
  exports.getPaymentSection = getPaymentSection;
452
+ /*
453
+ * This is will preserve current paymentType selection but changes config
454
+ * based on withdrawFrom AccountType selected as we have cutom config values for each type now
455
+ * ex: deposit account, domestic-wire_depositAccount -> payment account, domestic-wire_paymentAccount
456
+ */
457
+ const getActualPaymentTypeBasedOnAccType = (availablePaymentOptions, withdrawFromAccType, currentPaymentType) => {
458
+ let actualPaymentType = currentPaymentType;
459
+ if (actualPaymentType != null &&
460
+ actualPaymentType.method.includes(withdrawFromAccType) === false) {
461
+ actualPaymentType = availablePaymentOptions.find((option) => option.method.replace(/(_depositAccount|_paymentAccount)/g, '') ===
462
+ (actualPaymentType === null || actualPaymentType === void 0 ? void 0 : actualPaymentType.method.replace(/(_depositAccount|_paymentAccount)/g, '')));
463
+ }
464
+ return actualPaymentType;
465
+ };
466
+ exports.getActualPaymentTypeBasedOnAccType = getActualPaymentTypeBasedOnAccType;
452
467
  function toPaymentToOption(paymentMode) {
453
468
  const paymentToOption = {
454
469
  id: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.31",
3
+ "version": "4.8.33",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",