[ofbiz-framework] branch trunk updated: Removed: Deprecated entity captureBillingAccountPayments since release 17.12. (#131)

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

[ofbiz-framework] branch trunk updated: Removed: Deprecated entity captureBillingAccountPayments since release 17.12. (#131)

surajk
This is an automated email from the ASF dual-hosted git repository.

surajk 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 44c374a  Removed: Deprecated entity captureBillingAccountPayments since release 17.12. (#131)
44c374a is described below

commit 44c374a644eab41de74c1c956758ef68b9509355
Author: Suraj Khurana <[hidden email]>
AuthorDate: Fri May 15 12:07:35 2020 +0530

    Removed: Deprecated entity captureBillingAccountPayments since release 17.12. (#131)
   
    (OFBIZ-11435)
    Also, added deprecated since tag in some old entities and fields. This is done as per current policy to deprecate entities/services.
    Thanks Pierre for reporting and Jacques for review.
---
 .../servicedef/services_paymentmethod.xml          | 12 ---
 .../accounting/payment/PaymentGatewayServices.java | 88 ----------------------
 .../datamodel/entitydef/party-entitymodel.xml      |  2 +-
 .../datamodel/entitydef/product-entitymodel.xml    |  1 +
 .../datamodel/entitydef/shipment-entitymodel.xml   |  2 +-
 5 files changed, 3 insertions(+), 102 deletions(-)

diff --git a/applications/accounting/servicedef/services_paymentmethod.xml b/applications/accounting/servicedef/services_paymentmethod.xml
index 66db35d..868c60d 100644
--- a/applications/accounting/servicedef/services_paymentmethod.xml
+++ b/applications/accounting/servicedef/services_paymentmethod.xml
@@ -351,18 +351,6 @@ under the License.
         <attribute name="captureAmount" type="BigDecimal" mode="IN" optional="false"/>
         <attribute name="processResult" type="String" mode="OUT" optional="false"/>
     </service>
-
-    <service name="captureBillingAccountPayment" engine="java"
-            location="org.apache.ofbiz.accounting.payment.PaymentGatewayServices" invoke="captureBillingAccountPayment" auth="true">
-        <description>Records a settlement or payment of an invoice by a billing account for the given captureAmount</description>
-        <deprecated use-instead="captureBillingAccountPayments" since="Releases 17.12"/>
-        <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
-        <attribute name="billingAccountId" type="String" mode="IN" optional="false"/>
-        <attribute name="captureAmount" type="BigDecimal" mode="IN" optional="false"/>
-        <attribute name="orderId" type="String" mode="IN" optional="true"/>
-        <attribute name="paymentId" type="String" mode="OUT" optional="false"/>
-        <attribute name="paymentGatewayResponseId" type="String" mode="OUT" optional="true"/>
-    </service>
     <service name="captureBillingAccountPayments" engine="java"
             location="org.apache.ofbiz.accounting.payment.PaymentGatewayServices" invoke="captureBillingAccountPayments" auth="true">
         <description>Applies (part of) the unapplied payment applications associated to the billing account to the given invoice.</description>
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
index 5a92b04..6b8183a 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
@@ -1525,94 +1525,6 @@ public class PaymentGatewayServices {
         }
         return ServiceUtil.returnSuccess();
     }
-
-    // Deprecated: use captureBillingAccountPayments instead of this.
-    public static Map<String, Object> captureBillingAccountPayment(DispatchContext dctx, Map<String, ? extends Object> context) {
-        Delegator delegator = dctx.getDelegator();
-        LocalDispatcher dispatcher = dctx.getDispatcher();
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        String invoiceId = (String) context.get("invoiceId");
-        String billingAccountId = (String) context.get("billingAccountId");
-        BigDecimal captureAmount = (BigDecimal) context.get("captureAmount");
-        String orderId = (String) context.get("orderId");
-        Locale locale = (Locale) context.get("locale");
-        Map<String, Object> results = ServiceUtil.returnSuccess();
-
-        try {
-            // Note that the partyIdFrom of the Payment should be the partyIdTo of the invoice, since you're receiving a payment from the party you billed
-            GenericValue invoice = EntityQuery.use(delegator).from("Invoice").where("invoiceId", invoiceId).queryOne();
-            Map<String, Object> paymentParams = UtilMisc.<String, Object>toMap("paymentTypeId", "CUSTOMER_PAYMENT", "paymentMethodTypeId", "EXT_BILLACT",
-                    "partyIdFrom", invoice.getString("partyId"), "partyIdTo", invoice.getString("partyIdFrom"),
-                    "statusId", "PMNT_RECEIVED", "effectiveDate", UtilDateTime.nowTimestamp());
-            paymentParams.put("amount", captureAmount);
-            paymentParams.put("currencyUomId", invoice.getString("currencyUomId"));
-            paymentParams.put("userLogin", userLogin);
-            Map<String, Object> tmpResult = dispatcher.runSync("createPayment", paymentParams);
-            if (ServiceUtil.isError(tmpResult)) {
-                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
-            }
-
-            String paymentId = (String) tmpResult.get("paymentId");
-            tmpResult = dispatcher.runSync("createPaymentApplication", UtilMisc.<String, Object>toMap("paymentId", paymentId, "invoiceId", invoiceId, "billingAccountId", billingAccountId,
-                    "amountApplied", captureAmount, "userLogin", userLogin));
-            if (ServiceUtil.isError(tmpResult)) {
-                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
-            }
-            if (paymentId == null) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
-                        "AccountingNoPaymentCreatedForInvoice",
-                        UtilMisc.toMap("invoiceId", invoiceId, "billingAccountId", billingAccountId), locale));
-            }
-            results.put("paymentId", paymentId);
-
-            if (orderId != null && captureAmount.compareTo(BigDecimal.ZERO) > 0) {
-                // Create a paymentGatewayResponse, if necessary
-                GenericValue order = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
-                if (order == null) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
-                            "AccountingNoPaymentGatewayResponseCreatedForInvoice",
-                            UtilMisc.toMap("invoiceId", invoiceId, "billingAccountId", billingAccountId,
-                                    "orderId", orderId), locale));
-                }
-                // See if there's an orderPaymentPreference - there should be only one OPP for EXT_BILLACT per order
-                GenericValue orderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "paymentMethodTypeId", "EXT_BILLACT").queryFirst();
-                if (orderPaymentPreference != null) {
-
-                    // Check the productStore setting to see if we need to do this explicitly
-                    GenericValue productStore = order.getRelatedOne("ProductStore", false);
-                    if (productStore.getString("manualAuthIsCapture") == null || (! "Y".equalsIgnoreCase(productStore.getString("manualAuthIsCapture")))) {
-                        String responseId = delegator.getNextSeqId("PaymentGatewayResponse");
-                        GenericValue pgResponse = delegator.makeValue("PaymentGatewayResponse");
-                        pgResponse.set("paymentGatewayResponseId", responseId);
-                        pgResponse.set("paymentServiceTypeEnumId", CAPTURE_SERVICE_TYPE);
-                        pgResponse.set("orderPaymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId"));
-                        pgResponse.set("paymentMethodTypeId", "EXT_BILLACT");
-                        pgResponse.set("transCodeEnumId", "PGT_CAPTURE");
-                        pgResponse.set("amount", captureAmount);
-                        pgResponse.set("currencyUomId", invoice.getString("currencyUomId"));
-                        pgResponse.set("transactionDate", UtilDateTime.nowTimestamp());
-                        // referenceNum holds the relation to the order.
-                        // todo: Extend PaymentGatewayResponse with a billingAccountId field?
-                        pgResponse.set("referenceNum", billingAccountId);
-
-                        // save the response
-                        savePgr(dctx, pgResponse);
-
-                        // Update the orderPaymentPreference
-                        orderPaymentPreference.set("statusId", "PAYMENT_SETTLED");
-                        orderPaymentPreference.store();
-
-                        results.put("paymentGatewayResponseId", responseId);
-                    }
-                }
-            }
-        } catch (GenericEntityException | GenericServiceException ex) {
-            return ServiceUtil.returnError(ex.getMessage());
-        }
-
-        return results;
-    }
-
     public static Map<String, Object> captureBillingAccountPayments(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
         String invoiceId = (String) context.get("invoiceId");
diff --git a/applications/datamodel/entitydef/party-entitymodel.xml b/applications/datamodel/entitydef/party-entitymodel.xml
index 0736afb..66e4dd0 100644
--- a/applications/datamodel/entitydef/party-entitymodel.xml
+++ b/applications/datamodel/entitydef/party-entitymodel.xml
@@ -2796,7 +2796,7 @@ under the License.
       <field name="height" type="floating-point"></field>
       <field name="weight" type="floating-point"></field>
       <field name="mothersMaidenName" type="long-varchar" encrypt="true"></field>
-      <field name="oldMaritalStatus" type="indicator" col-name="MARITAL_STATUS"><description>Deprecated since branch release: use martialStatusEnumId</description></field>
+      <field name="oldMaritalStatus" type="indicator" col-name="MARITAL_STATUS"><description>Deprecated since branch release: Upcoming branch, use martialStatusEnumId</description></field>
       <field name="maritalStatusEnumId" type="id"/>
       <field name="socialSecurityNumber" type="long-varchar" encrypt="true"></field>
       <field name="passportNumber" type="long-varchar" encrypt="true"></field>
diff --git a/applications/datamodel/entitydef/product-entitymodel.xml b/applications/datamodel/entitydef/product-entitymodel.xml
index f1a1ef3..1c17423 100644
--- a/applications/datamodel/entitydef/product-entitymodel.xml
+++ b/applications/datamodel/entitydef/product-entitymodel.xml
@@ -3643,6 +3643,7 @@ under the License.
     <entity entity-name="OldProductPromoCodeEmail" table-name="PRODUCT_PROMO_CODE_EMAIL"
             package-name="org.apache.ofbiz.product.promo"
             title="Product Promotion Email">
+      <description>Deprecated since branch release: Upcoming branch. Use ProdPromoCodeContactMech instead</description>
       <field name="productPromoCodeId" type="id"></field>
       <field name="emailAddress" type="email"></field>
       <prim-key field="productPromoCodeId"/>
diff --git a/applications/datamodel/entitydef/shipment-entitymodel.xml b/applications/datamodel/entitydef/shipment-entitymodel.xml
index 354cd6a..7c417dd 100644
--- a/applications/datamodel/entitydef/shipment-entitymodel.xml
+++ b/applications/datamodel/entitydef/shipment-entitymodel.xml
@@ -325,7 +325,7 @@ under the License.
     <entity entity-name="OldPicklistStatusHistory" table-name="PICKLIST_STATUS_HISTORY"
             package-name="org.apache.ofbiz.shipment.picklist"
             title="Picklist Status History">
-      <description>Deprecated since branch release: PicklistStatus instead</description>
+      <description>Deprecated since branch release: Upcoming branch. Use PicklistStatus instead</description>
       <field name="picklistId" type="id"></field>
       <field name="changeDate" type="date-time"></field>
       <field name="changeUserLoginId" type="id-vlong"></field>