feat(billing): let accounts switch billing currency with a confirmation note

This commit is contained in:
Tanmay Deep Sharma
2026-06-03 11:27:25 +05:30
parent bbd575d8fa
commit f1bc3208e9
13 changed files with 384 additions and 2 deletions
@@ -19,6 +19,7 @@ const state = {
isUpdating: false,
isCheckoutInProcess: false,
isFetchingLimits: false,
isSwitchingCurrency: false,
},
};
@@ -142,6 +143,20 @@ export const actions = {
}
},
switchBillingCurrency: async ({ commit, dispatch }, { currency }) => {
commit(types.default.SET_ACCOUNT_UI_FLAG, { isSwitchingCurrency: true });
try {
await EnterpriseAccountAPI.switchCurrency(currency);
// Refresh the account so custom_attributes.billing_currency and the
// subscription details reflect the new currency.
await dispatch('get', { silent: true });
} catch (error) {
throwErrorMessage(error);
} finally {
commit(types.default.SET_ACCOUNT_UI_FLAG, { isSwitchingCurrency: false });
}
},
limits: async ({ commit }) => {
commit(types.default.SET_ACCOUNT_UI_FLAG, { isFetchingLimits: true });
try {