| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> |
| |
| |
| <!-- most simple test both invoice and payment same amount same currency --> |
| <simple-method method-name="testInvoiceAppl" short-description="test the application of a payment against an invoice" login-required="false"> |
| |
| <!-- from the test data --> |
| <set field="serviceInMap.invoiceId" value="appltest10000"/> |
| <set field="serviceInMap.paymentId" value="appltest10000"/> |
| |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="system"/> |
| </entity-one> |
| |
| <set field="serviceInMap.userLogin" from-field="userLogin"/> |
| <call-service service-name="createPaymentApplication" in-map-name="serviceInMap" include-user-login="false"> |
| <result-to-field result-name="amountApplied"/> |
| <result-to-field result-name="paymentApplicationId"/> |
| </call-service> |
| <entity-one entity-name="PaymentApplication" value-field="paymentApplication"> |
| <field-map field-name="paymentApplicationId" from-field="paymentApplicationId"/> |
| </entity-one> |
| <entity-one entity-name="Payment" value-field="payment"> |
| <field-map field-name="paymentId" from-field="serviceInMap.paymentId"/> |
| </entity-one> |
| <assert> |
| <not><if-empty field="paymentApplication"/></not> |
| <if-compare-field field="paymentApplication.invoiceId" operator="equals" to-field="serviceInMap.invoiceId"/> |
| <if-compare-field field="paymentApplication.paymentId" operator="equals" to-field="serviceInMap.paymentId"/> |
| <if-compare-field field="paymentApplication.amountApplied" operator="equals" to-field="payment.amount"/> |
| </assert> |
| <check-errors/> |
| <!-- both payment and invoice should be completely applied --> |
| <call-class-method method-name="getPaymentNotApplied" class-name="org.apache.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.paymentId"/> |
| </call-class-method> |
| <call-class-method method-name="getInvoiceNotApplied" class-name="org.apache.ofbiz.accounting.invoice.InvoiceWorker" ret-field="notAppliedInvoice"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.invoiceId"/> |
| </call-class-method> |
| <set field="zero" value="0" type="BigDecimal"/> |
| <assert> |
| <if-compare-field operator="equals" field="notAppliedPayment" to-field="zero"/> |
| <if-compare-field operator="equals" field="notAppliedInvoice" to-field="zero"/> |
| </assert> |
| <check-errors/> |
| <remove-value value-field="paymentApplication"/> |
| </simple-method> |
| |
| |
| <simple-method method-name="testBillingAppl" short-description="test the application of a payment against an billing account" login-required="false"> |
| <!-- from the test data --> |
| <set field="serviceInMap.paymentId" value="appltest10000"/> |
| <set field="serviceInMap.billingAccountId" value="appltest10000"/> |
| |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="system"/> |
| </entity-one> |
| |
| <set field="serviceInMap.userLogin" from-field="userLogin"/> |
| <call-service service-name="createPaymentApplication" in-map-name="serviceInMap" include-user-login="false"> |
| <result-to-field result-name="amountApplied"/> |
| <result-to-field result-name="paymentApplicationId"/> |
| </call-service> |
| <entity-one entity-name="PaymentApplication" value-field="paymentApplication"> |
| <field-map field-name="paymentApplicationId" from-field="paymentApplicationId"/> |
| </entity-one> |
| <call-class-method method-name="getPaymentNotApplied" class-name="org.apache.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.paymentId"/> |
| </call-class-method> |
| <entity-one entity-name="Payment" value-field="payment"> |
| <field-map field-name="paymentId" from-field="serviceInMap.paymentId"/> |
| </entity-one> |
| <assert> |
| <not><if-empty field="paymentApplication"/></not> |
| <if-compare-field field="paymentApplication.billingAccountId" operator="equals" to-field="serviceInMap.billingAccountId"/> |
| <if-compare-field field="paymentApplication.paymentId" operator="equals" to-field="serviceInMap.paymentId"/> |
| <if-compare-field field="paymentApplication.amountApplied" operator="equals" to-field="payment.amount"/> |
| </assert> |
| <check-errors/> |
| <!-- both payment and invoice should be completely applied --> |
| <call-class-method method-name="getPaymentNotApplied" class-name="org.apache.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.paymentId"/> |
| </call-class-method> |
| <entity-one entity-name="BillingAccount" value-field="billingAccount"> |
| <field-map field-name="billingAccountId" from-field="serviceInMap.billingAccountId"/> |
| </entity-one> |
| <call-class-method method-name="getBillingAccountBalance" class-name="org.apache.ofbiz.order.order.OrderReadHelper" ret-field="appliedBillling"> |
| <field field="billingAccount" type="GenericValue"/> |
| </call-class-method> |
| <set field="zero" value="0" type="BigDecimal"/> |
| <assert> |
| <if-compare-field operator="equals" field="notAppliedPayment" to-field="zero"/> |
| <if-compare-field operator="equals" field="appliedBilling" to-field="paymentAmount"/> |
| </assert> |
| <check-errors/> |
| <remove-value value-field="paymentApplication"/> |
| </simple-method> |
| |
| <simple-method method-name="testToPayment" short-description="test the application of a payment against anotherpayment" login-required="false"> |
| <!-- from the test data --> |
| <set field="serviceInMap.paymentId" value="appltest10000"/> |
| <set field="serviceInMap.toPaymentId" value="appltest10001"/> |
| |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="system"/> |
| </entity-one> |
| |
| <set field="serviceInMap.userLogin" from-field="userLogin"/> |
| <call-service service-name="createPaymentApplication" in-map-name="serviceInMap" include-user-login="false"> |
| <result-to-field result-name="amountApplied"/> |
| <result-to-field result-name="paymentApplicationId"/> |
| </call-service> |
| <entity-one entity-name="PaymentApplication" value-field="paymentApplication"> |
| <field-map field-name="paymentApplicationId" from-field="paymentApplicationId"/> |
| </entity-one> |
| <call-class-method method-name="getPaymentNotApplied" class-name="org.apache.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.paymentId"/> |
| </call-class-method> |
| <entity-one entity-name="Payment" value-field="payment"> |
| <field-map field-name="paymentId" from-field="serviceInMap.paymentId"/> |
| </entity-one> |
| <assert> |
| <not><if-empty field="paymentApplication"/></not> |
| <if-compare-field field="paymentApplication.toPaymentId" operator="equals" to-field="serviceInMap.toPaymentId"/> |
| <if-compare-field field="paymentApplication.paymentId" operator="equals" to-field="serviceInMap.paymentId"/> |
| <if-compare-field field="paymentApplication.amountApplied" operator="equals" to-field="payment.amount"/> |
| </assert> |
| <check-errors/> |
| <!-- both payment and invoice should be completely applied --> |
| <call-class-method method-name="getPaymentNotApplied" class-name="org.apache.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.paymentId"/> |
| </call-class-method> |
| <call-class-method method-name="getPaymentNotApplied" class-name="org.apache.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedToPayment"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.toPaymentId"/> |
| </call-class-method> |
| <set field="zero" value="0" type="BigDecimal"/> |
| <assert> |
| <if-compare-field operator="equals" field="notAppliedPayment" to-field="zero"/> |
| <if-compare-field operator="equals" field="notAppliedToPayment" to-field="zero"/> |
| </assert> |
| <check-errors/> |
| <remove-value value-field="paymentApplication"/> |
| </simple-method> |
| <simple-method method-name="testTaxGeoId" short-description="test the application of a payment against a tax geo id" login-required="false"> |
| <!-- from the test data --> |
| <set field="serviceInMap.paymentId" value="appltest10000"/> |
| <set field="serviceInMap.taxAuthGeoId" value="UT"/> |
| |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="system"/> |
| </entity-one> |
| |
| <set field="serviceInMap.userLogin" from-field="userLogin"/> |
| <call-service service-name="createPaymentApplication" in-map-name="serviceInMap" include-user-login="false"> |
| <result-to-field result-name="amountApplied"/> |
| <result-to-field result-name="paymentApplicationId"/> |
| </call-service> |
| <entity-one entity-name="PaymentApplication" value-field="paymentApplication"> |
| <field-map field-name="paymentApplicationId" from-field="paymentApplicationId"/> |
| </entity-one> |
| <entity-one entity-name="Payment" value-field="payment"> |
| <field-map field-name="paymentId" from-field="serviceInMap.paymentId"/> |
| </entity-one> |
| <assert> |
| <not><if-empty field="paymentApplication"/></not> |
| <if-compare-field field="paymentApplication.taxAuthGeoId" operator="equals" to-field="serviceInMap.taxAuthGeoId"/> |
| <if-compare-field field="paymentApplication.paymentId" operator="equals" to-field="serviceInMap.paymentId"/> |
| <if-compare-field field="paymentApplication.amountApplied" operator="equals" to-field="payment.amount"/> |
| </assert> |
| <check-errors/> |
| <!-- payment should be completely applied --> |
| <call-class-method method-name="getPaymentNotApplied" class-name="org.apache.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment"> |
| <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/> |
| <field field="serviceInMap.paymentId"/> |
| </call-class-method> |
| <set field="zero" value="0" type="BigDecimal"/> |
| <assert> |
| <if-compare-field operator="equals" field="notAppliedPayment" to-field="zero"/> |
| </assert> |
| <check-errors/> |
| <remove-value value-field="paymentApplication"/> |
| </simple-method> |
| |
| |
| </simple-methods> |