public QueryStatuViewDto QueryPayment(MetaDataViewDto metaData, PaymentViewDto paymentViewDto) { RestClientTool <QueryStatuRequest, QueryStatuResponse> restClient = new RestClientTool <QueryStatuRequest, QueryStatuResponse>(); QueryStatuRequest request = new QueryStatuRequestFactory() .AddOriginalPaymentReferenceNumber(paymentViewDto.PaymentReferenceNumber) .AddClientIPAddress(metaData.ClientIPAddress).Build(); QueryStatuResponse response = restClient.RestClientRequest(Constants.QUERY_STATU_URL, request); if (response.ResponseHeader.ResponseCode != null && response.ResponseHeader.ResponseCode == "0") { return(CreateQueryStatuViewDto(response)); } else if (response.ResponseHeader != null) { String errorMessage = "Query Status of Payment was not successful: " + response.ResponseHeader.ResponseCode + response.ResponseHeader.ResponseDescription; throw new Exception(errorMessage); } else { String errorMessage = "Query Status of Payment was not successful, response status info is empty."; throw new Exception(errorMessage); } }
public QueryStatuViewDto CreateQueryStatuViewDto(QueryStatuResponse queryStatuResponse) { QueryStatuViewDto queryStatuViewDto = new QueryStatuViewDto() { ExtraParameters = (queryStatuResponse.ExtraParameters), Amount = (queryStatuResponse.Amount), Currency = (queryStatuResponse.Currency), InstallmentCount = (queryStatuResponse.InstallmentCount), AcquirerbankCode = (queryStatuResponse.AcquirerbankCode), IssuerBankCode = (queryStatuResponse.IssuerBankCode), ApprovalCode = (queryStatuResponse.ApprovalCode), Msisdn = (queryStatuResponse.Msisdn), OrderId = (queryStatuResponse.OrderId), PaymentReferenceNumber = (queryStatuResponse.PaymentReferenceNumber), PaymentDate = (queryStatuResponse.PaymentDate), PaymentSecurity = (queryStatuResponse.PaymentSecurity), ReconcilationDate = (queryStatuResponse.ReconcilationDate), Status = (queryStatuResponse.Status), StatusExplanation = (queryStatuResponse.StatusExplanation), PaymentMethodId = (queryStatuResponse.PaymentMethod.PaymentMethodId), PaymentMethodNumber = (queryStatuResponse.PaymentMethod.PaymentMethodNumber), PaymentMethodType = (queryStatuResponse.PaymentMethod.PaymentMethodType) }; return(queryStatuViewDto); }