@Override
  public HkPaymentResponse refundPayment(Payment basePayment, Double amount)
      throws HealthkartPaymentGatewayException {
    String baseGatewayOrderId = basePayment.getGatewayOrderId();
    String gatewayReferenceId = basePayment.getGatewayReferenceId();
    HkPaymentResponse hkRefundPaymentResponse = null;

    if (baseGatewayOrderId != null && gatewayReferenceId != null) {
      try {
        Element element =
            callPaymentGateway(
                null,
                gatewayReferenceId,
                null,
                amount.toString(),
                EbsPaymentGatewayWrapper.TXN_ACTION_REFUND);

        hkRefundPaymentResponse =
            verifyAndCreateHkResponsePayment(
                element, baseGatewayOrderId, EnumPaymentTransactionType.REFUND.getName());
      } catch (Exception e) {
        logger.debug("Ebs Payment gateway exception :", e);
      }

    } else {
      throw new HealthkartPaymentGatewayException(
          HealthkartPaymentGatewayException.Error.PAYMENT_NOT_UPDATED);
    }

    return hkRefundPaymentResponse;
  }
  @Override
  public List<HkPaymentResponse> seekPaymentFromGateway(Payment basePayment)
      throws HealthkartPaymentGatewayException {
    String gatewayOrderId = basePayment.getGatewayOrderId();
    List<HkPaymentResponse> gatewayPaymentList = new ArrayList<HkPaymentResponse>();

    try {

      // call payment gateway and get the base payment object
      Element element =
          callPaymentGateway(
              gatewayOrderId, null, null, null, EbsPaymentGatewayWrapper.TXN_ACTION_STATUS);
      HkPaymentResponse baseGatewayPayment =
          verifyAndCreateHkResponsePayment(
              element, gatewayOrderId, EnumPaymentTransactionType.SALE.getName());
      List<Payment> paymentList =
          paymentDao.searchPayments(null, null, null, null, null, null, null, basePayment, null);

      gatewayPaymentList.add(baseGatewayPayment);

      // again call gateway and update all child payment list
      if (paymentList != null) {
        for (Payment payment : paymentList) {
          String gatewayReferenceId = payment.getGatewayReferenceId();
          String rrn = payment.getRrn();
          if (gatewayReferenceId != null && rrn != null) {
            Element ele =
                callPaymentGateway(
                    gatewayOrderId,
                    payment.getGatewayReferenceId(),
                    payment.getRrn(),
                    null,
                    EbsPaymentGatewayWrapper.TXN_ACTION_STATUS_PAYMENT_ID);
            HkPaymentResponse childPayment =
                verifyAndCreateHkResponsePayment(
                    ele, payment.getGatewayOrderId(), EnumPaymentTransactionType.REFUND.getName());
            gatewayPaymentList.add(childPayment);
          } else {
            HkPaymentResponse hkPaymentResponse =
                createPayment(
                    payment.getGatewayOrderId(),
                    null,
                    null,
                    payment.getErrorLog(),
                    EnumPaymentTransactionType.REFUND.getName(),
                    payment.getAmount().toString(),
                    null);
            hkPaymentResponse.setHKPaymentStatus(EnumHKPaymentStatus.FAILURE);
            gatewayPaymentList.add(hkPaymentResponse);
          }
        }
      }

    } catch (Exception e) {
      logger.debug("Ebs Payment gateway exception :", e);
      // throw new
      // HealthkartPaymentGatewayException(HealthkartPaymentGatewayException.Error.UNKNOWN);
    }

    return gatewayPaymentList;
  }