support for payment methods (#578)
							parent
							
								
									d83b109aef
								
							
						
					
					
						commit
						60223ecc14
					
				|  | @ -6,6 +6,7 @@ import { | |||
| 
 | ||||
| /** | ||||
|  * method in api/price-checking.js as requestGetProductPrice | ||||
|  * @author elsiosanchez <elsiosanches@gmail.com> | ||||
|  */ | ||||
| export { requestGetProductPrice as findProduct } from '@/api/ADempiere/form/price-checking.js' | ||||
| export { requestGetConversionRate } from '@/api/ADempiere/system-core.js' | ||||
|  | @ -435,3 +436,110 @@ export function requestCashClosing({ | |||
| }) { | ||||
|   console.info(`Cash closing with POS id ${posId}, and uuid ${posUuid}`) | ||||
| } | ||||
| 
 | ||||
| // Create Payment
 | ||||
| 
 | ||||
| export function requestCreatePayment({ | ||||
|   posUuid, | ||||
|   orderUuid, | ||||
|   invoiceUuid, | ||||
|   bankUuid, | ||||
|   referenceNo, | ||||
|   description, | ||||
|   amount, | ||||
|   paymentDate, | ||||
|   tenderTypeCode, | ||||
|   currencyUuid | ||||
| }) { | ||||
|   return requestRest({ | ||||
|     url: '/pos/create-payment', | ||||
|     data: { | ||||
|       pos_uuid: posUuid, | ||||
|       order_uuid: orderUuid, | ||||
|       invoice_uuid: invoiceUuid, | ||||
|       bank_uuid: bankUuid, | ||||
|       reference_no: referenceNo, | ||||
|       description: description, | ||||
|       amount: amount, | ||||
|       payment_date: paymentDate, | ||||
|       tender_type_code: tenderTypeCode, | ||||
|       currency_uuid: currencyUuid | ||||
|     } | ||||
|   }) | ||||
|     .then(evaluateResponse) | ||||
|     .then(createPaymentResponse => { | ||||
|       return createPaymentResponse | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| // Update Payment
 | ||||
| 
 | ||||
| export function requestUpdatePayment({ | ||||
|   paymentUuid, | ||||
|   bankUuid, | ||||
|   referenceNo, | ||||
|   description, | ||||
|   amount, | ||||
|   paymentDate, | ||||
|   tenderTypeCode | ||||
| }) { | ||||
|   return requestRest({ | ||||
|     url: '/pos/update-payment', | ||||
|     data: { | ||||
|       payment_uuid: paymentUuid, | ||||
|       bank_uuid: bankUuid, | ||||
|       reference_no: referenceNo, | ||||
|       description: description, | ||||
|       amount: amount, | ||||
|       payment_date: paymentDate, | ||||
|       tender_type_code: tenderTypeCode | ||||
|     } | ||||
|   }) | ||||
|     .then(evaluateResponse) | ||||
|     .then(updatePaymentResponse => { | ||||
|       return updatePaymentResponse | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| // Delete Payment
 | ||||
| 
 | ||||
| export function requestDeletePayment({ | ||||
|   paymentUuid | ||||
| }) { | ||||
|   return requestRest({ | ||||
|     url: '/pos/delete-payment', | ||||
|     data: { | ||||
|       payment_uuid: paymentUuid | ||||
|     } | ||||
|   }) | ||||
|     .then(evaluateResponse) | ||||
|     .then(deletePaymentResponse => { | ||||
|       return deletePaymentResponse | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| // List Payments
 | ||||
| 
 | ||||
| export function requestListPayments({ | ||||
|   posUuid, | ||||
|   orderUuid | ||||
| }) { | ||||
|   return requestRest({ | ||||
|     url: '/pos/list-payments', | ||||
|     data: { | ||||
|       pos_uuid: posUuid, | ||||
|       order_uuid: orderUuid | ||||
|     } | ||||
|   }) | ||||
|     .then(evaluateResponse) | ||||
|     .then(listPaymentsResponse => { | ||||
|       const { paymentsMethod } = require('@/utils/ADempiere/apiConverts/pos.js') | ||||
|       return { | ||||
|         nextPageToken: listPaymentsResponse.next_page_token, | ||||
|         recordCount: listPaymentsResponse.record_count, | ||||
|         listPayments: listPaymentsResponse.records.map(payments => { | ||||
|           return paymentsMethod(payments) | ||||
|         }) | ||||
|       } | ||||
|     }) | ||||
| } | ||||
|  |  | |||
|  | @ -81,7 +81,7 @@ | |||
|         <el-main style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;"> | ||||
|           <type-collection | ||||
|             v-if="isLoaded" | ||||
|             :is-add-type-pay="paymentBox" | ||||
|             :is-add-type-pay="listPayments" | ||||
|             :currency="currencyPoint" | ||||
|           /> | ||||
|           <div | ||||
|  | @ -264,6 +264,9 @@ export default { | |||
|       } | ||||
|       return false | ||||
|     }, | ||||
|     listPayments() { | ||||
|       return this.$store.getters.getListPayments | ||||
|     }, | ||||
|     paymentBox() { | ||||
|       const payment = this.isPaymentBox.filter(pay => { | ||||
|         return pay.isVisible | ||||
|  | @ -274,8 +277,8 @@ export default { | |||
|       return payment | ||||
|     }, | ||||
|     cashPayment() { | ||||
|       const cash = this.isPaymentBox.filter(pay => { | ||||
|         return pay.tenderType === 'X' | ||||
|       const cash = this.listPayments.filter(pay => { | ||||
|         return pay.tenderTypeCode === 'X' | ||||
|       }) | ||||
|       return this.sumCash(cash) | ||||
|     }, | ||||
|  | @ -319,9 +322,9 @@ export default { | |||
|       return false | ||||
|     }, | ||||
|     isCashAmt() { | ||||
|       const cashAmt = this.paymentBox.map(item => { | ||||
|         if (item.tenderType === 'X') { | ||||
|           return item.payAmt | ||||
|       const cashAmt = this.listPayments.map(item => { | ||||
|         if (item.tenderTypeCode === 'X') { | ||||
|           return item.amount | ||||
|         } | ||||
|         return 0 | ||||
|       }) | ||||
|  | @ -331,8 +334,8 @@ export default { | |||
|       return 0 | ||||
|     }, | ||||
|     isOtherPayAmt() { | ||||
|       const cashAmt = this.paymentBox.map(item => { | ||||
|         if (item.tenderType !== 'X') { | ||||
|       const cashAmt = this.listPayments.map(item => { | ||||
|         if (item.tenderTypeCode !== 'X') { | ||||
|           return item.payAmt | ||||
|         } | ||||
|         return 0 | ||||
|  | @ -343,7 +346,7 @@ export default { | |||
|       return 0 | ||||
|     }, | ||||
|     pay() { | ||||
|       return this.sumCash(this.isPaymentBox) | ||||
|       return this.sumCash(this.listPayments) | ||||
|     }, | ||||
|     pending() { | ||||
|       const missing = this.order.grandTotal - this.pay | ||||
|  | @ -517,13 +520,18 @@ export default { | |||
|     this.unsubscribe = this.subscribeChanges() | ||||
|     this.defaultValueCurrency() | ||||
|   }, | ||||
|   mounted() { | ||||
|     setTimeout(() => { | ||||
|       this.tenderTypeDisplaye() | ||||
|     }, 1000) | ||||
|   }, | ||||
|   methods: { | ||||
|     formatDate, | ||||
|     formatPrice, | ||||
|     sumCash(cash) { | ||||
|       let sum = 0 | ||||
|       cash.forEach((pay) => { | ||||
|         sum += pay.payAmt | ||||
|         sum += pay.amount | ||||
|       }) | ||||
|       return sum | ||||
|     }, | ||||
|  | @ -533,15 +541,21 @@ export default { | |||
|     }, | ||||
|     addCollectToList() { | ||||
|       const containerUuid = this.containerUuid | ||||
|       const posUuid = this.$store.getters.getCurrentPOS.uuid | ||||
|       const orderUuid = this.$route.query.action | ||||
|       const bankUuid = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'C_Bank_ID_UUID' | ||||
|       }) | ||||
|       const amount = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'PayAmt' | ||||
|       }) | ||||
|       const date = this.$store.getters.getValueOfField({ | ||||
|       const paymentDate = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'DateTrx' | ||||
|       }) | ||||
|       const typePay = this.$store.getters.getValueOfField({ | ||||
|       const tenderTypeCode = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'TenderType' | ||||
|       }) | ||||
|  | @ -549,31 +563,20 @@ export default { | |||
|         containerUuid, | ||||
|         columnName: 'ReferenceNo' | ||||
|       }) | ||||
|       let currency = this.$store.getters.getValueOfField({ | ||||
|       const currencyUuid = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'DisplayColumn_C_Currency_ID' | ||||
|         columnName: 'C_Currency_ID_UUID' | ||||
|       }) | ||||
|       const currencyId = this.$store.getters.getValueOfField({ | ||||
|         containerUuid, | ||||
|         columnName: 'C_Currency_ID' | ||||
|       }) | ||||
|       if (currency === this.currencyPoint.id) { | ||||
|         currency = this.currencyPoint.iSOCode | ||||
|       } | ||||
| 
 | ||||
|       const displayType = this.labelTenderType | ||||
|       this.$store.dispatch('setPaymentBox', { | ||||
|         isVisible: true, | ||||
|         quantityCahs: amount, | ||||
|         payAmt: amount * this.divideRate, | ||||
|         tenderType: typePay, | ||||
|         referenceNo: referenceNo, | ||||
|         dateTrx: date, | ||||
|         currency: { | ||||
|           currency, | ||||
|           id: currencyId | ||||
|         }, | ||||
|         displayTenderType: displayType | ||||
|       this.$store.dispatch('createPayments', { | ||||
|         posUuid, | ||||
|         orderUuid, | ||||
|         bankUuid, | ||||
|         referenceNo, | ||||
|         amount, | ||||
|         paymentDate, | ||||
|         tenderTypeCode, | ||||
|         currencyUuid | ||||
|       }) | ||||
|       this.addCollect() | ||||
|     }, | ||||
|  | @ -690,6 +693,18 @@ export default { | |||
|         value: this.$t('form.pos.collect.TenderType.cash') | ||||
|       }) | ||||
|     }, | ||||
|     tenderTypeDisplaye() { | ||||
|       if (!this.isEmptyValue(this.fieldsList)) { | ||||
|         const tenderType = this.fieldsList[1].reference | ||||
|         this.$store.dispatch('getLookupListFromServer', { | ||||
|           tableName: tenderType.tableName, | ||||
|           query: tenderType.query | ||||
|         }) | ||||
|           .then(response => { | ||||
|             this.$store.dispatch('tenderTypeDisplaye', response) | ||||
|           }) | ||||
|       } | ||||
|     }, | ||||
|     subscribeChanges() { | ||||
|       return this.$store.subscribe((mutation, state) => { | ||||
|         if (mutation.type === 'updateValueOfField') { | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
|     <el-main style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;"> | ||||
|       <el-row :gutter="24"> | ||||
|         <template v-for="(value, key) in isAddTypePay"> | ||||
|           <el-col v-if="value.isVisible" :key="key" :span="12" style="padding-left: 5px; padding-right: 5px;"> | ||||
|           <el-col :key="key" :span="12" style="padding-left: 5px; padding-right: 5px;"> | ||||
|             <el-card :body-style="{ padding: '0px' }"> | ||||
|               <el-row> | ||||
|                 <el-col :span="6" style="padding: 10px"> | ||||
|  | @ -14,11 +14,11 @@ | |||
|                     type="text" | ||||
|                     icon="el-icon-close" | ||||
|                     style="float: right; margin-right: 10px; color: red; padding-top: 10px;" | ||||
|                     @click="deleteCollect(key)" | ||||
|                     @click="deleteCollect(value)" | ||||
|                   /> | ||||
|                   <div style="padding-right: 10px; padding-top: 10%;"> | ||||
|                     <div class="top clearfix"> | ||||
|                       <span>{{ value.displayTenderType }}</span> | ||||
|                       <span>{{ tenderTypeDisplay(value.tenderTypeCode) }}</span> | ||||
|                     </div> | ||||
|                     <div class="bottom clearfix" style="margin-top: 0px !important!"> | ||||
|                       <el-button | ||||
|  | @ -26,28 +26,28 @@ | |||
|                         class="button" | ||||
|                         style="color: rgb(50, 54, 58); font-size: 13px; text-align: left; float: unset; padding-top: 5px;" | ||||
|                       > | ||||
|                         {{ value.referenceNo }} | ||||
|                         {{ value.documentNo }} | ||||
|                       </el-button> | ||||
| 
 | ||||
|                       <el-button | ||||
|                         v-if="!isEmptyValue(value.dateTrx)" | ||||
|                         v-if="!isEmptyValue(value.paymentDate)" | ||||
|                         type="text" | ||||
|                         class="button" | ||||
|                         style="color: rgb(50, 54, 58); font-size: 13px; text-align: left; float: unset; padding-top: 5px;" | ||||
|                       > | ||||
|                         {{ formatDate(value.dateTrx) }} | ||||
|                         {{ formatDate(value.paymentDate) }} | ||||
|                       </el-button> | ||||
| 
 | ||||
|                       <div slot="header" class="clearfix"> | ||||
|                         <p class="total" :style="value.currency.id === currency.id ? 'padding-top: 5%;' : ''"> | ||||
|                         <p class="total" :style="value.currencyUuid === currency.id ? 'padding-top: 5%;' : ''"> | ||||
|                           <b style="float: right; padding-bottom: 10px"> | ||||
|                             {{ formatPrice(value.payAmt, currency.iSOCode) }} | ||||
|                             {{ formatPrice(value.amount, currency.iSOCode) }} | ||||
|                           </b> | ||||
|                         </p> | ||||
|                         <br> | ||||
|                         <p v-if="value.currency.id !== currency.id" class="total"> | ||||
|                         <p v-if="value.currencyUuid !== currency.id" class="total"> | ||||
|                           <b style="float: right; padding-bottom: 10px"> | ||||
|                             {{ formatPrice(value.quantityCahs, value.currency.currency) }} | ||||
|                             {{ formatPrice(value.quantityCahs) }} | ||||
|                           </b> | ||||
|                         </p> | ||||
|                       </div> | ||||
|  | @ -81,6 +81,11 @@ export default { | |||
|       default: undefined | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     label() { | ||||
|       return this.$store.getters.getTenderTypeDisplaye | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     formatDate, | ||||
|     formatPrice, | ||||
|  | @ -127,7 +132,23 @@ export default { | |||
|       return require('@/image/' + image + '.jpg') | ||||
|     }, | ||||
|     deleteCollect(key) { | ||||
|       this.$store.dispatch('deleteCollectBox', key) | ||||
|       const orderUuid = key.orderUuid | ||||
|       const paymentUuid = key.uuid | ||||
|       this.$store.dispatch('deletetPayments', { | ||||
|         orderUuid, | ||||
|         paymentUuid | ||||
|       }) | ||||
|     }, | ||||
|     tenderTypeDisplay(payments) { | ||||
|       const display = this.label.find(item => { | ||||
|         if (item.tenderTypeCode === payments) { | ||||
|           return item.tenderTypeDisplay | ||||
|         } | ||||
|       }) | ||||
|       if (display) { | ||||
|         return display.tenderTypeDisplay | ||||
|       } | ||||
|       return payments | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -393,7 +393,9 @@ export default { | |||
|         //   documentStatus: {}, | ||||
|         //   salesRepresentative: this.currentPOS.salesRepresentative | ||||
|         // | ||||
|         this.$store.commit('setListPayments', []) | ||||
|         this.$store.dispatch('listOrderLine', []) | ||||
|         this.$store.commit('setShowPOSCollection', false) | ||||
|       }) | ||||
|     }, | ||||
|     printOrder() { | ||||
|  |  | |||
|  | @ -450,8 +450,13 @@ export default { | |||
|       this.newOrder() | ||||
|     }, | ||||
|     openCollectionPanel() { | ||||
|       this.isShowedPOSKeyLayout = !this.isShowedPOSKeyLayout | ||||
|       this.$store.commit('setShowPOSCollection', true) | ||||
|       this.isShowedPOSKeyLayout = true | ||||
|       // this.isShowedPOSKeyLayout = true | ||||
|       const posUuid = this.$store.getters.getCurrentPOS.uuid | ||||
|       const orderUuid = this.$route.query.action | ||||
|       this.$store.dispatch('listPayments', { posUuid, orderUuid }) | ||||
|       this.isShowedPOSKeyLaout = !this.isShowedPOSKeyLaout | ||||
|       this.$store.commit('setShowPOSOptions', false) | ||||
|     }, | ||||
|     newOrder() { | ||||
|  |  | |||
|  | @ -249,6 +249,9 @@ export default { | |||
|             action: row.uuid | ||||
|           } | ||||
|         }, () => {}) | ||||
|         const posUuid = this.$store.getters.getCurrentPOS.uuid | ||||
|         const orderUuid = this.$route.query.action | ||||
|         this.$store.dispatch('listPayments', { posUuid, orderUuid }) | ||||
|       } | ||||
|     }, | ||||
|     subscribeChanges() { | ||||
|  |  | |||
|  | @ -1,5 +1,11 @@ | |||
| 
 | ||||
| import { requestGetConversionRate } from '@/api/ADempiere/form/point-of-sales.js' | ||||
| import { | ||||
|   requestGetConversionRate, | ||||
|   requestCreatePayment, | ||||
|   requestDeletePayment, | ||||
|   requestUpdatePayment, | ||||
|   requestListPayments | ||||
| } from '@/api/ADempiere/form/point-of-sales.js' | ||||
| import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js' | ||||
| import { showMessage } from '@/utils/ADempiere/notification.js' | ||||
| 
 | ||||
|  | @ -9,7 +15,9 @@ const collection = { | |||
|     multiplyRate: 1, | ||||
|     divideRate: 1, | ||||
|     multiplyRateCollection: 1, | ||||
|     divideRateCollection: 1 | ||||
|     divideRateCollection: 1, | ||||
|     listPayments: [], | ||||
|     tenderTypeDisplaye: [] | ||||
|   }, | ||||
|   mutations: { | ||||
|     addPaymentBox(state, paymentBox) { | ||||
|  | @ -26,27 +34,51 @@ const collection = { | |||
|     }, | ||||
|     currencyDivideRateCollection(state, divideRateCollection) { | ||||
|       state.divideRateCollection = divideRateCollection | ||||
|     }, | ||||
|     setListPayments(state, list) { | ||||
|       state.listPayments = list | ||||
|     }, | ||||
|     setTenderTypeDisplaye(state, tenderTypeDisplaye) { | ||||
|       state.tenderTypeDisplaye = tenderTypeDisplaye | ||||
|     } | ||||
|   }, | ||||
|   actions: { | ||||
|     /** | ||||
|      * creating boxes with the payment list | ||||
|      */ | ||||
|     setPaymentBox({ state, commit, getters }, params) { | ||||
|     setPaymentBox({ state, commit, getters }, { | ||||
|       quantityCahs, | ||||
|       bankUuid, | ||||
|       referenceNo, | ||||
|       description, | ||||
|       amount, | ||||
|       paymentDate, | ||||
|       tenderTypeCode, | ||||
|       currencyUuid | ||||
|     }) { | ||||
|       const payments = getters.getPaymentBox.find(element => { | ||||
|         if (params.tenderType === 'X' && element.currency.id === params.currency.id) { | ||||
|         if (tenderTypeCode === 'X' && element.currencyUuid === currencyUuid) { | ||||
|           return element | ||||
|         } | ||||
|       }) | ||||
|       if (isEmptyValue(payments)) { | ||||
|         commit('addPaymentBox', params) | ||||
|         commit('addPaymentBox', { | ||||
|           quantityCahs, | ||||
|           bankUuid, | ||||
|           referenceNo, | ||||
|           description, | ||||
|           amount, | ||||
|           paymentDate, | ||||
|           tenderTypeCode, | ||||
|           currencyUuid | ||||
|         }) | ||||
|       } else { | ||||
|         const addPayment = getters.getPaymentBox.map(item => { | ||||
|           if ((item.tenderType === params.tenderType) && item.currency.id === params.currency.id) { | ||||
|           if ((item.tenderTypeCode === tenderTypeCode) && item.currencyUuid === currencyUuid) { | ||||
|             return { | ||||
|               ...item, | ||||
|               payAmt: item.payAmt + params.payAmt, | ||||
|               quantityCahs: item.quantityCahs + params.quantityCahs | ||||
|               payAmt: item.amount + amount, | ||||
|               quantityCahs: item.quantityCahs + quantityCahs | ||||
|             } | ||||
|           } | ||||
|           return item | ||||
|  | @ -120,6 +152,121 @@ const collection = { | |||
|     }, | ||||
|     changeDivideRate({ commit }, divideRate) { | ||||
|       commit('currencyDivideRate', divideRate) | ||||
|     }, | ||||
|     createPayments({ dispatch, state, getters }, { | ||||
|       posUuid, | ||||
|       orderUuid, | ||||
|       invoiceUuid, | ||||
|       bankUuid, | ||||
|       referenceNo, | ||||
|       description, | ||||
|       amount, | ||||
|       paymentDate, | ||||
|       tenderTypeCode, | ||||
|       currencyUuid | ||||
|     }) { | ||||
|       const listPayments = getters.getListPayments.find(payment => { | ||||
|         if ((payment.tenderTypeCode === tenderTypeCode) && (payment.tenderTypeCode === 'X') && (currencyUuid === payment.currencyUuid)) { | ||||
|           return payment | ||||
|         } | ||||
|         return undefined | ||||
|       }) | ||||
|       if (isEmptyValue(listPayments)) { | ||||
|         requestCreatePayment({ | ||||
|           posUuid, | ||||
|           orderUuid, | ||||
|           invoiceUuid, | ||||
|           bankUuid, | ||||
|           referenceNo, | ||||
|           description, | ||||
|           amount, | ||||
|           paymentDate, | ||||
|           tenderTypeCode, | ||||
|           currencyUuid | ||||
|         }) | ||||
|           .then(response => { | ||||
|             const orderUuid = response.order_uuid | ||||
|             dispatch('listPayments', { orderUuid }) | ||||
|           }) | ||||
|           .catch(error => { | ||||
|             console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) | ||||
|             showMessage({ | ||||
|               type: 'error', | ||||
|               message: error.message, | ||||
|               showClose: true | ||||
|             }) | ||||
|           }) | ||||
|       } else { | ||||
|         requestUpdatePayment({ | ||||
|           paymentUuid: listPayments.uuid, | ||||
|           bankUuid, | ||||
|           referenceNo, | ||||
|           description, | ||||
|           amount: listPayments.amount + amount, | ||||
|           paymentDate, | ||||
|           tenderTypeCode | ||||
|         }) | ||||
|           .then(response => { | ||||
|             const orderUuid = response.order_uuid | ||||
|             dispatch('listPayments', { orderUuid }) | ||||
|           }) | ||||
|           .catch(error => { | ||||
|             console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) | ||||
|             showMessage({ | ||||
|               type: 'error', | ||||
|               message: error.message, | ||||
|               showClose: true | ||||
|             }) | ||||
|           }) | ||||
|       } | ||||
|     }, | ||||
|     deletetPayments({ dispatch }, { | ||||
|       orderUuid, | ||||
|       paymentUuid | ||||
|     }) { | ||||
|       console.log(paymentUuid, orderUuid) | ||||
|       requestDeletePayment({ | ||||
|         paymentUuid | ||||
|       }) | ||||
|         .then(response => { | ||||
|           console.log(response.listPayments) | ||||
|           dispatch('listPayments', { orderUuid }) | ||||
|         }) | ||||
|         .catch(error => { | ||||
|           console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) | ||||
|           showMessage({ | ||||
|             type: 'error', | ||||
|             message: error.message, | ||||
|             showClose: true | ||||
|           }) | ||||
|         }) | ||||
|     }, | ||||
|     listPayments({ commit }, { posUuid, orderUuid }) { | ||||
|       requestListPayments({ | ||||
|         posUuid, | ||||
|         orderUuid | ||||
|       }) | ||||
|         .then(response => { | ||||
|           console.log(response.listPayments) | ||||
|           commit('setListPayments', response.listPayments) | ||||
|         }) | ||||
|         .catch(error => { | ||||
|           console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) | ||||
|           showMessage({ | ||||
|             type: 'error', | ||||
|             message: error.message, | ||||
|             showClose: true | ||||
|           }) | ||||
|         }) | ||||
|     }, | ||||
|     tenderTypeDisplaye({ commit }, tenderType) { | ||||
|       const displayTenderType = tenderType.map(item => { | ||||
|         return { | ||||
|           tenderTypeCode: item.id, | ||||
|           tenderTypeDisplay: item.label | ||||
|         } | ||||
|       }) | ||||
|       commit('setTenderTypeDisplaye', displayTenderType) | ||||
|     } | ||||
|   }, | ||||
|   getters: { | ||||
|  | @ -137,6 +284,13 @@ const collection = { | |||
|     }, | ||||
|     getDivideRateCollection: (state) => { | ||||
|       return state.divideRateCollection | ||||
|     }, | ||||
|     getListPayments: (state) => { | ||||
|       console.log(state.listPayments) | ||||
|       return state.listPayments | ||||
|     }, | ||||
|     getTenderTypeDisplaye: (state) => { | ||||
|       return state.tenderTypeDisplaye | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -136,3 +136,23 @@ export function convertResourceReference(resourceReferenceToConvert) { | |||
|   } | ||||
|   return undefined | ||||
| } | ||||
| export function paymentsMethod(payments) { | ||||
|   if (payments) { | ||||
|     return { | ||||
|       amount: payments.amount, | ||||
|       bankUuid: payments.bank_uuid, | ||||
|       businessPartner: payments.business_partner, | ||||
|       currencyUuid: payments.currency_uuid, | ||||
|       description: payments.description, | ||||
|       documentNo: payments.document_no, | ||||
|       documentStatus: payments.document_status, | ||||
|       id: payments.id, | ||||
|       orderUuid: payments.order_uuid, | ||||
|       paymentDate: payments.payment_date, | ||||
|       referenceNo: payments.reference_no, | ||||
|       tenderTypeCode: payments.tender_type_code, | ||||
|       uuid: payments.uuid | ||||
|     } | ||||
|   } | ||||
|   return undefined | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Elsio Sanchez
						Elsio Sanchez