Exemple #1
0
        public string RefundPayment(MetaDataViewDto metaData, PaymentViewDto payment, String refundAmount)
        {
            RefundRequestFactory refundRequestFactory = new RefundRequestFactory();
            RefundRequest        refundRequest        = refundRequestFactory
                                                        .AddOriginalReferenceNumber(payment.PaymentReferenceNumber).AddAmount(refundAmount)
                                                        .AddClientIPAddress(metaData.ClientIPAddress).AddMsisdn(metaData.Msisdn).Build();

            RestClientTool <RefundRequest, RefundResponse> restClient = new RestClientTool <RefundRequest, RefundResponse>();
            RefundResponse refundResponse = restClient.RestClientRequest(Constants.REFUND_URL, refundRequest);

            ResponseHeader responseHeader = refundResponse.ResponseHeader;

            if (responseHeader.ResponseCode != null && responseHeader.ResponseCode == "0")
            {
                return(refundResponse.ApprovalCode);
            }
            else if (responseHeader.ResponseCode != null)
            {
                string errorMessage = "Refund payment was not successful: " + refundResponse.ResponseHeader.ResponseCode +
                                      " " + refundResponse.ResponseHeader.ResponseDescription;
                throw new Exception(errorMessage);
            }
            else
            {
                string errorMessage = "Refund payment was not successful, response status info is empty.";
                throw new Exception(errorMessage);
            }
        }
Exemple #2
0
        public void Test()
        {
            refundRequest request = new RefundRequestFactory().Build();

            request.msisdn = "5465553333";
            request.amount = "2351";
            request.originalReferenceNumber       = new ProvisionTest().ProvisionTestMethod();
            request.requestHeader.clientIPAddress = "4.4.4.4";
            request.merchantCode = Constants.MERCHANT_CODE;
            refundResponse response = new RefundClientService().SoapClient(request);

            Assert.IsNotNull(response);
        }
Exemple #3
0
        protected refundResponse Refund_Method(string msisdn, string originalReferenceNumber, string amount)
        {
            RefundRequestFactory factory = new RefundRequestFactory();
            refundRequest        request = null;

            factory.request.msisdn = msisdn;
            factory.request.originalReferenceNumber = originalReferenceNumber;
            factory.request.amount = amount;
            factory.request.requestHeader.clientIPAddress = "4.4.4.4";
            factory.request.merchantCode = Constants.MERCHANT_CODE;

            try
            {
                request = factory.Build();
                refundResponse response = new RefundClientService().OptionalRequest(MySession.Current.requestFilter, request);
                return(response);
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
                return(null);
            }
        }