@adempiere/grpc-api
Advanced tools
Comparing version 1.3.3 to 1.3.4
107
index.js
@@ -1904,4 +1904,3 @@ /************************************************************************************* | ||
const request = new ListOrdersRequest() | ||
const { convertCriteriaToGRPC } = require('./lib/convertValues.js') | ||
const { getDecimalFromNumber } = require('./lib/convertValues.js') | ||
const { convertCriteriaToGRPC, getDecimalFromNumber } = require('./lib/convertValues.js') | ||
request.setCriteria(convertCriteriaToGRPC({ | ||
@@ -1954,2 +1953,106 @@ tableName, | ||
// Payments | ||
// Create Payment | ||
createPayment({ | ||
token, | ||
posUuid, | ||
orderUuid, | ||
invoiceUuid, | ||
bankUuid, | ||
referenceNo, | ||
description, | ||
amount, | ||
paymentDate, | ||
tenderTypeCode, | ||
currencyUuid, | ||
language | ||
}, callback) { | ||
const { CreatePaymentRequest } = require('./src/grpc/proto/point_of_sales_pb.js') | ||
const { convertValueToGRPC, getDecimalFromNumber } = require('./lib/convertValues.js') | ||
const request = new CreatePaymentRequest() | ||
request.setPosUuid(posUuid) | ||
request.setOrderUuid(orderUuid) | ||
if (bankUuid) { | ||
request.setBankUuid(bankUuid) | ||
} | ||
if (invoiceUuid) { | ||
request.setInvoiceUuid(invoiceUuid) | ||
} | ||
if (referenceNo) { | ||
request.setReferenceNo(referenceNo) | ||
} | ||
if (description) { | ||
request.setDescription(description) | ||
} | ||
if (tenderTypeCode) { | ||
request.setTenderTypeCode(tenderTypeCode) | ||
} | ||
if (currencyUuid) { | ||
request.setCurrencyUuid(currencyUuid) | ||
} | ||
if(amount) { | ||
request.setAmount(getDecimalFromNumber(amount)) | ||
} | ||
if (paymentDate) { | ||
request.setPaymentDate(convertValueToGRPC({ | ||
value: paymentDate | ||
})) | ||
} | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getPosService().createPayment(request, callback) | ||
} | ||
// Update Payment | ||
updatePayment({ | ||
token, | ||
paymentUuid, | ||
bankUuid, | ||
referenceNo, | ||
description, | ||
amount, | ||
paymentDate, | ||
tenderTypeCode, | ||
language | ||
}, callback) { | ||
const { UpdatePaymentRequest } = require('./src/grpc/proto/point_of_sales_pb.js') | ||
const { convertValueToGRPC, getDecimalFromNumber } = require('./lib/convertValues.js') | ||
const request = new UpdatePaymentRequest() | ||
request.setPaymentUuid(paymentUuid) | ||
if (bankUuid) { | ||
request.setBankUuid(bankUuid) | ||
} | ||
if (referenceNo) { | ||
request.setReferenceNo(referenceNo) | ||
} | ||
if (description) { | ||
request.setDescription(description) | ||
} | ||
if (tenderTypeCode) { | ||
request.setTenderTypeCode(tenderTypeCode) | ||
} | ||
if(amount) { | ||
request.setAmount(getDecimalFromNumber(amount)) | ||
} | ||
if (paymentDate) { | ||
request.setPaymentDate(convertValueToGRPC({ | ||
value: paymentDate | ||
})) | ||
} | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getPosService().updatePayment(request, callback) | ||
} | ||
// Delete Payment | ||
deletePayment({ | ||
token, | ||
paymentUuid, | ||
language | ||
}, callback) { | ||
const { DeletePaymentRequest } = require('./src/grpc/proto/point_of_sales_pb.js') | ||
const request = new DeletePaymentRequest() | ||
request.setPaymentUuid(paymentUuid) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getPosService().deletePayment(request, callback) | ||
} | ||
// Get Sales Order | ||
@@ -1956,0 +2059,0 @@ getKeyLayout({ |
@@ -148,2 +148,41 @@ /************************************************************************************* | ||
convertPaymentFromGRPC(payment) { | ||
if (payment) { | ||
const { | ||
convertDocumentStatusFromGRPC, | ||
getDecimalFromGRPC | ||
} = require('./convertBaseDataType.js'); | ||
const { | ||
convertBusinessPartnerFromGRPC, | ||
convertSalesRepresentativeFromGRPC | ||
} = require('./convertCoreFunctionality.js'); | ||
return { | ||
uuid: payment.getUuid(), | ||
id: payment.getId(), | ||
document_no: payment.getDocumentNo(), | ||
sales_representative: convertSalesRepresentativeFromGRPC( | ||
payment.getSalesRepresentative() | ||
), | ||
document_status: convertDocumentStatusFromGRPC( | ||
payment.getDocumentStatus() | ||
), | ||
amount: getDecimalFromGRPC( | ||
payment.getAmount() | ||
), | ||
tender_type_code: payment.getTenderTypeCode(), | ||
currency_uuid: payment.getCurrencyUuid(), | ||
description: payment.getDescription(), | ||
reference_no: payment.getReferenceNo(), | ||
order_uuid: payment.getOrderUuid(), | ||
bank_uuid: payment.getBankUuid(), | ||
payment_date: new Date(payment.getPaymentDate()), | ||
business_partner: convertBusinessPartnerFromGRPC( | ||
payment.getBusinessPartner() | ||
) | ||
}; | ||
} | ||
return undefined; | ||
}, | ||
convertKeyFromGRPC(key) { | ||
@@ -150,0 +189,0 @@ if (key) { |
{ | ||
"name": "@adempiere/grpc-api", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "ADempiere Web Store write in Javascript for a node service", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,2 +47,13 @@ // GENERATED CODE -- DO NOT EDIT! | ||
function serialize_data_CreatePaymentRequest(arg) { | ||
if (!(arg instanceof proto_point_of_sales_pb.CreatePaymentRequest)) { | ||
throw new Error('Expected argument of type data.CreatePaymentRequest'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_data_CreatePaymentRequest(buffer_arg) { | ||
return proto_point_of_sales_pb.CreatePaymentRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_data_DeleteOrderLineRequest(arg) { | ||
@@ -70,2 +81,13 @@ if (!(arg instanceof proto_point_of_sales_pb.DeleteOrderLineRequest)) { | ||
function serialize_data_DeletePaymentRequest(arg) { | ||
if (!(arg instanceof proto_point_of_sales_pb.DeletePaymentRequest)) { | ||
throw new Error('Expected argument of type data.DeletePaymentRequest'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_data_DeletePaymentRequest(buffer_arg) { | ||
return proto_point_of_sales_pb.DeletePaymentRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_data_Empty(arg) { | ||
@@ -170,2 +192,24 @@ if (!(arg instanceof proto_base_data_type_pb.Empty)) { | ||
function serialize_data_ListPaymentsRequest(arg) { | ||
if (!(arg instanceof proto_point_of_sales_pb.ListPaymentsRequest)) { | ||
throw new Error('Expected argument of type data.ListPaymentsRequest'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_data_ListPaymentsRequest(buffer_arg) { | ||
return proto_point_of_sales_pb.ListPaymentsRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_data_ListPaymentsResponse(arg) { | ||
if (!(arg instanceof proto_point_of_sales_pb.ListPaymentsResponse)) { | ||
throw new Error('Expected argument of type data.ListPaymentsResponse'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_data_ListPaymentsResponse(buffer_arg) { | ||
return proto_point_of_sales_pb.ListPaymentsResponse.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_data_ListPointOfSalesRequest(arg) { | ||
@@ -237,2 +281,13 @@ if (!(arg instanceof proto_point_of_sales_pb.ListPointOfSalesRequest)) { | ||
function serialize_data_Payment(arg) { | ||
if (!(arg instanceof proto_point_of_sales_pb.Payment)) { | ||
throw new Error('Expected argument of type data.Payment'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_data_Payment(buffer_arg) { | ||
return proto_point_of_sales_pb.Payment.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_data_PointOfSales(arg) { | ||
@@ -293,3 +348,14 @@ if (!(arg instanceof proto_point_of_sales_pb.PointOfSales)) { | ||
function serialize_data_UpdatePaymentRequest(arg) { | ||
if (!(arg instanceof proto_point_of_sales_pb.UpdatePaymentRequest)) { | ||
throw new Error('Expected argument of type data.UpdatePaymentRequest'); | ||
} | ||
return Buffer.from(arg.serializeBinary()); | ||
} | ||
function deserialize_data_UpdatePaymentRequest(buffer_arg) { | ||
return proto_point_of_sales_pb.UpdatePaymentRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
// POS Service used for ADempiere integration | ||
@@ -465,4 +531,53 @@ var StoreService = exports.StoreService = { | ||
}, | ||
// Payments | ||
// Create Payment | ||
createPayment: { | ||
path: '/data.Store/CreatePayment', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_point_of_sales_pb.CreatePaymentRequest, | ||
responseType: proto_point_of_sales_pb.Payment, | ||
requestSerialize: serialize_data_CreatePaymentRequest, | ||
requestDeserialize: deserialize_data_CreatePaymentRequest, | ||
responseSerialize: serialize_data_Payment, | ||
responseDeserialize: deserialize_data_Payment, | ||
}, | ||
// Update Payment | ||
updatePayment: { | ||
path: '/data.Store/UpdatePayment', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_point_of_sales_pb.UpdatePaymentRequest, | ||
responseType: proto_point_of_sales_pb.Payment, | ||
requestSerialize: serialize_data_UpdatePaymentRequest, | ||
requestDeserialize: deserialize_data_UpdatePaymentRequest, | ||
responseSerialize: serialize_data_Payment, | ||
responseDeserialize: deserialize_data_Payment, | ||
}, | ||
// Delete Payment | ||
deletePayment: { | ||
path: '/data.Store/DeletePayment', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_point_of_sales_pb.DeletePaymentRequest, | ||
responseType: proto_base_data_type_pb.Empty, | ||
requestSerialize: serialize_data_DeletePaymentRequest, | ||
requestDeserialize: deserialize_data_DeletePaymentRequest, | ||
responseSerialize: serialize_data_Empty, | ||
responseDeserialize: deserialize_data_Empty, | ||
}, | ||
// List Payments | ||
listPayments: { | ||
path: '/data.Store/ListPayments', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_point_of_sales_pb.ListPaymentsRequest, | ||
responseType: proto_point_of_sales_pb.ListPaymentsResponse, | ||
requestSerialize: serialize_data_ListPaymentsRequest, | ||
requestDeserialize: deserialize_data_ListPaymentsRequest, | ||
responseSerialize: serialize_data_ListPaymentsResponse, | ||
responseDeserialize: deserialize_data_ListPaymentsResponse, | ||
}, | ||
}; | ||
exports.StoreClient = grpc.makeGenericClientConstructor(StoreService); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2252152
65910