private Map<String, Object> createHKPaymentResponseObject( Map<String, Object> hkrespObject, Element ele) { if (ele != null) { String transactionId = ele.getAttributeValue(GatewayResponseKeys.EbsConstants.TXN_TRANSACTION_ID.getKey()); String paymentId = ele.getAttributeValue(GatewayResponseKeys.EbsConstants.TXN_PAYMENT_ID.getKey()); String amount = ele.getAttributeValue(GatewayResponseKeys.EbsConstants.AMOUNT.getKey()); String status = ele.getAttributeValue(GatewayResponseKeys.EbsConstants.TXN_STATUS.getKey()); String isFlagged = ele.getAttributeValue(GatewayResponseKeys.EbsConstants.IS_FLAGGED.getKey()); String errorCode = ele.getAttributeValue(EbsPaymentGatewayWrapper.TXN_ERROR_CODE); String errorMessage = ele.getAttributeValue(EbsPaymentGatewayWrapper.TXN_ERROR_MSG); String gatewayOrderId = ele.getAttributeValue(EbsPaymentGatewayWrapper.TXN_REFERENCE_NO); if (paymentId != null) { hkrespObject.put(GatewayResponseKeys.HKConstants.Amount.getKey(), amount); hkrespObject.put(GatewayResponseKeys.HKConstants.GATEWAY_ORDER_ID.getKey(), gatewayOrderId); hkrespObject.put(GatewayResponseKeys.HKConstants.GATEWAY_REFERENCE_ID.getKey(), paymentId); hkrespObject.put(GatewayResponseKeys.HKConstants.ROOT_REFER_NO.getKey(), transactionId); hkrespObject.put( GatewayResponseKeys.HKConstants.AUTH_ID_CODE.getKey(), null); // no auth id code is returned from ebs hkrespObject.put(GatewayResponseKeys.HKConstants.RESPONSE_MSG.getKey(), status); if (isFlagged.equalsIgnoreCase( GatewayResponseKeys.EbsConstants.IS_FLAGGED_FALSE.getKey())) { hkrespObject.put( GatewayResponseKeys.HKConstants.RESPONSE_CODE.getKey(), GatewayResponseKeys.HKConstants.SUCCESS.getKey()); } else if (isFlagged.equalsIgnoreCase( GatewayResponseKeys.EbsConstants.IS_FLAGGED_TRUE.getKey())) { hkrespObject.put( GatewayResponseKeys.HKConstants.RESPONSE_CODE.getKey(), GatewayResponseKeys.HKConstants.AUTH_PEND.getKey()); } else { hkrespObject.put( GatewayResponseKeys.HKConstants.RESPONSE_CODE.getKey(), GatewayResponseKeys.HKConstants.FAILED.getKey()); } } else { hkrespObject.put( GatewayResponseKeys.HKConstants.RESPONSE_CODE.getKey(), GatewayResponseKeys.HKConstants.ERROR.getKey()); hkrespObject.put(GatewayResponseKeys.HKConstants.ERROR_LOG.getKey(), errorMessage); } } return hkrespObject; }
private void updateSalePaymentStatus( HkPaymentResponse hkPaymentResponse, String isFlagged, String ebsTransactionType) { if (GatewayResponseKeys.EbsConstants.Authorized.getKey().equalsIgnoreCase(ebsTransactionType)) { if (isFlagged != null && isFlagged.equalsIgnoreCase( GatewayResponseKeys.EbsConstants.IS_FLAGGED_FALSE.getKey())) { hkPaymentResponse.setHKPaymentStatus(EnumHKPaymentStatus.SUCCESS); } else if (isFlagged != null && isFlagged.equalsIgnoreCase( GatewayResponseKeys.EbsConstants.IS_FLAGGED_TRUE.getKey())) { hkPaymentResponse.setHKPaymentStatus(EnumHKPaymentStatus.AUTHENTICATION_PENDING); } else { hkPaymentResponse.setHKPaymentStatus(EnumHKPaymentStatus.FAILURE); } } else { hkPaymentResponse.setHKPaymentStatus(EnumHKPaymentStatus.FAILURE); hkPaymentResponse.setResponseMsg( GatewayResponseKeys.HKConstants.NO_TRANSACTION_FOUND.getKey()); } }