diff --git a/src/api/ADempiere/form/point-of-sales.js b/src/api/ADempiere/form/point-of-sales.js index 121c96c5..77cf5ae7 100644 --- a/src/api/ADempiere/form/point-of-sales.js +++ b/src/api/ADempiere/form/point-of-sales.js @@ -920,3 +920,30 @@ export function listTenderTypes({ return listTenderType }) } + +/** + * Create Customer Account + * @param {string} posUuidd - POS UUID reference + */ +export function createCustomerAccount({ + posUuid, + orderUuid, + customerAccount, + tenderTypeCode, + currencyUuid +}) { + return request({ + url: `${config.pointOfSales.endpoint}/available-payment-methods`, + method: 'post', + data: { + pos_uuid: posUuid, + order_uuid: orderUuid, + customer_account: customerAccount, + tender_type_code: tenderTypeCode, + currency_uuid: currencyUuid + } + }) + .then(responseCustomerAccount => { + return responseCustomerAccount + }) +} diff --git a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue index f1a32172..5dd8e061 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue @@ -370,6 +370,11 @@ export default { }, watch: { option(value) { + this.$store.commit('updateValueOfField', { + containerUuid: this.renderComponentContainer, + columnName: 'PayAmt', + value: this.change + }) this.selectionTypeRefund = {} } }, @@ -418,9 +423,15 @@ export default { containerUuid: this.renderComponentContainer, format: 'object' }) - values.tenderType = this.selectionTypeRefund.name + const customer = { + customerAccount: values, + currencyUuid: this.$store.getters.getCurrencyRedund.uuid, + orderUuid: this.currentOrder.uuid, + posUuid: this.currentPointOfSales.uuid, + tenderTypeCode: this.selectionTypeRefund.tender_type + } const emptyMandatoryFields = this.$store.getters.getFieldsListEmptyMandatory({ containerUuid: this.renderComponentContainer, formatReturn: 'name' }) - if (!this.isEmptyValue(emptyMandatoryFields)) { + if (!this.isEmptyValue(emptyMandatoryFields) && this.isEmptyValue(this.$store.getters.getCurrencyRedund.uuid)) { this.$message({ type: 'warning', message: this.$t('notifications.mandatoryFieldMissing') + emptyMandatoryFields, @@ -437,6 +448,7 @@ export default { }) }) this.$store.dispatch('addRefundLoaded', values) + this.$store.dispatch('sendCreateCustomerAccount', customer) this.selectionTypeRefund = {} this.success() }, @@ -512,7 +524,6 @@ export default { } break default: - console.log(this.$store.getters.posAttributes.currentPointOfSales.isPosRequiredPin) if (this.$store.getters.posAttributes.currentPointOfSales.isPosRequiredPin) { const attributePin = { posUuid, diff --git a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/ACH/index.vue b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/ACH/index.vue index 2621dc9d..19a04a81 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/ACH/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/ACH/index.vue @@ -167,6 +167,8 @@ export default { }, changeCurrency(value) { this.currentFieldCurrency = value + const currency = this.listCurrency.find(currency => currency.key === value) + this.$store.dispatch('currencyRedund', currency) }, changePaymentType(value) { this.$store.commit('currentTenderChange', value) diff --git a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/Cash/index.vue b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/Cash/index.vue index 6c11e0d2..e0c1e6eb 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/Cash/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/Cash/index.vue @@ -203,6 +203,8 @@ export default { }, changeCurrency(value) { this.currentFieldCurrency = value + const currency = this.listCurrency.find(currency => currency.key === value) + this.$store.dispatch('currencyRedund', currency) }, changePaymentType(value) { this.$store.commit('currentTenderChange', value) diff --git a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/MobilePayment/index.vue b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/MobilePayment/index.vue index 8f8dc0ec..d67e4c21 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/MobilePayment/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/paymentTypeChange/MobilePayment/index.vue @@ -167,6 +167,8 @@ export default { }, changeCurrency(value) { this.currentFieldCurrency = value + const currency = this.listCurrency.find(currency => currency.key === value) + this.$store.dispatch('currencyRedund', currency) }, changePaymentType(value) { this.$store.commit('currentTenderChange', value) diff --git a/src/store/modules/ADempiere/pointOfSales/payments/actions.js b/src/store/modules/ADempiere/pointOfSales/payments/actions.js index d07b6577..49fb80b2 100644 --- a/src/store/modules/ADempiere/pointOfSales/payments/actions.js +++ b/src/store/modules/ADempiere/pointOfSales/payments/actions.js @@ -19,7 +19,8 @@ import { createPayment, deletePayment, updatePayment, - getPaymentsList + getPaymentsList, + createCustomerAccount } from '@/api/ADempiere/form/point-of-sales.js' import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js' import { showMessage } from '@/utils/ADempiere/notification.js' @@ -316,5 +317,26 @@ export default { const addRefund = state.refundLoaded addRefund.push(refund) commit('setRefundLoaded', addRefund) + }, + currencyRedund({ commit }, currency) { + commit('setCurrencyRedund', currency) + }, + sendCreateCustomerAccount({ commit }, { + posUuid, + orderUuid, + customerAccount, + tenderTypeCode, + currencyUuid + }) { + createCustomerAccount({ + posUuid, + orderUuid, + customerAccount, + tenderTypeCode, + currencyUuid + }) + .then(response => { + console.log(response) + }) } } diff --git a/src/store/modules/ADempiere/pointOfSales/payments/getters.js b/src/store/modules/ADempiere/pointOfSales/payments/getters.js index 4d740c1b..b8f4dc2a 100644 --- a/src/store/modules/ADempiere/pointOfSales/payments/getters.js +++ b/src/store/modules/ADempiere/pointOfSales/payments/getters.js @@ -51,5 +51,8 @@ export default { }, getRefundLoaded: (state) => { return state.refundLoaded + }, + getCurrencyRedund: (state) => { + return state.currentFieldCurrencyRedund } } diff --git a/src/store/modules/ADempiere/pointOfSales/payments/mutations.js b/src/store/modules/ADempiere/pointOfSales/payments/mutations.js index daa87648..21c6fd38 100644 --- a/src/store/modules/ADempiere/pointOfSales/payments/mutations.js +++ b/src/store/modules/ADempiere/pointOfSales/payments/mutations.js @@ -67,5 +67,8 @@ export default { }, setRefundLoaded(state, refund) { state.refundLoaded = refund + }, + setCurrencyRedund(state, currency) { + state.currentFieldCurrencyRedund = currency } } diff --git a/src/store/modules/ADempiere/pointOfSales/payments/state.js b/src/store/modules/ADempiere/pointOfSales/payments/state.js index 88b98acc..2f3beb04 100644 --- a/src/store/modules/ADempiere/pointOfSales/payments/state.js +++ b/src/store/modules/ADempiere/pointOfSales/payments/state.js @@ -32,6 +32,7 @@ export default { fieldCurrency: {}, convertionRate: [], refundLoaded: [], + currentFieldCurrencyRedund: {}, dialogoInvoce: { show: false, type: 0,