@adempiere/grpc-api
Advanced tools
Comparing version 4.3.2 to 4.3.3
{ | ||
"name": "@adempiere/grpc-api", | ||
"version": "4.3.2", | ||
"version": "4.3.3", | ||
"description": "ADempiere Web write in Javascript for a node service", | ||
@@ -5,0 +5,0 @@ "author": "Yamel Senih", |
@@ -35,24 +35,2 @@ // GENERATED CODE -- DO NOT EDIT! | ||
function serialize_payment_allocation_CalculateDifferenceRequest(arg) { | ||
if (!(arg instanceof proto_payment_allocation_pb.CalculateDifferenceRequest)) { | ||
throw new Error('Expected argument of type payment_allocation.CalculateDifferenceRequest'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_payment_allocation_CalculateDifferenceRequest(buffer_arg) { | ||
return proto_payment_allocation_pb.CalculateDifferenceRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_payment_allocation_CalculateDifferenceResponse(arg) { | ||
if (!(arg instanceof proto_payment_allocation_pb.CalculateDifferenceResponse)) { | ||
throw new Error('Expected argument of type payment_allocation.CalculateDifferenceResponse'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_payment_allocation_CalculateDifferenceResponse(buffer_arg) { | ||
return proto_payment_allocation_pb.CalculateDifferenceResponse.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_payment_allocation_ListBusinessPartnersRequest(arg) { | ||
@@ -287,13 +265,2 @@ if (!(arg instanceof proto_payment_allocation_pb.ListBusinessPartnersRequest)) { | ||
}, | ||
calculateDifference: { | ||
path: '/payment_allocation.PaymentAllocation/CalculateDifference', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_payment_allocation_pb.CalculateDifferenceRequest, | ||
responseType: proto_payment_allocation_pb.CalculateDifferenceResponse, | ||
requestSerialize: serialize_payment_allocation_CalculateDifferenceRequest, | ||
requestDeserialize: deserialize_payment_allocation_CalculateDifferenceRequest, | ||
responseSerialize: serialize_payment_allocation_CalculateDifferenceResponse, | ||
responseDeserialize: deserialize_payment_allocation_CalculateDifferenceResponse, | ||
}, | ||
process: { | ||
@@ -300,0 +267,0 @@ path: '/payment_allocation.PaymentAllocation/Process', |
@@ -420,54 +420,2 @@ /************************************************************************************* | ||
/** | ||
* Calculate and Get Difference | ||
* @param {string} token | ||
* @param {Array} paymentSelectionsList | ||
* @param {Array} invoiceSelectionList | ||
*/ | ||
calculateDifference({ | ||
token, | ||
// DSL | ||
paymentSelectionsList = [], | ||
invoiceSelectionList = [] | ||
}, callback) { | ||
const { CalculateDifferenceRequest } = this.stubFile; | ||
const request = new CalculateDifferenceRequest(); | ||
const { getKeyValueSelectionToGRPC } = require('@adempiere/grpc-api/src/utils/baseDataTypeToGRPC.js'); | ||
// payment selections list | ||
paymentSelectionsList.forEach(payment => { | ||
// selection format = { selectionId: number, selectionValues: [{ columName, value, valueType }] } | ||
const convertedRecord = getKeyValueSelectionToGRPC({ | ||
selectionId: payment.recordId, | ||
selectionUuid: payment.recordUuid, | ||
selectionValues: payment.attributesList | ||
}); | ||
request.addPayments(convertedRecord); | ||
}); | ||
// invoice selections list | ||
invoiceSelectionList.forEach(invoice => { | ||
// selection format = { selectionId: number, selectionValues: [{ columName, value, valueType }] } | ||
const convertedRecord = getKeyValueSelectionToGRPC({ | ||
selectionId: invoice.recordId, | ||
selectionUuid: invoice.recordUuid, | ||
selectionValues: invoice.attributesList | ||
}); | ||
request.addInvocies(convertedRecord); | ||
}); | ||
const metadata = getMetadata({ | ||
token | ||
}); | ||
this.getPaymentAllocationService().getDifference( | ||
request, | ||
metadata, | ||
callback | ||
); | ||
} | ||
/** | ||
* Process Payment Allocation | ||
@@ -503,3 +451,5 @@ * @param {string} token | ||
}, callback) { | ||
const { ProcessRequest } = this.stubFile; | ||
const { | ||
ProcessRequest, PaymentSelection, InvoiceSelection | ||
} = this.stubFile; | ||
const request = new ProcessRequest(); | ||
@@ -527,4 +477,4 @@ | ||
const { getTimestamp } = require('@adempiere/grpc-api/src/utils/valueUtils.js'); | ||
if (!isEmptyValue(date)) { | ||
const { getTimestamp } = require('@adempiere/grpc-api/src/utils/valueUtils.js'); | ||
request.setDate( | ||
@@ -537,25 +487,42 @@ getTimestamp(date) | ||
const { getKeyValueSelectionToGRPC } = require('@adempiere/grpc-api/src/utils/baseDataTypeToGRPC.js'); | ||
const { getDecimalToGRPC } = require('@adempiere/grpc-api/src/utils/baseDataTypeToGRPC.js'); | ||
// payment selections list | ||
paymentSelectionsList.forEach(payment => { | ||
// selection format = { selectionId: number, selectionValues: [{ columName, value, valueType }] } | ||
const convertedRecord = getKeyValueSelectionToGRPC({ | ||
selectionId: payment.recordId, | ||
selectionUuid: payment.recordUuid, | ||
selectionValues: payment.attributesList | ||
}); | ||
paymentSelectionsList.forEach(paymentSelection => { | ||
const paymentSelectionInstance = new PaymentSelection(); | ||
request.addPayments(convertedRecord); | ||
paymentSelectionInstance.setId(paymentSelection.id); | ||
paymentSelectionInstance.setUuid(paymentSelection.uuid); | ||
paymentSelectionInstance.setTransactionDate( | ||
getTimestamp(paymentSelection.transaction_date) | ||
); | ||
paymentSelectionInstance.setAppliedAmount( | ||
getDecimalToGRPC(paymentSelection.applied_amount) | ||
); | ||
request.addPaymentsSelections(paymentSelectionInstance); | ||
}); | ||
// invoice selections list | ||
invoiceSelectionList.forEach(invoice => { | ||
// selection format = { selectionId: number, selectionValues: [{ columName, value, valueType }] } | ||
const convertedRecord = getKeyValueSelectionToGRPC({ | ||
selectionId: invoice.recordId, | ||
selectionUuid: invoice.recordUuid, | ||
selectionValues: invoice.attributesList | ||
}); | ||
invoiceSelectionList.forEach(invoiceSelection => { | ||
const invoiceSelectionInstance = new InvoiceSelection(); | ||
request.addInvocies(convertedRecord); | ||
invoiceSelectionInstance.setId(invoiceSelection.id); | ||
invoiceSelectionInstance.setUuid(invoiceSelection.uuid); | ||
invoiceSelectionInstance.setDateInvoiced( | ||
getTimestamp(invoiceSelection.date_invoiced) | ||
); | ||
invoiceSelectionInstance.setAppliedAmount( | ||
getDecimalToGRPC(invoiceSelection.applied_amount) | ||
); | ||
invoiceSelectionInstance.setDiscountAmount( | ||
getDecimalToGRPC(invoiceSelection.discount_amount) | ||
); | ||
invoiceSelectionInstance.setWriteOffAmount( | ||
getDecimalToGRPC(invoiceSelection.write_off_amount) | ||
); | ||
invoiceSelectionInstance.setOpenAmount( | ||
getDecimalToGRPC(invoiceSelection.open_amount) | ||
); | ||
request.addInvocieSelections(invoiceSelectionInstance); | ||
}); | ||
@@ -562,0 +529,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6340827
180163