This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 5880859 Implemented: Convert voidPayment service from mini-lang to groovy DSL (OFBIZ-11487) 5880859 is described below commit 5880859c7c7674d6860f82f0184da6fce8f05607 Author: Jacques Le Roux <[hidden email]> AuthorDate: Wed Jul 1 12:05:22 2020 +0200 Implemented: Convert voidPayment service from mini-lang to groovy DSL (OFBIZ-11487) Thanks: Devanshu Vyas for report and Sourabh Punyani for implementation --- .../groovyScripts/payment/PaymentServices.groovy | 15 +++++++++++++++ .../accounting/minilang/payment/PaymentServices.xml | 7 ------- applications/accounting/servicedef/services_payment.xml | 4 ++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy index 6cee217..ecd5851 100644 --- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy +++ b/applications/accounting/groovyScripts/payment/PaymentServices.groovy @@ -276,4 +276,19 @@ def createFinAccoutnTransFromPayment() { return serviceResult } +def quickSendPayment() { + Map result = success() + Map updatePaymentCtx = dispatcher.getDispatchContext().makeValidContext('updatePayment', 'IN', parameters) + Map updatePaymentResp = dispatcher.runSync('updatePayment', updatePaymentCtx) + + if (ServiceUtil.isError(updatePaymentResp)) return updatePaymentResp + + Map setPaymentStatusCtx = dispatcher.getDispatchContext().makeValidContext('setPaymentStatus', 'IN', parameters) + setPaymentStatusCtx.statusId = "PMNT_SENT" + Map setPaymentStatusResp = dispatcher.runSync('setPaymentStatus', setPaymentStatusCtx) + + if (ServiceUtil.isError(setPaymentStatusResp)) return setPaymentStatusResp + + return result +} \ No newline at end of file diff --git a/applications/accounting/minilang/payment/PaymentServices.xml b/applications/accounting/minilang/payment/PaymentServices.xml index 59be652..d5895eb 100644 --- a/applications/accounting/minilang/payment/PaymentServices.xml +++ b/applications/accounting/minilang/payment/PaymentServices.xml @@ -228,13 +228,6 @@ under the License. </if-compare-field> </simple-method> - <simple-method method-name="quickSendPayment" short-description="Update a Payment then set it to status PMNT_SENT"> - <call-service service-name="updatePayment" in-map-name="parameters"/> - <set field="param.paymentId" from-field="parameters.paymentId"/> - <set field="param.statusId" value="PMNT_SENT"/> - <call-service service-name="setPaymentStatus" in-map-name="param"/> - </simple-method> - <simple-method method-name="createPaymentAndApplication" short-description="Create a payment and a payment application for the full amount"> <set-service-fields service-name="createPayment" map="parameters" to-map="createPaymentInMap"/> <call-service service-name="createPayment" in-map-name="createPaymentInMap"> diff --git a/applications/accounting/servicedef/services_payment.xml b/applications/accounting/servicedef/services_payment.xml index d15e2b4..6d3f878 100644 --- a/applications/accounting/servicedef/services_payment.xml +++ b/applications/accounting/servicedef/services_payment.xml @@ -59,8 +59,8 @@ under the License. <attribute name="paymentId" type="String" mode="IN" optional="false"/> </service> - <service name="quickSendPayment" engine="simple" default-entity-name="Payment" - location="component://accounting/minilang/payment/PaymentServices.xml" invoke="quickSendPayment"> + <service name="quickSendPayment" engine="groovy" default-entity-name="Payment" + location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="quickSendPayment"> <description>Updates a Payment and then marks it as PMNT_SENT</description> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> |
Free forum by Nabble | Edit this page |