@zeniai/client-epic-state 5.1.98 → 5.2.0-beta0AK
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.
- package/lib/commonStateTypes/accountView/nestedAccountID.d.ts +0 -3
- package/lib/commonStateTypes/accountView/nestedAccountID.js +1 -4
- package/lib/commonStateTypes/coaBalance/coaBalance.d.ts +0 -5
- package/lib/commonStateTypes/timePeriod.d.ts +0 -2
- package/lib/commonStateTypes/timePeriod.js +1 -6
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +12 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +18 -0
- package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.d.ts +16 -0
- package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.js +20 -0
- package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerSelector.d.ts +8 -1
- package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerSelector.js +48 -0
- package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerState.d.ts +24 -0
- package/lib/entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload.d.ts +1 -0
- package/lib/entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload.js +1 -0
- package/lib/entity/invoicing/invoicingSubscription/invoicingSubscriptionState.d.ts +1 -0
- package/lib/entity/invoicing/invoicingTransaction/invoicingTransactionPayload.d.ts +1 -1
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +0 -1
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.js +0 -1
- package/lib/entity/transaction/toSupportedTransaction.d.ts +1 -1
- package/lib/entity/transaction/toSupportedTransaction.js +0 -1
- package/lib/esm/commonStateTypes/accountView/nestedAccountID.js +0 -3
- package/lib/esm/commonStateTypes/timePeriod.js +0 -4
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +16 -0
- package/lib/esm/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.js +20 -0
- package/lib/esm/entity/invoicing/invoicingCustomer/invoicingCustomerSelector.js +47 -0
- package/lib/esm/entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload.js +1 -0
- package/lib/esm/entity/toastNotification/epic/pushToastNotificationEpic.js +0 -1
- package/lib/esm/entity/transaction/toSupportedTransaction.js +1 -1
- package/lib/esm/index.js +12 -11
- package/lib/esm/view/invoicing/auditView/auditViewSelector.js +4 -0
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +18 -8
- package/lib/esm/view/invoicing/couponView/couponViewState.js +0 -9
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
- package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +4 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +1 -0
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +7 -6
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +3 -19
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +10 -5
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +6 -4
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +0 -17
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +5 -0
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +18 -17
- package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +12 -4
- package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +13 -9
- package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +5 -1
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +2 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +26 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +9 -0
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +9 -3
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +0 -9
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +5 -3
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +9 -3
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +0 -9
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +8 -3
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +1 -9
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +11 -3
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +0 -9
- package/lib/esm/view/invoicing/invoicingTabHelper.js +27 -0
- package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +5 -5
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +12 -4
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +11 -9
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +1 -8
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +5 -1
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +5 -2
- package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -26
- package/lib/esm/view/invoicing/recordPayment/recordPaymentSelector.js +26 -6
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +2 -1
- package/lib/index.d.ts +15 -14
- package/lib/index.js +9 -24
- package/lib/view/invoicing/auditView/auditViewSelector.d.ts +4 -0
- package/lib/view/invoicing/auditView/auditViewSelector.js +4 -0
- package/lib/view/invoicing/couponView/couponViewSelector.d.ts +5 -1
- package/lib/view/invoicing/couponView/couponViewSelector.js +17 -7
- package/lib/view/invoicing/couponView/couponViewState.d.ts +0 -7
- package/lib/view/invoicing/couponView/couponViewState.js +1 -10
- package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
- package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +4 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.d.ts +3 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +6 -0
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +4 -1
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +1 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +6 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.d.ts +3 -6
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +4 -20
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +9 -7
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +10 -5
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +4 -3
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +5 -3
- package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.d.ts +0 -8
- package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +1 -18
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +5 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +5 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +17 -16
- package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +3 -1
- package/lib/view/invoicing/invoiceList/invoiceListSelector.js +11 -3
- package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +13 -9
- package/lib/view/invoicing/invoiceList/invoiceListState.js +15 -10
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +9 -1
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +5 -1
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +3 -1
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +2 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +26 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +19 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +11 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +13 -0
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +8 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +8 -2
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +0 -7
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +1 -10
- package/lib/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
- package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.d.ts +2 -1
- package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +4 -2
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +3 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +8 -2
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +0 -7
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +1 -10
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts +3 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +7 -2
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -9
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +2 -10
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +7 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +10 -2
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +0 -7
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +1 -10
- package/lib/view/invoicing/invoicingTabHelper.d.ts +27 -0
- package/lib/view/invoicing/invoicingTabHelper.js +30 -0
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +4 -4
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +8 -0
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +11 -3
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +10 -10
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +13 -10
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.d.ts +0 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +2 -9
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.d.ts +2 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +5 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +3 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +4 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +6 -0
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.d.ts +0 -6
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +1 -27
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.d.ts +3 -2
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.js +26 -6
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +2 -1
- package/package.json +4 -10
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
- package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
- package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
|
@@ -32,9 +32,6 @@ type AccountIDPlus4SubAccount = [
|
|
|
32
32
|
* and so on..
|
|
33
33
|
*/
|
|
34
34
|
export type NestedAccountID = AccountIDPlus0SubAccount | AccountIDPlus1SubAccount | AccountIDPlus2SubAccount | AccountIDPlus3SubAccount | AccountIDPlus4SubAccount;
|
|
35
|
-
export declare const MAX_SUB_ACCOUNTS_SUPPORTED = 4;
|
|
36
|
-
export declare const MAX_SUB_CLASSES_SUPPORTED = 4;
|
|
37
|
-
export declare const MAX_SUB_CUSTOMERS_SUPPORTED = 4;
|
|
38
35
|
export declare function getNestedAccountIDStr(nestedAccountId: NestedAccountID): `${string}-${string}-${string}-${string}-${string}`;
|
|
39
36
|
export declare const isEqualNestedAccountId: (nestedAccountIdA: NestedAccountID, nestedAccountIdB: NestedAccountID) => boolean;
|
|
40
37
|
export interface AccountsViewParentID {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isEqualNestedAccountId =
|
|
3
|
+
exports.isEqualNestedAccountId = void 0;
|
|
4
4
|
exports.getNestedAccountIDStr = getNestedAccountIDStr;
|
|
5
|
-
exports.MAX_SUB_ACCOUNTS_SUPPORTED = 4;
|
|
6
|
-
exports.MAX_SUB_CLASSES_SUPPORTED = 4;
|
|
7
|
-
exports.MAX_SUB_CUSTOMERS_SUPPORTED = 4;
|
|
8
5
|
function getNestedAccountIDStr(nestedAccountId) {
|
|
9
6
|
const [accountId, parentAccountId, greatParentAccountId, greatGreatParentAccountId, greatGreatGreatParentAccountId,] = nestedAccountId;
|
|
10
7
|
return `${accountId}-${parentAccountId ?? ''}-${greatParentAccountId ?? ''}-${greatGreatParentAccountId ?? ''}-${greatGreatGreatParentAccountId ?? ''}`;
|
|
@@ -45,11 +45,6 @@ export interface COABalanceGrouped extends COABalanceGroupedByPeriod {
|
|
|
45
45
|
years?: COABalance;
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
export interface COABalanceWithAveragesGrouped extends COABalanceGrouped {
|
|
49
|
-
averages?: {
|
|
50
|
-
months?: COABalance;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
48
|
export interface COABalanceGroupedWithIDs extends COABalanceGrouped {
|
|
54
49
|
accountGroupIDs: string[];
|
|
55
50
|
accountIDs: string[];
|
|
@@ -26,9 +26,7 @@ export interface MonthYearPeriod {
|
|
|
26
26
|
year: number;
|
|
27
27
|
}
|
|
28
28
|
export type MonthYearPeriodId = `${Month}_${number}`;
|
|
29
|
-
export type MonthYearPeriodQuery = `${Month}-${number}`;
|
|
30
29
|
export declare const toMonthYearPeriod: (periodPayload: string) => MonthYearPeriod;
|
|
31
|
-
export declare const toMonthYearPeriodQuery: (selectedPeriod: MonthYearPeriod) => MonthYearPeriodQuery;
|
|
32
30
|
export declare const toMonthYearPeriodId: (selectedPeriod: MonthYearPeriod) => MonthYearPeriodId;
|
|
33
31
|
/**
|
|
34
32
|
* Convert to start: string; end: string in the format yyyy-mm-dd
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toString = exports.toMonthYearPeriodId = exports.
|
|
3
|
+
exports.toString = exports.toMonthYearPeriodId = exports.toMonthYearPeriod = exports.toQuarterStrict = exports.toQuarter = exports.getMonthFromMonthName = exports.toMonthStrict = exports.toMonth = exports.LAST_SCHEDULE_DAY_OF_MONTH = exports.MAX_SCHEDULE_DAY_OF_MONTH = exports.MIN_SCHEDULE_DAY_OF_MONTH = exports.toScheduleDaysOfMonth = exports.SCHEDULE_DAYS_OF_MONTH = void 0;
|
|
4
4
|
exports.convertToPeriod = convertToPeriod;
|
|
5
5
|
exports.toAbsoluteDay = toAbsoluteDay;
|
|
6
6
|
const zeniDayJS_1 = require("../zeniDayJS");
|
|
@@ -47,11 +47,6 @@ const toMonthYearPeriod = (periodPayload) => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
exports.toMonthYearPeriod = toMonthYearPeriod;
|
|
50
|
-
const toMonthYearPeriodQuery = (selectedPeriod) => {
|
|
51
|
-
const { month, year } = selectedPeriod;
|
|
52
|
-
return `${month}-${year}`;
|
|
53
|
-
};
|
|
54
|
-
exports.toMonthYearPeriodQuery = toMonthYearPeriodQuery;
|
|
55
50
|
const toMonthYearPeriodId = (selectedPeriod) => {
|
|
56
51
|
const { month, year } = selectedPeriod;
|
|
57
52
|
return `${month}_${year}`;
|
|
@@ -210,6 +210,18 @@ export interface InvoicingSubscriptionEditFieldOption {
|
|
|
210
210
|
name: string;
|
|
211
211
|
}
|
|
212
212
|
export declare function toInvoicingNamedOption(option: InvoicingNamedOptionWire): InvoicingNamedOption;
|
|
213
|
+
/**
|
|
214
|
+
* Adapt a config option to the `{label, value}` shape the form pickers take.
|
|
215
|
+
* Config is the single source of truth for which options exist and what they are
|
|
216
|
+
* called, so every form value set that used to be a hardcoded
|
|
217
|
+
* `InvoicingFormOption[]` constant is now mapped through here.
|
|
218
|
+
*/
|
|
219
|
+
export declare function toInvoicingFormOption(option: InvoicingNamedOption): InvoicingFormOption;
|
|
220
|
+
/**
|
|
221
|
+
* Just the codes of a config option list, for the consumers that need the value
|
|
222
|
+
* set rather than labelled options (status membership checks, tab id sets).
|
|
223
|
+
*/
|
|
224
|
+
export declare function invoicingOptionCodes(options: InvoicingNamedOption[]): string[];
|
|
213
225
|
/**
|
|
214
226
|
* A config-driven map from some key (a pricing model, a status, …) to the
|
|
215
227
|
* options allowed for it. Lets the backend widen an allowed set without a
|
|
@@ -15,6 +15,8 @@ exports.getInvoicingQboAccountMappingId = getInvoicingQboAccountMappingId;
|
|
|
15
15
|
exports.withInvoicingQboAccountMappingId = withInvoicingQboAccountMappingId;
|
|
16
16
|
exports.toInvoicingQboAccountMappingKindOption = toInvoicingQboAccountMappingKindOption;
|
|
17
17
|
exports.toInvoicingNamedOption = toInvoicingNamedOption;
|
|
18
|
+
exports.toInvoicingFormOption = toInvoicingFormOption;
|
|
19
|
+
exports.invoicingOptionCodes = invoicingOptionCodes;
|
|
18
20
|
exports.toInvoicingNamedOptionsByKey = toInvoicingNamedOptionsByKey;
|
|
19
21
|
exports.toInvoicingSubscriptionEditFieldOption = toInvoicingSubscriptionEditFieldOption;
|
|
20
22
|
exports.toAuditLogEntityRouteOption = toAuditLogEntityRouteOption;
|
|
@@ -201,6 +203,22 @@ function toInvoicingQboAccountMappingKindOption(option) {
|
|
|
201
203
|
function toInvoicingNamedOption(option) {
|
|
202
204
|
return { code: option.code, name: option.name };
|
|
203
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Adapt a config option to the `{label, value}` shape the form pickers take.
|
|
208
|
+
* Config is the single source of truth for which options exist and what they are
|
|
209
|
+
* called, so every form value set that used to be a hardcoded
|
|
210
|
+
* `InvoicingFormOption[]` constant is now mapped through here.
|
|
211
|
+
*/
|
|
212
|
+
function toInvoicingFormOption(option) {
|
|
213
|
+
return { label: option.name, value: option.code };
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Just the codes of a config option list, for the consumers that need the value
|
|
217
|
+
* set rather than labelled options (status membership checks, tab id sets).
|
|
218
|
+
*/
|
|
219
|
+
function invoicingOptionCodes(options) {
|
|
220
|
+
return options.map((option) => option.code);
|
|
221
|
+
}
|
|
204
222
|
function toInvoicingNamedOptionsByKey(optionsByKey) {
|
|
205
223
|
return Object.fromEntries(Object.entries(optionsByKey).map(([key, options]) => [
|
|
206
224
|
key,
|
|
@@ -2,6 +2,19 @@ import { AddressPayload } from '../../address/addressPayload';
|
|
|
2
2
|
import { InvoicingListCounts } from '../invoicingCommonPayload';
|
|
3
3
|
import { InvoicingSubscriptionPayload } from '../invoicingSubscription/invoicingSubscriptionPayload';
|
|
4
4
|
import { InvoicingCustomer } from './invoicingCustomerState';
|
|
5
|
+
/**
|
|
6
|
+
* A single entry of the customer `payment_methods` array. Its field names
|
|
7
|
+
* differ from the customer-level scalars (`last4` vs `payment_method_last4`),
|
|
8
|
+
* so they are mapped independently.
|
|
9
|
+
*/
|
|
10
|
+
export interface InvoicingCustomerPaymentMethodPayload {
|
|
11
|
+
payment_method_id: string;
|
|
12
|
+
exp_month?: number;
|
|
13
|
+
exp_year?: number;
|
|
14
|
+
is_default?: boolean;
|
|
15
|
+
last4?: string;
|
|
16
|
+
payment_method_type?: string;
|
|
17
|
+
}
|
|
5
18
|
export interface InvoicingCustomerPayload {
|
|
6
19
|
id: string;
|
|
7
20
|
arr?: number;
|
|
@@ -28,8 +41,11 @@ export interface InvoicingCustomerPayload {
|
|
|
28
41
|
net_term_days?: number;
|
|
29
42
|
notes?: string;
|
|
30
43
|
payment_method?: string;
|
|
44
|
+
payment_method_exp_month?: number;
|
|
45
|
+
payment_method_exp_year?: number;
|
|
31
46
|
payment_method_last4?: string;
|
|
32
47
|
payment_method_type?: 'ach' | 'card' | 'none';
|
|
48
|
+
payment_methods?: InvoicingCustomerPaymentMethodPayload[];
|
|
33
49
|
phone?: string;
|
|
34
50
|
plan?: string;
|
|
35
51
|
plan_name?: string;
|
|
@@ -15,6 +15,19 @@ const extractInvoicingCustomerAddresses = (payloads) => payloads
|
|
|
15
15
|
.map((payload) => payload.billing_address)
|
|
16
16
|
.filter((address) => address != null);
|
|
17
17
|
exports.extractInvoicingCustomerAddresses = extractInvoicingCustomerAddresses;
|
|
18
|
+
const toInvoicingPaymentMethodType = (rawType) => rawType === 'ach' ||
|
|
19
|
+
rawType === 'us_bank_account' ||
|
|
20
|
+
rawType === 'bank_account'
|
|
21
|
+
? 'ach'
|
|
22
|
+
: 'card';
|
|
23
|
+
const mapInvoicingCustomerPaymentMethodPayloadToState = (payload) => ({
|
|
24
|
+
id: payload.payment_method_id,
|
|
25
|
+
isDefault: payload.is_default === true,
|
|
26
|
+
type: toInvoicingPaymentMethodType(payload.payment_method_type),
|
|
27
|
+
expMonth: payload.exp_month,
|
|
28
|
+
expYear: payload.exp_year,
|
|
29
|
+
last4: payload.last4,
|
|
30
|
+
});
|
|
18
31
|
const mapInvoicingCustomerPayloadToState = (payload) => {
|
|
19
32
|
const currencyCode = payload.preferred_currency_code ?? currencyHelper_1.defaultCustomerCurrency.currencyCode;
|
|
20
33
|
const currencySymbol = payload.preferred_currency_symbol ?? currencyHelper_1.defaultCustomerCurrency.currencySymbol;
|
|
@@ -51,8 +64,15 @@ const mapInvoicingCustomerPayloadToState = (payload) => {
|
|
|
51
64
|
netTermDays: payload.net_term_days,
|
|
52
65
|
notes: payload.notes,
|
|
53
66
|
paymentMethod: payload.payment_method,
|
|
67
|
+
paymentMethodExpMonth: payload.payment_method_exp_month,
|
|
68
|
+
paymentMethodExpYear: payload.payment_method_exp_year,
|
|
54
69
|
paymentMethodLast4: payload.payment_method_last4,
|
|
55
70
|
paymentMethodType: payload.payment_method_type,
|
|
71
|
+
paymentMethods: payload.payment_methods
|
|
72
|
+
?.filter((method) => method != null &&
|
|
73
|
+
method.payment_method_id != null &&
|
|
74
|
+
method.payment_method_id !== '')
|
|
75
|
+
.map(mapInvoicingCustomerPaymentMethodPayloadToState),
|
|
56
76
|
phone: payload.phone,
|
|
57
77
|
plan: payload.plan,
|
|
58
78
|
planName: payload.plan_name,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
|
-
import { InvoicingCustomer, InvoicingCustomerState } from './invoicingCustomerState';
|
|
2
|
+
import { InvoicingCustomer, InvoicingCustomerPaymentMethod, InvoicingCustomerState } from './invoicingCustomerState';
|
|
3
3
|
export declare function getInvoicingCustomersByIds(invoicingCustomerState: InvoicingCustomerState, ids: ID[]): InvoicingCustomer[];
|
|
4
4
|
export declare function getInvoicingCustomerById(invoicingCustomerState: InvoicingCustomerState, id: ID): InvoicingCustomer | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Every payment method to show for a customer, with exactly one flagged as the
|
|
7
|
+
* default. `paymentMethods` wins when the backend returns it; otherwise the
|
|
8
|
+
* scalar default-method fields are synthesized into a single method so older
|
|
9
|
+
* responses keep rendering one row.
|
|
10
|
+
*/
|
|
11
|
+
export declare function invoicingCustomerPaymentMethods(customer: InvoicingCustomer | undefined): InvoicingCustomerPaymentMethod[];
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getInvoicingCustomersByIds = getInvoicingCustomersByIds;
|
|
7
7
|
exports.getInvoicingCustomerById = getInvoicingCustomerById;
|
|
8
|
+
exports.invoicingCustomerPaymentMethods = invoicingCustomerPaymentMethods;
|
|
8
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
10
|
function getInvoicingCustomersByIds(invoicingCustomerState, ids) {
|
|
10
11
|
const invoicingCustomers = ids
|
|
@@ -15,3 +16,50 @@ function getInvoicingCustomersByIds(invoicingCustomerState, ids) {
|
|
|
15
16
|
function getInvoicingCustomerById(invoicingCustomerState, id) {
|
|
16
17
|
return (0, get_1.default)(invoicingCustomerState.customerByID, id);
|
|
17
18
|
}
|
|
19
|
+
function scalarPaymentMethod(customer) {
|
|
20
|
+
const { paymentMethodType } = customer;
|
|
21
|
+
if (paymentMethodType == null || paymentMethodType === 'none') {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
// Legacy responses carry no per-method id, so the customer id stands in
|
|
27
|
+
// as a stable display-only key. Nothing reads it as a payment method id.
|
|
28
|
+
id: customer.defaultPaymentMethodID ?? customer.id,
|
|
29
|
+
isDefault: true,
|
|
30
|
+
type: paymentMethodType,
|
|
31
|
+
brand: customer.paymentMethod,
|
|
32
|
+
expMonth: customer.paymentMethodExpMonth,
|
|
33
|
+
expYear: customer.paymentMethodExpYear,
|
|
34
|
+
last4: customer.paymentMethodLast4,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
function defaultPaymentMethodIndex(paymentMethods, defaultPaymentMethodID) {
|
|
39
|
+
const flaggedIndex = paymentMethods.findIndex((paymentMethod) => paymentMethod.isDefault);
|
|
40
|
+
if (flaggedIndex >= 0) {
|
|
41
|
+
return flaggedIndex;
|
|
42
|
+
}
|
|
43
|
+
const matchedIndex = paymentMethods.findIndex((paymentMethod) => paymentMethod.id === defaultPaymentMethodID);
|
|
44
|
+
return matchedIndex >= 0 ? matchedIndex : 0;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Every payment method to show for a customer, with exactly one flagged as the
|
|
48
|
+
* default. `paymentMethods` wins when the backend returns it; otherwise the
|
|
49
|
+
* scalar default-method fields are synthesized into a single method so older
|
|
50
|
+
* responses keep rendering one row.
|
|
51
|
+
*/
|
|
52
|
+
function invoicingCustomerPaymentMethods(customer) {
|
|
53
|
+
if (customer == null) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const paymentMethods = customer.paymentMethods ?? scalarPaymentMethod(customer);
|
|
57
|
+
if (paymentMethods.length === 0) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
const defaultIndex = defaultPaymentMethodIndex(paymentMethods, customer.defaultPaymentMethodID);
|
|
61
|
+
return paymentMethods.map((paymentMethod, index) => ({
|
|
62
|
+
...paymentMethod,
|
|
63
|
+
isDefault: index === defaultIndex,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
@@ -2,6 +2,22 @@ import { Amount } from '../../../commonStateTypes/amount';
|
|
|
2
2
|
import { ID } from '../../../commonStateTypes/common';
|
|
3
3
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
4
|
import { InvoicingSubscription } from '../invoicingSubscription/invoicingSubscriptionState';
|
|
5
|
+
export type InvoicingPaymentMethodType = 'ach' | 'card';
|
|
6
|
+
/**
|
|
7
|
+
* One stored payment method for a customer. `isDefault` is only trustworthy
|
|
8
|
+
* after `invoicingCustomerPaymentMethods` has normalized a list — that is
|
|
9
|
+
* what guarantees a single default across the returned methods.
|
|
10
|
+
*/
|
|
11
|
+
export interface InvoicingCustomerPaymentMethod {
|
|
12
|
+
id: ID;
|
|
13
|
+
isDefault: boolean;
|
|
14
|
+
type: InvoicingPaymentMethodType;
|
|
15
|
+
/** Card network label; only known for the legacy scalar default method. */
|
|
16
|
+
brand?: string;
|
|
17
|
+
expMonth?: number;
|
|
18
|
+
expYear?: number;
|
|
19
|
+
last4?: string;
|
|
20
|
+
}
|
|
5
21
|
export interface InvoicingCustomer {
|
|
6
22
|
id: ID;
|
|
7
23
|
arr?: Amount;
|
|
@@ -27,7 +43,15 @@ export interface InvoicingCustomer {
|
|
|
27
43
|
netTermDays?: number;
|
|
28
44
|
notes?: string;
|
|
29
45
|
paymentMethod?: string;
|
|
46
|
+
paymentMethodExpMonth?: number;
|
|
47
|
+
paymentMethodExpYear?: number;
|
|
30
48
|
paymentMethodLast4?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Every payment method on file. Absent (not empty) on responses from a
|
|
51
|
+
* backend that only returns the scalar default-method fields, which is how
|
|
52
|
+
* `invoicingCustomerPaymentMethods` decides whether to synthesize a row.
|
|
53
|
+
*/
|
|
54
|
+
paymentMethods?: InvoicingCustomerPaymentMethod[];
|
|
31
55
|
paymentMethodType?: 'ach' | 'card' | 'none';
|
|
32
56
|
phone?: string;
|
|
33
57
|
plan?: string;
|
|
@@ -68,6 +68,7 @@ export interface InvoicingSubscriptionPayload {
|
|
|
68
68
|
shipping_address?: AddressPayload | null;
|
|
69
69
|
started_at?: string;
|
|
70
70
|
subscription_items?: InvoicingSubscriptionItemPayload[];
|
|
71
|
+
subscription_number?: string;
|
|
71
72
|
total_dues?: number;
|
|
72
73
|
trial_end?: string;
|
|
73
74
|
trial_start?: string;
|
|
@@ -107,6 +107,7 @@ const mapInvoicingSubscriptionPayloadToState = (payload) => {
|
|
|
107
107
|
: undefined,
|
|
108
108
|
startedAt: payload.started_at != null ? (0, zeniDayJS_1.date)(payload.started_at) : undefined,
|
|
109
109
|
subscriptionItems: payload.subscription_items?.map((item) => (0, exports.mapInvoicingSubscriptionItemPayloadToState)(item, currencyCode, currencySymbol)),
|
|
110
|
+
subscriptionNumber: payload.subscription_number,
|
|
110
111
|
totalDues: payload.total_dues != null
|
|
111
112
|
? (0, amount_1.toAmount)(payload.total_dues, currencyCode, currencySymbol)
|
|
112
113
|
: undefined,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InvoicingTransaction } from './invoicingTransactionState';
|
|
2
|
-
export type InvoicingTransactionType = 'payment' | 'refund' | 'authorization' | 'payment_reversal';
|
|
2
|
+
export type InvoicingTransactionType = 'payment' | 'refund' | 'authorization' | 'payment_reversal' | 'excess_transfer';
|
|
3
3
|
export type InvoicingTransactionStatus = 'in_progress' | 'success' | 'voided' | 'failure' | 'timeout' | 'needs_attention' | 'late_failure' | 'failed';
|
|
4
4
|
export interface InvoicingLinkedInvoiceRefPayload {
|
|
5
5
|
applied_amount: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SupportedTransaction, SupportedTransactionPayload } from './transactionState';
|
|
2
|
-
|
|
2
|
+
declare function toSupportedTransaction(payload: SupportedTransactionPayload): SupportedTransaction;
|
|
3
3
|
export default toSupportedTransaction;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toSupportedTransaction = toSupportedTransaction;
|
|
4
3
|
const customerTransactionPayload_1 = require("./payloadTypes/customerTransactionPayload");
|
|
5
4
|
const otherTransactionPayload_1 = require("./payloadTypes/otherTransactionPayload");
|
|
6
5
|
const transactionPayload_1 = require("./payloadTypes/transactionPayload");
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export const MAX_SUB_ACCOUNTS_SUPPORTED = 4;
|
|
2
|
-
export const MAX_SUB_CLASSES_SUPPORTED = 4;
|
|
3
|
-
export const MAX_SUB_CUSTOMERS_SUPPORTED = 4;
|
|
4
1
|
export function getNestedAccountIDStr(nestedAccountId) {
|
|
5
2
|
const [accountId, parentAccountId, greatParentAccountId, greatGreatParentAccountId, greatGreatGreatParentAccountId,] = nestedAccountId;
|
|
6
3
|
return `${accountId}-${parentAccountId ?? ''}-${greatParentAccountId ?? ''}-${greatGreatParentAccountId ?? ''}-${greatGreatGreatParentAccountId ?? ''}`;
|
|
@@ -35,10 +35,6 @@ export const toMonthYearPeriod = (periodPayload) => {
|
|
|
35
35
|
year: Number(periodPayload.split('-')[1]),
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
export const toMonthYearPeriodQuery = (selectedPeriod) => {
|
|
39
|
-
const { month, year } = selectedPeriod;
|
|
40
|
-
return `${month}-${year}`;
|
|
41
|
-
};
|
|
42
38
|
export const toMonthYearPeriodId = (selectedPeriod) => {
|
|
43
39
|
const { month, year } = selectedPeriod;
|
|
44
40
|
return `${month}_${year}`;
|
|
@@ -179,6 +179,22 @@ export function toInvoicingQboAccountMappingKindOption(option) {
|
|
|
179
179
|
export function toInvoicingNamedOption(option) {
|
|
180
180
|
return { code: option.code, name: option.name };
|
|
181
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Adapt a config option to the `{label, value}` shape the form pickers take.
|
|
184
|
+
* Config is the single source of truth for which options exist and what they are
|
|
185
|
+
* called, so every form value set that used to be a hardcoded
|
|
186
|
+
* `InvoicingFormOption[]` constant is now mapped through here.
|
|
187
|
+
*/
|
|
188
|
+
export function toInvoicingFormOption(option) {
|
|
189
|
+
return { label: option.name, value: option.code };
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Just the codes of a config option list, for the consumers that need the value
|
|
193
|
+
* set rather than labelled options (status membership checks, tab id sets).
|
|
194
|
+
*/
|
|
195
|
+
export function invoicingOptionCodes(options) {
|
|
196
|
+
return options.map((option) => option.code);
|
|
197
|
+
}
|
|
182
198
|
export function toInvoicingNamedOptionsByKey(optionsByKey) {
|
|
183
199
|
return Object.fromEntries(Object.entries(optionsByKey).map(([key, options]) => [
|
|
184
200
|
key,
|
|
@@ -11,6 +11,19 @@ import { mapInvoicingSubscriptionPayloadToState, } from '../invoicingSubscriptio
|
|
|
11
11
|
export const extractInvoicingCustomerAddresses = (payloads) => payloads
|
|
12
12
|
.map((payload) => payload.billing_address)
|
|
13
13
|
.filter((address) => address != null);
|
|
14
|
+
const toInvoicingPaymentMethodType = (rawType) => rawType === 'ach' ||
|
|
15
|
+
rawType === 'us_bank_account' ||
|
|
16
|
+
rawType === 'bank_account'
|
|
17
|
+
? 'ach'
|
|
18
|
+
: 'card';
|
|
19
|
+
const mapInvoicingCustomerPaymentMethodPayloadToState = (payload) => ({
|
|
20
|
+
id: payload.payment_method_id,
|
|
21
|
+
isDefault: payload.is_default === true,
|
|
22
|
+
type: toInvoicingPaymentMethodType(payload.payment_method_type),
|
|
23
|
+
expMonth: payload.exp_month,
|
|
24
|
+
expYear: payload.exp_year,
|
|
25
|
+
last4: payload.last4,
|
|
26
|
+
});
|
|
14
27
|
export const mapInvoicingCustomerPayloadToState = (payload) => {
|
|
15
28
|
const currencyCode = payload.preferred_currency_code ?? defaultCustomerCurrency.currencyCode;
|
|
16
29
|
const currencySymbol = payload.preferred_currency_symbol ?? defaultCustomerCurrency.currencySymbol;
|
|
@@ -47,8 +60,15 @@ export const mapInvoicingCustomerPayloadToState = (payload) => {
|
|
|
47
60
|
netTermDays: payload.net_term_days,
|
|
48
61
|
notes: payload.notes,
|
|
49
62
|
paymentMethod: payload.payment_method,
|
|
63
|
+
paymentMethodExpMonth: payload.payment_method_exp_month,
|
|
64
|
+
paymentMethodExpYear: payload.payment_method_exp_year,
|
|
50
65
|
paymentMethodLast4: payload.payment_method_last4,
|
|
51
66
|
paymentMethodType: payload.payment_method_type,
|
|
67
|
+
paymentMethods: payload.payment_methods
|
|
68
|
+
?.filter((method) => method != null &&
|
|
69
|
+
method.payment_method_id != null &&
|
|
70
|
+
method.payment_method_id !== '')
|
|
71
|
+
.map(mapInvoicingCustomerPaymentMethodPayloadToState),
|
|
52
72
|
phone: payload.phone,
|
|
53
73
|
plan: payload.plan,
|
|
54
74
|
planName: payload.plan_name,
|
|
@@ -8,3 +8,50 @@ export function getInvoicingCustomersByIds(invoicingCustomerState, ids) {
|
|
|
8
8
|
export function getInvoicingCustomerById(invoicingCustomerState, id) {
|
|
9
9
|
return recordGet(invoicingCustomerState.customerByID, id);
|
|
10
10
|
}
|
|
11
|
+
function scalarPaymentMethod(customer) {
|
|
12
|
+
const { paymentMethodType } = customer;
|
|
13
|
+
if (paymentMethodType == null || paymentMethodType === 'none') {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
// Legacy responses carry no per-method id, so the customer id stands in
|
|
19
|
+
// as a stable display-only key. Nothing reads it as a payment method id.
|
|
20
|
+
id: customer.defaultPaymentMethodID ?? customer.id,
|
|
21
|
+
isDefault: true,
|
|
22
|
+
type: paymentMethodType,
|
|
23
|
+
brand: customer.paymentMethod,
|
|
24
|
+
expMonth: customer.paymentMethodExpMonth,
|
|
25
|
+
expYear: customer.paymentMethodExpYear,
|
|
26
|
+
last4: customer.paymentMethodLast4,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
function defaultPaymentMethodIndex(paymentMethods, defaultPaymentMethodID) {
|
|
31
|
+
const flaggedIndex = paymentMethods.findIndex((paymentMethod) => paymentMethod.isDefault);
|
|
32
|
+
if (flaggedIndex >= 0) {
|
|
33
|
+
return flaggedIndex;
|
|
34
|
+
}
|
|
35
|
+
const matchedIndex = paymentMethods.findIndex((paymentMethod) => paymentMethod.id === defaultPaymentMethodID);
|
|
36
|
+
return matchedIndex >= 0 ? matchedIndex : 0;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Every payment method to show for a customer, with exactly one flagged as the
|
|
40
|
+
* default. `paymentMethods` wins when the backend returns it; otherwise the
|
|
41
|
+
* scalar default-method fields are synthesized into a single method so older
|
|
42
|
+
* responses keep rendering one row.
|
|
43
|
+
*/
|
|
44
|
+
export function invoicingCustomerPaymentMethods(customer) {
|
|
45
|
+
if (customer == null) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const paymentMethods = customer.paymentMethods ?? scalarPaymentMethod(customer);
|
|
49
|
+
if (paymentMethods.length === 0) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const defaultIndex = defaultPaymentMethodIndex(paymentMethods, customer.defaultPaymentMethodID);
|
|
53
|
+
return paymentMethods.map((paymentMethod, index) => ({
|
|
54
|
+
...paymentMethod,
|
|
55
|
+
isDefault: index === defaultIndex,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
@@ -100,6 +100,7 @@ export const mapInvoicingSubscriptionPayloadToState = (payload) => {
|
|
|
100
100
|
: undefined,
|
|
101
101
|
startedAt: payload.started_at != null ? date(payload.started_at) : undefined,
|
|
102
102
|
subscriptionItems: payload.subscription_items?.map((item) => mapInvoicingSubscriptionItemPayloadToState(item, currencyCode, currencySymbol)),
|
|
103
|
+
subscriptionNumber: payload.subscription_number,
|
|
103
104
|
totalDues: payload.total_dues != null
|
|
104
105
|
? toAmount(payload.total_dues, currencyCode, currencySymbol)
|
|
105
106
|
: undefined,
|
|
@@ -2,7 +2,7 @@ import { isCustomerTransactionPayload, toCustomerTransaction, } from './payloadT
|
|
|
2
2
|
import { isTransferTransactionPayload, toTransferTransaction, } from './payloadTypes/otherTransactionPayload';
|
|
3
3
|
import { toTransaction } from './payloadTypes/transactionPayload';
|
|
4
4
|
import { isVendorTransactionPayload, isVendorTransactionWithCustomerPayload, toVendorTransaction, toVendorTransactionWithCustomer, } from './payloadTypes/vendorTransactionPayload';
|
|
5
|
-
|
|
5
|
+
function toSupportedTransaction(payload) {
|
|
6
6
|
if (isCustomerTransactionPayload(payload)) {
|
|
7
7
|
return toCustomerTransaction(payload);
|
|
8
8
|
}
|