[GitHub] [ofbiz-framework] priyasharma1 opened a new pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] priyasharma1 opened a new pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox

priyasharma1 opened a new pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158


   
   (OFBIZ-11481)
   
   Done the following:
   - removed mini-lang version of the service
   - added groovy version
   - updated the service definition


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] sonarcloud[bot] commented on pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox

sonarcloud[bot] commented on pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#issuecomment-633023787


   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] dixitdeepak commented on a change in pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox
In reply to this post by GitBox

dixitdeepak commented on a change in pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#discussion_r454106321



##########
File path: applications/accounting/groovyScripts/payment/PaymentServices.groovy
##########
@@ -134,3 +136,77 @@ def updatePaymentContent() {
     }
 }
 
+def createPaymentApplication() {
+    // Create a Payment Application
+    if (!parameters.invoiceId && !parameters.billingAccountId && !parameters.taxAuthGeoId && !parameters.toPaymentId) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+    GenericValue paymentAppl = delegator.makeValue("PaymentApplication")
+    paymentAppl.setNonPKFields(parameters)
+
+    GenericValue payment = from("Payment").where("paymentId", parameters.paymentId).queryOne()
+    if (!payment) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+
+    BigDecimal notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment)
+
+    if (parameters.invoiceId) {
+        // get the invoice and do some further validation against it
+        GenericValue invoice = from("Invoice").where("invoiceId", parameters.invoiceId).queryOne()
+        // check the currencies if they are compatible
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId != payment.actualCurrencyUomId) {
+            return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingCurrenciesOfInvoiceAndPaymentNotCompatible)
+        }
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId == payment.actualCurrencyUomId) {
+            // if required get the payment amount in foreign currency (local we already have)
+            Boolean actual = true
+            notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment, actual)
+        }
+        // get the amount that has not been applied yet for the invoice (outstanding amount)
+        BigDecimal notAppliedInvoice = InvoiceWorker.getInvoiceNotApplied(invoice)
+        if (notAppliedInvoice <= notAppliedPayment) {
+            paymentAppl.amountApplied = notAppliedInvoice
+        } else {
+            paymentAppl.amountApplied = notAppliedPayment
+        }
+
+        if (invoice.billingAccountId) {
+            paymentAppl.billingAccountId = invoice.billingAccountId
+        }
+    }
+
+    if (parameters.toPaymentId) {
+        // get the to payment and check the parent types are compatible
+        GenericValue toPayment = from("Payment").where("paymentId", parameters.toPaymentId).queryOne()
+        if (toPayment) {
+            toPaymentType = from("PaymentType").where("paymentTypeId", toPayment.paymentTypeId).queryOne()
+        }
+        paymentType = from("PaymentType").where("paymentTypeId", payment.paymentTypeId).queryOne()

Review comment:
       Use cache.

##########
File path: applications/accounting/groovyScripts/payment/PaymentServices.groovy
##########
@@ -134,3 +136,77 @@ def updatePaymentContent() {
     }
 }
 
+def createPaymentApplication() {
+    // Create a Payment Application
+    if (!parameters.invoiceId && !parameters.billingAccountId && !parameters.taxAuthGeoId && !parameters.toPaymentId) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+    GenericValue paymentAppl = delegator.makeValue("PaymentApplication")
+    paymentAppl.setNonPKFields(parameters)
+
+    GenericValue payment = from("Payment").where("paymentId", parameters.paymentId).queryOne()
+    if (!payment) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+
+    BigDecimal notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment)
+
+    if (parameters.invoiceId) {
+        // get the invoice and do some further validation against it
+        GenericValue invoice = from("Invoice").where("invoiceId", parameters.invoiceId).queryOne()
+        // check the currencies if they are compatible
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId != payment.actualCurrencyUomId) {
+            return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingCurrenciesOfInvoiceAndPaymentNotCompatible)
+        }
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId == payment.actualCurrencyUomId) {
+            // if required get the payment amount in foreign currency (local we already have)
+            Boolean actual = true
+            notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment, actual)
+        }
+        // get the amount that has not been applied yet for the invoice (outstanding amount)
+        BigDecimal notAppliedInvoice = InvoiceWorker.getInvoiceNotApplied(invoice)
+        if (notAppliedInvoice <= notAppliedPayment) {
+            paymentAppl.amountApplied = notAppliedInvoice
+        } else {
+            paymentAppl.amountApplied = notAppliedPayment
+        }
+
+        if (invoice.billingAccountId) {
+            paymentAppl.billingAccountId = invoice.billingAccountId
+        }
+    }
+
+    if (parameters.toPaymentId) {
+        // get the to payment and check the parent types are compatible
+        GenericValue toPayment = from("Payment").where("paymentId", parameters.toPaymentId).queryOne()
+        if (toPayment) {
+            toPaymentType = from("PaymentType").where("paymentTypeId", toPayment.paymentTypeId).queryOne()

Review comment:
       we can use getRelated method with cache.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] priyasharma1 commented on a change in pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox
In reply to this post by GitBox

priyasharma1 commented on a change in pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#discussion_r454121486



##########
File path: applications/accounting/groovyScripts/payment/PaymentServices.groovy
##########
@@ -134,3 +136,77 @@ def updatePaymentContent() {
     }
 }
 
+def createPaymentApplication() {
+    // Create a Payment Application
+    if (!parameters.invoiceId && !parameters.billingAccountId && !parameters.taxAuthGeoId && !parameters.toPaymentId) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+    GenericValue paymentAppl = delegator.makeValue("PaymentApplication")
+    paymentAppl.setNonPKFields(parameters)
+
+    GenericValue payment = from("Payment").where("paymentId", parameters.paymentId).queryOne()
+    if (!payment) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+
+    BigDecimal notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment)
+
+    if (parameters.invoiceId) {
+        // get the invoice and do some further validation against it
+        GenericValue invoice = from("Invoice").where("invoiceId", parameters.invoiceId).queryOne()
+        // check the currencies if they are compatible
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId != payment.actualCurrencyUomId) {
+            return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingCurrenciesOfInvoiceAndPaymentNotCompatible)
+        }
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId == payment.actualCurrencyUomId) {
+            // if required get the payment amount in foreign currency (local we already have)
+            Boolean actual = true
+            notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment, actual)
+        }
+        // get the amount that has not been applied yet for the invoice (outstanding amount)
+        BigDecimal notAppliedInvoice = InvoiceWorker.getInvoiceNotApplied(invoice)
+        if (notAppliedInvoice <= notAppliedPayment) {
+            paymentAppl.amountApplied = notAppliedInvoice
+        } else {
+            paymentAppl.amountApplied = notAppliedPayment
+        }
+
+        if (invoice.billingAccountId) {
+            paymentAppl.billingAccountId = invoice.billingAccountId
+        }
+    }
+
+    if (parameters.toPaymentId) {
+        // get the to payment and check the parent types are compatible
+        GenericValue toPayment = from("Payment").where("paymentId", parameters.toPaymentId).queryOne()
+        if (toPayment) {
+            toPaymentType = from("PaymentType").where("paymentTypeId", toPayment.paymentTypeId).queryOne()

Review comment:
       Thanks, Deepak.
   As I was trying to make this improvement, I noticed that there two variables are never used i.e. paymentType and toPaymentType.
   Will it be fine to skip these two entity operations if they are not used?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] sonarcloud[bot] commented on pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox
In reply to this post by GitBox

sonarcloud[bot] commented on pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#issuecomment-658150509


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/10.png' alt='6.5%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list) [6.5% Duplication](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] verma-pawan commented on a change in pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox
In reply to this post by GitBox

verma-pawan commented on a change in pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#discussion_r454323351



##########
File path: applications/accounting/groovyScripts/payment/PaymentServices.groovy
##########
@@ -134,3 +136,77 @@ def updatePaymentContent() {
     }
 }
 
+def createPaymentApplication() {
+    // Create a Payment Application
+    if (!parameters.invoiceId && !parameters.billingAccountId && !parameters.taxAuthGeoId && !parameters.toPaymentId) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+    GenericValue paymentAppl = delegator.makeValue("PaymentApplication")
+    paymentAppl.setNonPKFields(parameters)
+
+    GenericValue payment = from("Payment").where("paymentId", parameters.paymentId).queryOne()
+    if (!payment) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+
+    BigDecimal notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment)
+
+    if (parameters.invoiceId) {
+        // get the invoice and do some further validation against it
+        GenericValue invoice = from("Invoice").where("invoiceId", parameters.invoiceId).queryOne()
+        // check the currencies if they are compatible
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId != payment.actualCurrencyUomId) {
+            return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingCurrenciesOfInvoiceAndPaymentNotCompatible)
+        }
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId == payment.actualCurrencyUomId) {
+            // if required get the payment amount in foreign currency (local we already have)
+            Boolean actual = true
+            notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment, actual)
+        }
+        // get the amount that has not been applied yet for the invoice (outstanding amount)
+        BigDecimal notAppliedInvoice = InvoiceWorker.getInvoiceNotApplied(invoice)
+        if (notAppliedInvoice <= notAppliedPayment) {
+            paymentAppl.amountApplied = notAppliedInvoice
+        } else {
+            paymentAppl.amountApplied = notAppliedPayment
+        }
+
+        if (invoice.billingAccountId) {
+            paymentAppl.billingAccountId = invoice.billingAccountId
+        }
+    }
+
+    if (parameters.toPaymentId) {
+        // get the to payment and check the parent types are compatible
+        GenericValue toPayment = from("Payment").where("paymentId", parameters.toPaymentId).queryOne()
+        if (toPayment) {
+            toPaymentType = from("PaymentType").where("paymentTypeId", toPayment.paymentTypeId).queryOne()

Review comment:
       Hi Priya,
   
   Yes, If a variable is never used we can remove it safely.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] priyasharma1 commented on a change in pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox
In reply to this post by GitBox

priyasharma1 commented on a change in pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#discussion_r455750319



##########
File path: applications/accounting/groovyScripts/payment/PaymentServices.groovy
##########
@@ -134,3 +136,77 @@ def updatePaymentContent() {
     }
 }
 
+def createPaymentApplication() {
+    // Create a Payment Application
+    if (!parameters.invoiceId && !parameters.billingAccountId && !parameters.taxAuthGeoId && !parameters.toPaymentId) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+    GenericValue paymentAppl = delegator.makeValue("PaymentApplication")
+    paymentAppl.setNonPKFields(parameters)
+
+    GenericValue payment = from("Payment").where("paymentId", parameters.paymentId).queryOne()
+    if (!payment) {
+        return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingPaymentApplicationParameterMissing)
+    }
+
+    BigDecimal notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment)
+
+    if (parameters.invoiceId) {
+        // get the invoice and do some further validation against it
+        GenericValue invoice = from("Invoice").where("invoiceId", parameters.invoiceId).queryOne()
+        // check the currencies if they are compatible
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId != payment.actualCurrencyUomId) {
+            return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingCurrenciesOfInvoiceAndPaymentNotCompatible)
+        }
+        if (invoice.currencyUomId != payment.currencyUomId && invoice.currencyUomId == payment.actualCurrencyUomId) {
+            // if required get the payment amount in foreign currency (local we already have)
+            Boolean actual = true
+            notAppliedPayment = PaymentWorker.getPaymentNotApplied(payment, actual)
+        }
+        // get the amount that has not been applied yet for the invoice (outstanding amount)
+        BigDecimal notAppliedInvoice = InvoiceWorker.getInvoiceNotApplied(invoice)
+        if (notAppliedInvoice <= notAppliedPayment) {
+            paymentAppl.amountApplied = notAppliedInvoice
+        } else {
+            paymentAppl.amountApplied = notAppliedPayment
+        }
+
+        if (invoice.billingAccountId) {
+            paymentAppl.billingAccountId = invoice.billingAccountId
+        }
+    }
+
+    if (parameters.toPaymentId) {
+        // get the to payment and check the parent types are compatible
+        GenericValue toPayment = from("Payment").where("paymentId", parameters.toPaymentId).queryOne()
+        if (toPayment) {
+            toPaymentType = from("PaymentType").where("paymentTypeId", toPayment.paymentTypeId).queryOne()

Review comment:
       Thanks, Pawan for the verification. I have removed both those lines.
   Though I have tested it please let me know if this causes any issue.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] sonarcloud[bot] commented on pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox
In reply to this post by GitBox

sonarcloud[bot] commented on pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#issuecomment-659381921


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/10.png' alt='6.5%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list) [6.5% Duplication](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [ofbiz-framework] sonarcloud[bot] removed a comment on pull request #158: [Improved] Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)

GitBox
In reply to this post by GitBox

sonarcloud[bot] removed a comment on pull request #158:
URL: https://github.com/apache/ofbiz-framework/pull/158#issuecomment-658150509


   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=158&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/10.png' alt='6.5%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list) [6.5% Duplication](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=158&metric=new_duplicated_lines_density&view=list)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]