コード例 #1
0
  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;
  }
コード例 #2
0
  private HkPaymentResponse verifyAndCreateHkResponsePayment(
      Element element, String gatewayOrderId, String transactionType) {
    HkPaymentResponse hkPaymentResponse = null;
    if (element != null) {
      hkPaymentResponse =
          createPayment(
              gatewayOrderId,
              null,
              null,
              null,
              transactionType,
              null,
              null); // EnumPaymentTransactionType.SALE.getName()

      String paymentId =
          element.getAttributeValue(GatewayResponseKeys.EbsConstants.TXN_PAYMENT_ID.getKey());
      String transactionId =
          element.getAttributeValue(GatewayResponseKeys.EbsConstants.TXN_TRANSACTION_ID.getKey());
      String amount = element.getAttributeValue(GatewayResponseKeys.EbsConstants.AMOUNT.getKey());
      String status =
          element.getAttributeValue(GatewayResponseKeys.EbsConstants.TXN_STATUS.getKey());
      String isFlagged =
          element.getAttributeValue(GatewayResponseKeys.EbsConstants.IS_FLAGGED.getKey());
      String errorCode = element.getAttributeValue(EbsPaymentGatewayWrapper.TXN_ERROR_CODE);
      String errorMessage = element.getAttributeValue(EbsPaymentGatewayWrapper.TXN_ERROR_MSG);
      String ebsTransactionType =
          element.getAttributeValue(EbsPaymentGatewayWrapper.TXN_TRANSACTION_TYPE);
      // String gatewayOrderId =
      // element.getAttributeValue(EbsPaymentGatewayWrapper.TXN_REFERENCE_NO);

      if (paymentId != null) {

        hkPaymentResponse.setGatewayReferenceId(paymentId);
        hkPaymentResponse.setRrn(transactionId);
        hkPaymentResponse.setAmount(NumberUtils.toDouble(amount));
        hkPaymentResponse.setResponseMsg(status);
        updateResponseStatus(
            hkPaymentResponse, transactionType, isFlagged, status, ebsTransactionType);

      } else {
        hkPaymentResponse.setHKPaymentStatus(EnumHKPaymentStatus.FAILURE);
        hkPaymentResponse.setErrorLog(errorMessage);
      }
    }

    return hkPaymentResponse;
  }