public string ReversePayment(MetaDataViewDto metaData, PaymentViewDto payment) { ReverseRequestFactory reverseRequestFactory = new ReverseRequestFactory(); RestClientTool <ReverseRequest, ReverseResponse> restClient = new RestClientTool <ReverseRequest, ReverseResponse>(); ReverseRequest reverseRequest = reverseRequestFactory .AddOriginalPaymentReferenceNumber(payment.PaymentReferenceNumber).AddMsisdn(metaData.Msisdn) .AddClientIPAddress(metaData.ClientIPAddress).Build(); ReverseResponse reverseResponse = restClient.RestClientRequest(Constants.REVERSE_URL, reverseRequest); if (reverseResponse.ResponseHeader.ResponseCode != null && reverseResponse.ResponseHeader.ResponseCode == "0") { return(reverseResponse.ApprovalCode); } else if (reverseResponse.ResponseHeader != null) { string errorMessage = "Reverse payment was not successful: [%s], %s" + reverseResponse.ResponseHeader.ResponseCode + reverseResponse.ResponseHeader.ResponseDescription; throw new Exception(errorMessage); } else { string errorMessage = "Reverse payment was not successful, response status info is empty."; throw new Exception(errorMessage); } }
public void Test() { reverseRequest request = new ReverseRequestFactory().Build(); request.msisdn = "5465553333"; request.originalReferenceNumber = new ProvisionTest().ProvisionTestMethod(); request.requestHeader.clientIPAddress = "4.4.4.4"; request.merchantCode = Constants.MERCHANT_CODE; reverseResponse response = new ReverseClientService().SoapClient(request); Assert.IsNotNull(response); }
protected reverseResponse Reverse_Method(string msisdn, string originalReferenceNumber) { reverseRequest request = new ReverseRequestFactory().Build(); request.msisdn = msisdn; request.originalReferenceNumber = originalReferenceNumber; request.requestHeader.clientIPAddress = "4.4.4.4"; request.merchantCode = Constants.MERCHANT_CODE; try { reverseResponse response = new ReverseClientService().OptionalRequest(MySession.Current.requestFilter, request); return(response); } catch (Exception ex) { ShowMessage(ex.Message); return(null); } }