You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by pa...@apache.org on 2020/08/22 13:27:41 UTC
[ofbiz-plugins] branch trunk updated: Fixed: issue with return
service. Alsoo,
done improvements to auth service to handle more errors.(OFBIZ-11837) (#39)
This is an automated email from the ASF dual-hosted git repository.
pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git
The following commit(s) were added to refs/heads/trunk by this push:
new 964a079 Fixed: issue with return service. Alsoo, done improvements to auth service to handle more errors.(OFBIZ-11837) (#39)
964a079 is described below
commit 964a0790a9cb047d35c1ca2e40a4e7c48feeba9d
Author: pritambkute <66...@users.noreply.github.com>
AuthorDate: Sat Aug 22 18:57:32 2020 +0530
Fixed: issue with return service. Alsoo, done improvements to auth service to handle more errors.(OFBIZ-11837) (#39)
---
.../FirstDataPaymentServices.java | 31 ++++++++++++----------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/firstdatapaymentgateway/src/main/java/org/apache/ofbiz/firstdatapaymentgateway/FirstDataPaymentServices.java b/firstdatapaymentgateway/src/main/java/org/apache/ofbiz/firstdatapaymentgateway/FirstDataPaymentServices.java
index 8325e26..3e2467f 100644
--- a/firstdatapaymentgateway/src/main/java/org/apache/ofbiz/firstdatapaymentgateway/FirstDataPaymentServices.java
+++ b/firstdatapaymentgateway/src/main/java/org/apache/ofbiz/firstdatapaymentgateway/FirstDataPaymentServices.java
@@ -73,6 +73,7 @@ public class FirstDataPaymentServices {
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("processAmount", processAmount);
Boolean isSuccess = Boolean.FALSE;
+ String gatewayMessage = "";
String cardNumber = creditCard.getString("cardNumber");
try {
@@ -122,23 +123,26 @@ public class FirstDataPaymentServices {
String transactionStatus = (String) convertedMap.get("transactionStatus");
String transactionId = (String) convertedMap.get("ipgTransactionId");
String fdOrderId = (String) convertedMap.get("orderId");
- Map<String, Object> processor = objectMapper.convertValue(convertedMap.get("processor"), new TypeReference<Map<String, Object>>() {
- });
- String gatewayMessage = (String) processor.get("responseMessage");
- int statusCode = response.getStatusLine().getStatusCode();
- result.put("authCode", String.valueOf(statusCode));
- result.put("authMessage", gatewayMessage);
- if (UtilValidate.isNotEmpty(transactionId)) {
- result.put("authRefNum", transactionId);
- result.put("authAltRefNum", fdOrderId);
- if ("approved".equalsIgnoreCase(transactionStatus)) {
- isSuccess = Boolean.TRUE;
+ result.put("authRefNum", transactionId);
+ result.put("authAltRefNum", fdOrderId);
+ if ("APPROVED".equalsIgnoreCase(transactionStatus) || "WAITING".equalsIgnoreCase(transactionStatus)) {
+ Map<String, Object> processor = objectMapper.convertValue(convertedMap.get("processor"), new TypeReference<Map<String, Object>>() {
+ });
+ gatewayMessage = (String) processor.get("responseMessage");
+ int statusCode = response.getStatusLine().getStatusCode();
+ result.put("authCode", String.valueOf(statusCode));
+ result.put("authMessage", gatewayMessage);
+ if (UtilValidate.isNotEmpty(transactionId)) {
+ if ("APPROVED".equalsIgnoreCase(transactionStatus) || "WAITING".equalsIgnoreCase(transactionStatus)) {
+ isSuccess = Boolean.TRUE;
+ }
}
}
if (!isSuccess) {
String errorMessage = "Transaction Type:" + (String) convertedMap.get("transactionType") + " Transaction Id: " + transactionId + " "
+ "Transaction Status: " + transactionStatus;
- errorMessage = errorMessage + " Message: " + statusCode + "-" + gatewayMessage;
+ gatewayMessage = UtilValidate.isNotEmpty(gatewayMessage) ? gatewayMessage : "";
+ errorMessage = errorMessage + " Gateway Message: " + gatewayMessage;
result.put(ModelService.ERROR_MESSAGE, errorMessage);
}
} catch (ParseException | TemplateException | IOException e) {
@@ -264,8 +268,7 @@ public class FirstDataPaymentServices {
GenericValue paymentGatewayResponse = EntityQuery.use(delegator)
.from("PaymentGatewayResponse")
- .where("orderPaymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId"), "paymentMethodId",
- orderPaymentPreference.getString("paymentMethodId"), "transCodeEnumId", "PGT_CAPTURE",
+ .where("paymentMethodId", orderPaymentPreference.getString("paymentMethodId"), "transCodeEnumId", "PGT_CAPTURE",
"paymentServiceTypeEnumId", "PRDS_PAY_CAPTURE")
.queryFirst();
String captureTransactionId = null;