@zeniai/client-epic-state 4.8.12 → 4.8.14

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.
Files changed (41) hide show
  1. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +4 -2
  2. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +24 -3
  3. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +11 -3
  4. package/lib/entity/billPay/billTransaction/billTransactionState.js +12 -1
  5. package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -1
  6. package/lib/entity/reimbursement/reimbursementPayload.js +12 -3
  7. package/lib/entity/reimbursement/reimbursementState.d.ts +7 -3
  8. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +22 -5
  9. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +2 -0
  10. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.d.ts +1 -1
  11. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +2 -3
  12. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +6 -7
  13. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +21 -26
  14. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.d.ts +0 -4
  15. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +2 -1
  16. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +3 -1
  17. package/lib/view/spendManagement/billPay/billList/billListSelector.js +4 -3
  18. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigPayload.d.ts +10 -8
  19. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigPayload.js +38 -38
  20. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigReducer.js +14 -4
  21. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
  22. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +2 -2
  23. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +8 -48
  24. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +11 -5
  25. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +69 -50
  26. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +2 -1
  27. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.d.ts +2 -1
  28. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +13 -7
  29. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +6 -9
  30. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +14 -12
  31. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +27 -25
  32. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.d.ts +5 -0
  33. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +41 -30
  34. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferMoneyEpic.js +4 -4
  35. package/lib/view/vendorReviewView/common/payload/commonTypes.js +15 -10
  36. package/lib/view/vendorReviewView/common/state/commonTypes.js +11 -9
  37. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewViewEpic.js +3 -7
  38. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +4 -3
  39. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewSelector.js +4 -4
  40. package/lib/view/vendorReviewView/vendorGlobalReviewView/epics/fetchVendorGlobalReviewViewEpic.js +6 -9
  41. package/package.json +1 -1
@@ -41,8 +41,8 @@ export interface CountryPayload {
41
41
  }
42
42
  export declare type BillCurrenciesPayload = Record<BillPaymentConfigCodeType, Record<BillPaymentSubConfigCodeType, CurrencyPayload[]>>;
43
43
  export interface PaymentTimeline {
44
- ach: Record<PaymentAchSubConfigCodeType, ConfigTimelinePayload>;
45
- wire: Record<BillPaymentWireSubConfigCodeType, ConfigTimelinePayload>;
44
+ ach: Record<PaymentAchSubConfigCodeType, ConfigTimelineForAccTypePayload>;
45
+ wire: Record<BillPaymentWireSubConfigCodeType, ConfigTimelineForAccTypePayload>;
46
46
  }
47
47
  export interface ClassConfig {
48
48
  ach: Record<PaymentAchSubConfigCodeType, ClassBasePayload>;
@@ -63,13 +63,14 @@ export interface InternationalWireConfig {
63
63
  'usd-to-usd': Record<InternationalSubConfigCodeType, BillPayConfigFeePayload>;
64
64
  }
65
65
  export interface WireConfig {
66
- international: InternationalWireConfig;
67
- 'us-domestic': BillPayConfigFeePayload;
66
+ international: Record<AccType, InternationalWireConfig>;
67
+ 'us-domestic': BillPayConfigFeeForAccTypePayload;
68
68
  }
69
69
  export interface FeesConfig {
70
- ach: Record<PaymentAchSubConfigCodeType, BillPayConfigFeePayload>;
70
+ ach: Record<PaymentAchSubConfigCodeType, BillPayConfigFeeForAccTypePayload>;
71
71
  wire: WireConfig;
72
72
  }
73
+ export declare type BillPayConfigFeeForAccTypePayload = Record<AccType, BillPayConfigFeePayload>;
73
74
  export interface BillPayConfigFeePayload {
74
75
  amount: number;
75
76
  description: string;
@@ -80,6 +81,7 @@ export interface BillPayConfigFeePayload {
80
81
  dynamic_fee?: number | null;
81
82
  dynamic_fee_type?: string | null;
82
83
  }
84
+ export declare type ConfigTimelineForAccTypePayload = Record<AccType, ConfigTimelinePayload>;
83
85
  export interface ConfigTimelinePayload {
84
86
  max: ConfigTimelineFieldsPayload;
85
87
  min: ConfigTimelineFieldsPayload;
@@ -105,15 +107,15 @@ export interface FeeDetail {
105
107
  description: string;
106
108
  internationalFee?: InternationalFee;
107
109
  }
108
- export declare const getFeeDetail: (fees: FeesConfig, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType, internationalMethod?: "usd-to-local-currency" | "usd-to-usd" | undefined, internationalSubMethod?: "swift_our" | "swift_sha" | undefined) => FeeDetail;
110
+ export declare const getFeeDetail: (fees: FeesConfig, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType, accType: AccType, internationalMethod?: "usd-to-local-currency" | "usd-to-usd" | undefined, internationalSubMethod?: "swift_our" | "swift_sha" | undefined) => FeeDetail;
109
111
  export interface TimelineDetail {
110
112
  minPeriod: ConfigPeriod;
111
113
  maxPeriod: ConfigPeriod;
112
114
  }
113
- export declare const getTimelineDetail: (paymentTimeline: PaymentTimeline, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType) => TimelineDetail;
115
+ export declare const getTimelineDetail: (paymentTimeline: PaymentTimeline, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType, accType: AccType) => TimelineDetail;
114
116
  export declare const getAccountDetail: (account: AccountConfig, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType) => AccountBasePayload;
115
117
  export declare const getClassDetail: (classConfig: ClassConfig, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType) => ClassBasePayload;
116
- export declare const mapBillPayConfigPayloadToBillPayConfig: (paymentProcessor: BillPayConfigPaymentProcessorPayload, isEnabled: boolean, isVerified: boolean, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType, internationalMethod?: "usd-to-local-currency" | "usd-to-usd" | undefined, internationalSubMethod?: "swift_our" | "swift_sha" | undefined) => BillPayConfig;
118
+ export declare const mapBillPayConfigPayloadToBillPayConfig: (paymentProcessor: BillPayConfigPaymentProcessorPayload, isEnabled: boolean, isVerified: boolean, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType, accType: AccType, internationalMethod?: "usd-to-local-currency" | "usd-to-usd" | undefined, internationalSubMethod?: "swift_our" | "swift_sha" | undefined) => BillPayConfig;
117
119
  export declare const mapFeePayloadToInternationalLocalAmountFeeAmount: (fees: BillPayConfigFeePayload) => InternationalFee;
118
120
  export declare const getCurrencies: (supportedCurrencies: SupportedCurrencyPayload, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType) => CurrencyPayload[];
119
121
  export declare const mapBillPayVendorConfigPayloadToBillPayVendorConfig: (payload: BillPayConfigPayload, code: BillPaymentConfigCodeType, subCode: BillPaymentSubConfigCodeType) => Currency[];
@@ -72,7 +72,7 @@ const getAccountTypeSubConfigCodeKey = (subCode) => {
72
72
  }
73
73
  };
74
74
  exports.getAccountTypeSubConfigCodeKey = getAccountTypeSubConfigCodeKey;
75
- const getFeeDetail = (fees, code, subCode, internationalMethod, internationalSubMethod) => {
75
+ const getFeeDetail = (fees, code, subCode, accType, internationalMethod, internationalSubMethod) => {
76
76
  let feeAmount = {
77
77
  amount: 0,
78
78
  currencyCode: 'USD',
@@ -82,51 +82,51 @@ const getFeeDetail = (fees, code, subCode, internationalMethod, internationalSub
82
82
  let internationalFee;
83
83
  if (code === 'ach') {
84
84
  feeAmount = {
85
- amount: fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].amount,
86
- currencyCode: fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].currency_code,
87
- currencySymbol: fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].currency_symbol,
85
+ amount: fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType].amount,
86
+ currencyCode: fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType]
87
+ .currency_code,
88
+ currencySymbol: fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType]
89
+ .currency_symbol,
88
90
  };
89
91
  description =
90
- fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].description;
92
+ fees[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType].description;
91
93
  }
92
94
  else if (subCode === 'international') {
93
95
  if (internationalMethod === 'usd-to-local-currency') {
94
96
  feeAmount = {
95
- amount: fees.wire[subCode][internationalMethod].amount,
96
- currencyCode: fees.wire[subCode][internationalMethod].currency_code,
97
- currencySymbol: fees.wire[subCode][internationalMethod].currency_symbol,
97
+ amount: fees.wire[subCode][accType][internationalMethod].amount,
98
+ currencyCode: fees.wire[subCode][accType][internationalMethod].currency_code,
99
+ currencySymbol: fees.wire[subCode][accType][internationalMethod].currency_symbol,
98
100
  };
99
- description = fees.wire[subCode][internationalMethod].description;
100
- internationalFee = (0, exports.mapFeePayloadToInternationalLocalAmountFeeAmount)(fees.wire[subCode][internationalMethod]);
101
+ description =
102
+ fees.wire[subCode][accType][internationalMethod].description;
103
+ internationalFee = (0, exports.mapFeePayloadToInternationalLocalAmountFeeAmount)(fees.wire[subCode][accType][internationalMethod]);
101
104
  }
102
105
  else if (internationalMethod === 'usd-to-usd' &&
103
106
  (internationalSubMethod === 'swift_our' ||
104
107
  internationalSubMethod === 'swift_sha')) {
105
108
  feeAmount = {
106
- amount: fees.wire[subCode][internationalMethod][internationalSubMethod]
107
- .amount,
108
- currencyCode: fees.wire[subCode][internationalMethod][internationalSubMethod]
109
- .currency_code,
110
- currencySymbol: fees.wire[subCode][internationalMethod][internationalSubMethod]
111
- .currency_symbol,
109
+ amount: fees.wire[subCode][accType][internationalMethod][internationalSubMethod].amount,
110
+ currencyCode: fees.wire[subCode][accType][internationalMethod][internationalSubMethod].currency_code,
111
+ currencySymbol: fees.wire[subCode][accType][internationalMethod][internationalSubMethod].currency_symbol,
112
112
  };
113
113
  description =
114
- fees.wire[subCode][internationalMethod][internationalSubMethod]
114
+ fees.wire[subCode][accType][internationalMethod][internationalSubMethod]
115
115
  .description;
116
116
  }
117
117
  }
118
118
  else if (subCode === 'us-domestic') {
119
119
  feeAmount = {
120
- amount: fees.wire[subCode].amount,
121
- currencyCode: fees.wire[subCode].currency_code,
122
- currencySymbol: fees.wire[subCode].currency_symbol,
120
+ amount: fees.wire[subCode][accType].amount,
121
+ currencyCode: fees.wire[subCode][accType].currency_code,
122
+ currencySymbol: fees.wire[subCode][accType].currency_symbol,
123
123
  };
124
- description = fees.wire[subCode].description;
124
+ description = fees.wire[subCode][accType].description;
125
125
  }
126
126
  return { feeAmount, description, internationalFee };
127
127
  };
128
128
  exports.getFeeDetail = getFeeDetail;
129
- const getTimelineDetail = (paymentTimeline, code, subCode) => {
129
+ const getTimelineDetail = (paymentTimeline, code, subCode, accType) => {
130
130
  let minPeriod = {
131
131
  value: 0,
132
132
  units: 'days',
@@ -137,26 +137,26 @@ const getTimelineDetail = (paymentTimeline, code, subCode) => {
137
137
  };
138
138
  if (code === 'ach') {
139
139
  minPeriod = {
140
- value: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].min.value,
141
- units: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].min.units,
140
+ value: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType]
141
+ .min.value,
142
+ units: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType]
143
+ .min.units,
142
144
  };
143
145
  maxPeriod = {
144
- value: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].max.value,
145
- units: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)].max.units,
146
+ value: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType]
147
+ .max.value,
148
+ units: paymentTimeline[code][(0, billPayConfigState_1.toPaymentAchSubMethodCodeType)(subCode)][accType]
149
+ .max.units,
146
150
  };
147
151
  }
148
152
  else if (code === 'wire') {
149
153
  minPeriod = {
150
- value: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)].min
151
- .value,
152
- units: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)].min
153
- .units,
154
+ value: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)][accType].min.value,
155
+ units: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)][accType].min.units,
154
156
  };
155
157
  maxPeriod = {
156
- value: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)].max
157
- .value,
158
- units: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)].max
159
- .units,
158
+ value: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)][accType].max.value,
159
+ units: paymentTimeline[code][(0, billPayConfigState_1.toBillPaymentWireSubMethodCodeType)(subCode)][accType].max.units,
160
160
  };
161
161
  }
162
162
  return { minPeriod, maxPeriod };
@@ -194,14 +194,14 @@ const getClassDetail = (classConfig, code, subCode) => {
194
194
  return classBasePayload;
195
195
  };
196
196
  exports.getClassDetail = getClassDetail;
197
- const mapBillPayConfigPayloadToBillPayConfig = (paymentProcessor, isEnabled, isVerified, code, subCode, internationalMethod, internationalSubMethod) => {
197
+ const mapBillPayConfigPayloadToBillPayConfig = (paymentProcessor, isEnabled, isVerified, code, subCode, accType, internationalMethod, internationalSubMethod) => {
198
198
  const { payment_timeline, fees, account, class: classPayload, } = paymentProcessor;
199
- const { feeAmount, description, internationalFee } = (0, exports.getFeeDetail)(fees, code, subCode, internationalMethod, internationalSubMethod);
200
- const { minPeriod, maxPeriod } = (0, exports.getTimelineDetail)(payment_timeline, code, subCode);
199
+ const { feeAmount, description, internationalFee } = (0, exports.getFeeDetail)(fees, code, subCode, accType, internationalMethod, internationalSubMethod);
200
+ const { minPeriod, maxPeriod } = (0, exports.getTimelineDetail)(payment_timeline, code, subCode, accType);
201
201
  return {
202
202
  minPeriod: minPeriod,
203
203
  maxPeriod: maxPeriod,
204
- method: (0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigState_1.toBillPaymentSubConfigCodeKeyType)((0, exports.getBillPaymentSubConfigCodeKey)(subCode)), internationalMethod != null
204
+ method: (0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigState_1.toBillPaymentSubConfigCodeKeyType)((0, exports.getBillPaymentSubConfigCodeKey)(subCode)), (0, exports.getAccountTypeSubConfigCodeKey)(accType), internationalMethod != null
205
205
  ? (0, exports.getInternationalWireMethodCodeKey)(internationalMethod)
206
206
  : undefined, internationalSubMethod != null
207
207
  ? (0, exports.getInternationalSubConfigCodeKey)(internationalSubMethod)
@@ -35,7 +35,11 @@ const billPayConfig = (0, toolkit_1.createSlice)({
35
35
  switch (code) {
36
36
  case 'ach': {
37
37
  billPayConfigState_1.PAYMENT_ACH_SUB_CODES.forEach((subCode) => {
38
- draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getPaymentAchSubConfigCodeKey)(subCode))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, subCode === 'standard' ? true : payload.is_same_day_ach_enabled, true, code, subCode);
38
+ billPayConfigState_1.ACCOUNT_TYPE_CODES.forEach((accType) => {
39
+ draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getPaymentAchSubConfigCodeKey)(subCode), (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)(accType))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, subCode === 'standard'
40
+ ? true
41
+ : payload.is_same_day_ach_enabled, true, code, subCode, accType);
42
+ });
39
43
  draft.vendor.supportedCurrencies[(0, billPayConfigState_1.getBillPayConfigKey)(code, (0, billPayConfigPayload_1.getPaymentAchSubConfigCodeKey)(subCode))] = (0, billPayConfigPayload_1.mapBillPayVendorConfigPayloadToBillPayVendorConfig)(payload, code, subCode);
40
44
  });
41
45
  break;
@@ -43,17 +47,23 @@ const billPayConfig = (0, toolkit_1.createSlice)({
43
47
  case 'wire': {
44
48
  billPayConfigState_1.BILL_PAYMENT_WIRE_SUB_CODES.forEach((subCode) => {
45
49
  if (subCode === 'us-domestic') {
46
- draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getBillPaymentWireSubConfigCodeKey)(subCode))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, payload.is_us_domestic_wire_enabled, true, code, subCode);
50
+ billPayConfigState_1.ACCOUNT_TYPE_CODES.forEach((accType) => {
51
+ draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getBillPaymentWireSubConfigCodeKey)(subCode), (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)(accType))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, payload.is_us_domestic_wire_enabled, true, code, subCode, accType);
52
+ });
47
53
  draft.vendor.supportedCurrencies[(0, billPayConfigState_1.getBillPayConfigKey)(code, (0, billPayConfigPayload_1.getBillPaymentWireSubConfigCodeKey)(subCode))] = (0, billPayConfigPayload_1.mapBillPayVendorConfigPayloadToBillPayVendorConfig)(payload, code, subCode);
48
54
  }
49
55
  else if (subCode === 'international') {
50
56
  billPayConfigState_1.INTERNATIONAL_CODES.forEach((internationalWireCode) => {
51
57
  if (internationalWireCode === 'usd-to-local-currency') {
52
- draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getBillPaymentWireSubConfigCodeKey)(subCode), (0, billPayConfigPayload_1.getInternationalWireMethodCodeKey)(internationalWireCode))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, payload.is_international_wire_enabled, payload.is_international_wires_verified, code, subCode, internationalWireCode);
58
+ billPayConfigState_1.ACCOUNT_TYPE_CODES.forEach((accType) => {
59
+ draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getBillPaymentWireSubConfigCodeKey)(subCode), (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)(accType), (0, billPayConfigPayload_1.getInternationalWireMethodCodeKey)(internationalWireCode))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, payload.is_international_wire_enabled, payload.is_international_wires_verified, code, subCode, accType, internationalWireCode);
60
+ });
53
61
  }
54
62
  else if (internationalWireCode === 'usd-to-usd') {
55
63
  billPayConfigState_1.INTERNATIONAL_SUB_CODES.forEach((internationalWireSubCode) => {
56
- draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getBillPaymentWireSubConfigCodeKey)(subCode), (0, billPayConfigPayload_1.getInternationalWireMethodCodeKey)(internationalWireCode), (0, billPayConfigPayload_1.getInternationalSubConfigCodeKey)(internationalWireSubCode))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, payload.is_international_wire_enabled, payload.is_international_wires_verified, code, subCode, internationalWireCode, internationalWireSubCode);
64
+ billPayConfigState_1.ACCOUNT_TYPE_CODES.forEach((accType) => {
65
+ draft.methodById[(0, billPayConfigState_1.getBillPayConfigMethodKey)(code, (0, billPayConfigPayload_1.getBillPaymentWireSubConfigCodeKey)(subCode), (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)(accType), (0, billPayConfigPayload_1.getInternationalWireMethodCodeKey)(internationalWireCode), (0, billPayConfigPayload_1.getInternationalSubConfigCodeKey)(internationalWireSubCode))] = (0, billPayConfigPayload_1.mapBillPayConfigPayloadToBillPayConfig)(payload.payment_processor, payload.is_international_wire_enabled, payload.is_international_wires_verified, code, subCode, accType, internationalWireCode, internationalWireSubCode);
66
+ });
57
67
  });
58
68
  }
59
69
  });
@@ -4,7 +4,7 @@ import { AccountBase } from '../../../../entity/account/accountState';
4
4
  import { ClassBase } from '../../../../entity/class/classState';
5
5
  export declare const getBillPayConfigKey: (method: string, subMethod: string) => string;
6
6
  export declare type BillPayConfigKey = ReturnType<typeof getBillPayConfigKey>;
7
- export declare const getBillPayConfigMethodKey: (method: BillPaymentConfigCodeType, subMethod: BillPaymentSubConfigCodeKeyType, internationalMethod?: "usdToLocalCurrency" | "usdToUsd" | undefined, internationalSubMethod?: "swiftOur" | "swiftSha" | undefined) => string;
7
+ export declare const getBillPayConfigMethodKey: (method: BillPaymentConfigCodeType, subMethod: BillPaymentSubConfigCodeKeyType, accType: AccountTypeSubConfigCodeKeyType, internationalMethod?: "usdToLocalCurrency" | "usdToUsd" | undefined, internationalSubMethod?: "swiftOur" | "swiftSha" | undefined) => string;
8
8
  export declare type VendorCurrencyConfig = Record<BillPayConfigKey, Currency[]>;
9
9
  export declare const DYNAMIC_FEE_TYPE: readonly ["percent", "fixed"];
10
10
  export declare const toDynamicFeeType: (v: string) => "fixed" | "percent";
@@ -8,8 +8,8 @@ const getBillPayConfigKey = (method, subMethod) => {
8
8
  return (0, common_1.getUnderScoreKey)(keys);
9
9
  };
10
10
  exports.getBillPayConfigKey = getBillPayConfigKey;
11
- const getBillPayConfigMethodKey = (method, subMethod, internationalMethod, internationalSubMethod) => {
12
- const keys = ['billPay', method, subMethod];
11
+ const getBillPayConfigMethodKey = (method, subMethod, accType, internationalMethod, internationalSubMethod) => {
12
+ const keys = ['billPay', method, subMethod, accType];
13
13
  if (internationalMethod != null) {
14
14
  keys.push(internationalMethod);
15
15
  }
@@ -12,7 +12,8 @@ const billDetailViewState_1 = require("../billDetailView/billDetailViewState");
12
12
  const contactSelector_1 = require("../../../../entity/billPay/contact/contactSelector");
13
13
  const editBillViewSelector_1 = require("../editBillView/editBillViewSelector");
14
14
  const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
15
- const accountSelector_1 = require("../../../../entity/account/accountSelector");
15
+ const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
16
+ const transferDetailSelector_1 = require("../../zeniAccounts/transferDetail/transferDetailSelector");
16
17
  const getDuplicateBills = (state, billId) => {
17
18
  var _a, _b;
18
19
  const { billTransactionState, billPayReviewState } = state;
@@ -36,7 +37,7 @@ const getDuplicateBills = (state, billId) => {
36
37
  exports.getDuplicateBills = getDuplicateBills;
37
38
  const getReviewPageBillDetail = (state, billId) => {
38
39
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
39
- const { accountListState, accountState, setupViewState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, recurringBillState, } = state;
40
+ const { accountListState, accountState, setupViewState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, recurringBillState, depositAccountState, depositAccountListState, } = state;
40
41
  const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
41
42
  const sourceBillDetail = billId != null
42
43
  ? (_a = editBillDetailViewState.editBillStateById) === null || _a === void 0 ? void 0 : _a[key]
@@ -46,7 +47,9 @@ const getReviewPageBillDetail = (state, billId) => {
46
47
  let paymentDetailsSection;
47
48
  let file;
48
49
  let contactDetails = [];
49
- const withdrawFromList = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, setupViewState.accountDetails.paymentAccountIds);
50
+ const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, setupViewState.accountDetails.paymentAccountIds);
51
+ const allDepositAccounts = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState).depositAccounts;
52
+ const withdrawFromList = (0, transferDetailSelector_1.getTransferMoneyParties)(allDepositAccounts, primaryPaymentAccount);
50
53
  let fetchState = 'Not-Started';
51
54
  let sourceBillDetailFetchState = 'Not-Started';
52
55
  const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
@@ -84,10 +87,10 @@ const getReviewPageBillDetail = (state, billId) => {
84
87
  }
85
88
  if (sourceBillDetail != null && sourceBillDetailFetchState == 'Completed') {
86
89
  const updatedRecord = sourceBillDetail.billDetailLocalData;
87
- whatForSection = getWhatForSection(updatedRecord.whatForSection);
90
+ whatForSection = (0, editBillViewSelector_1.getWhatForSection)(updatedRecord.whatForSection);
88
91
  paymentDetailsSection =
89
92
  updatedRecord.paymentDetailsSection != null
90
- ? getPaymentSection(state, withdrawFromList, updatedRecord.paymentDetailsSection)
93
+ ? (0, editBillViewSelector_1.getPaymentSection)(state, withdrawFromList, updatedRecord.paymentDetailsSection)
91
94
  : undefined;
92
95
  vendorDetails =
93
96
  updatedRecord.vendor != null
@@ -163,46 +166,3 @@ const getReviewPageBillDetail = (state, billId) => {
163
166
  };
164
167
  };
165
168
  exports.getReviewPageBillDetail = getReviewPageBillDetail;
166
- function getWhatForSection(updatedWhatForSection) {
167
- var _a, _b, _c, _d;
168
- return {
169
- invoiceNumber: (updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.invoiceNumber) != null &&
170
- ((_a = updatedWhatForSection.invoiceNumber) === null || _a === void 0 ? void 0 : _a.length) > 0
171
- ? updatedWhatForSection.invoiceNumber
172
- : '',
173
- invoiceDate: (_b = updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.invoiceDate) !== null && _b !== void 0 ? _b : undefined,
174
- billDueDate: (_c = updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.billDueDate) !== null && _c !== void 0 ? _c : undefined,
175
- memo: (updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.memo) != null &&
176
- ((_d = updatedWhatForSection.memo) === null || _d === void 0 ? void 0 : _d.length) > 0
177
- ? updatedWhatForSection.memo
178
- : '',
179
- };
180
- }
181
- function getPaymentSection(state, withdrawFromList, updatedPaymentSection) {
182
- var _a, _b, _c;
183
- const { accountState, paymentAccountState } = state;
184
- const withdrawFrom = (updatedPaymentSection === null || updatedPaymentSection === void 0 ? void 0 : updatedPaymentSection.withdrawFrom) != null
185
- ? (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, updatedPaymentSection.withdrawFrom)
186
- : withdrawFromList.length > 0
187
- ? withdrawFromList[0]
188
- : undefined;
189
- const withdrawFromAccountingName = (withdrawFrom === null || withdrawFrom === void 0 ? void 0 : withdrawFrom.zeniAccountId) != null &&
190
- (withdrawFrom === null || withdrawFrom === void 0 ? void 0 : withdrawFrom.zeniAccountId.length) > 0
191
- ? (_a = (0, accountSelector_1.getAccountBase)(accountState, withdrawFrom === null || withdrawFrom === void 0 ? void 0 : withdrawFrom.zeniAccountId, 'bill_pay')) === null || _a === void 0 ? void 0 : _a.accountName
192
- : '';
193
- const isSinglePaymentTypeOption = state.billPayConfigState.fetchState === 'Completed' &&
194
- (0, editBillViewSelector_1.getBillPayConfigList)(state.billPayConfigState).length === 1;
195
- return {
196
- internationalTransferFeeBearerPaymentMethod: updatedPaymentSection.internationalTransferFeeBearerPaymentMethod,
197
- paymentType: isSinglePaymentTypeOption
198
- ? (0, editBillViewSelector_1.getBillPayConfigList)(state.billPayConfigState)[0]
199
- : (_b = updatedPaymentSection.paymentType) !== null && _b !== void 0 ? _b : undefined,
200
- paymentDate: (_c = updatedPaymentSection === null || updatedPaymentSection === void 0 ? void 0 : updatedPaymentSection.paymentDate) !== null && _c !== void 0 ? _c : undefined,
201
- withdrawFrom: withdrawFrom,
202
- withdrawFromAccountingName: withdrawFromAccountingName,
203
- paymentTo: updatedPaymentSection.paymentTo != null
204
- ? (0, editBillViewSelector_1.getCurrentPaymentToOption)(state, updatedPaymentSection.paymentTo)
205
- : undefined,
206
- conversionRate: updatedPaymentSection.conversionRate,
207
- };
208
- }
@@ -3,7 +3,7 @@ import { RootState } from '../../../../reducer';
3
3
  import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
4
4
  import { Amount } from '../../../../commonStateTypes/amount';
5
5
  import { BillPayInfo, BillPaymentMethod, BillStageCodeType, BillTransaction, InternationalTransferFeeBearerPaymentMethod } from '../../../../entity/billPay/billTransaction/billTransactionState';
6
- import { PaymentAccount } from '../../../../entity/paymentAccount/paymentAccountState';
6
+ import { PaymentAccountState } from '../../../../entity/paymentAccount/paymentAccountState';
7
7
  import { Attachment } from '../../../../entity/transaction/stateTypes/attachment';
8
8
  import { TransactionWithAccountAndClassLine } from '../../../../entity/transaction/stateTypes/transactionLine';
9
9
  import { Vendor } from '../../../../entity/vendor/vendorState';
@@ -11,11 +11,11 @@ import { ZeniDate } from '../../../../zeniDayJS';
11
11
  import { AccountListSelectorView } from '../../../accountList/accountListSelector';
12
12
  import { ClassListSelectorView } from '../../../classList/classListSelector';
13
13
  import { PreviousBillsSelectorView } from '../previousBills/previousBillsSelector';
14
- import { AddBillAutoFields, WhatForSection, PaymentModeType, PaymentMode, RecurringBillConfigLocalData, RecurringBillInstance } from './editBillViewState';
14
+ import { AddBillAutoFields, PaymentDetailsSection, WhatForSection, PaymentModeType, PaymentMode, RecurringBillConfigLocalData, RecurringBillInstance } from './editBillViewState';
15
15
  import { BillActivity } from '../billDetailView/billDetailViewSelector';
16
16
  import { BillPaySetupApproverView } from '../billPaySetupApproverView/billPaySetupApproverViewSelectorTypes';
17
17
  import { User } from '../../../../entity/user/userState';
18
- import { BillPayConfig, BillPayConfigState } from '../billPayConfig/billPayConfigState';
18
+ import { BillPayConfig, BillPayConfigState, AccountTypeSubConfigCodeKeyType } from '../billPayConfig/billPayConfigState';
19
19
  import { ActivityHistorySelectorView } from '../../commonHistoryView/commonHistorySelector';
20
20
  import { NestedAccountHeirarchyForReport } from '../../../../commonStateTypes/accountView/nestedAccountID';
21
21
  import { NestedClassHeirarchyForReport } from '../../../../commonStateTypes/classesView/nestedClassID';
@@ -26,6 +26,8 @@ import { VendorDetailLocalData } from '../../../commonVendorView/vendorView/vend
26
26
  import { AccountBase, RecommendedAccountBase } from '../../../../entity/account/accountState';
27
27
  import { ClassBase, RecommendedClassBase } from '../../../../entity/class/classState';
28
28
  import { RecurringBillState } from '../../../../entity/billPay/recurringBills/recurringBillsState';
29
+ import { TransferMoneyParty } from '../../zeniAccounts/transferDetail/transferDetailState';
30
+ import { DepositAccountState } from '../../../../entity/depositAccount/depositAccount';
29
31
  export declare type PaymentToOption = {
30
32
  id: ID;
31
33
  type: PaymentModeType;
@@ -103,6 +105,7 @@ export interface EditBillDetailSelectorView extends SelectorView {
103
105
  isRecurring: boolean;
104
106
  recurringConfig?: RecurringBillConfigLocalData;
105
107
  recurringBillInstances?: RecurringBillInstance[];
108
+ withdrawFromList: TransferMoneyParty[];
106
109
  }
107
110
  export interface EditBillInitialDetails {
108
111
  vendor?: Vendor;
@@ -113,13 +116,15 @@ export interface EditBillInitialDetails {
113
116
  }
114
117
  export declare const getEditBillDetail: (state: RootState, isVendorRecommendationFeatureEnabled: boolean, billId?: string | undefined) => EditBillDetailSelectorView;
115
118
  export declare const getBillPayConfigList: (billPayConfigState: BillPayConfigState) => BillPayConfig[];
116
- export declare const getPaymentMethodType: (billPayConfigState: BillPayConfigState, paymentMethod?: BillPaymentMethod | undefined, internationalTransferFeeBearerPaymentMethod?: "swift_our" | "swift_sha" | undefined) => BillPayConfig | undefined;
119
+ export declare const getPaymentMethodType: (billPayConfigState: BillPayConfigState, accType: AccountTypeSubConfigCodeKeyType, paymentMethod?: BillPaymentMethod | undefined, internationalTransferFeeBearerPaymentMethod?: "swift_our" | "swift_sha" | undefined) => BillPayConfig | undefined;
120
+ export declare function getWhatForSection(updatedWhatForSection: WhatForSection | undefined): WhatForSection;
121
+ export declare function getPaymentSection(state: RootState, withdrawFromList: TransferMoneyParty[], updatedPaymentSection: PaymentDetailsSection): PaymentDetailsSectionView;
117
122
  export declare function toPaymentToOption(paymentMode: PaymentMode): PaymentToOption;
118
123
  export declare function getCurrentPaymentToOption(state: RootState, id: ID): PaymentToOption | undefined;
119
124
  export interface PaymentDetailsSectionView {
120
125
  paymentType?: BillPayConfig;
121
126
  paymentDate?: ZeniDate;
122
- withdrawFrom?: PaymentAccount;
127
+ withdrawFrom?: TransferMoneyParty;
123
128
  withdrawFromAccountingName?: string;
124
129
  paymentTo?: PaymentToOption;
125
130
  internationalTransferFeeBearerPaymentMethod?: InternationalTransferFeeBearerPaymentMethod;
@@ -129,3 +134,4 @@ export declare const getRecurringBillLocalData: (recurringBillState: RecurringBi
129
134
  recurringBillInstancesLocalData: RecurringBillInstance[];
130
135
  recurringConfigLocalData?: RecurringBillConfigLocalData | undefined;
131
136
  };
137
+ export declare const getWithdrawFrom: (paymentAccountState: PaymentAccountState, depositAccountState: DepositAccountState, fromAccountId: ID, fromAccountType: string) => TransferMoneyParty | undefined;