/// <summary> /// /// </summary> /// <param name="transactionReference">The unique reference/ flwRef, unique to the particular transaction being carried out. It is generated for every transaction. This can be retrieved from the card charge response</param> /// <param name="otp">A one time Pin sent to the customer’s phone and inputed by the customer for authentication.</param> /// <returns>Details of the outcome of the card charge</returns> public async Task <CardValidationResponse> ValidateCardAsync(string transactionReference, int otp) { var body = new { PBFPubKey = PrivateKey, transaction_reference = transactionReference, otp }; var response = await _client.SendRequest(Request.RequestMethod.Post, "/flwv3-pug/getpaidx/api/validatecharge", body.ToJson()); return(CardValidationResponse.FromJson(response)); }
public string GetValidateCustRefDetailsApi(Request vmRequest) { ListenerResponse resp = new ListenerResponse(); ValidateCustomerRefResponse apiresponse = new ValidateCustomerRefResponse(); string xmlResponse = ""; resp = GetVendorCredentials(vmRequest.Username, vmRequest.Password); if (resp.StatusCode.Equals("0") && resp.StatusDescription.Equals("ValidVendor")) { if (IsValidDigitalSignature(vmRequest)) { mapiRequest.ReferenceId = vmRequest.MerchantCode; mapiRequest.MerchantId = vmRequest.MerchantCode; mapiRequest.RequestAgent = "1"; mapiRequest.ApiUsername = apiUsername; mapiRequest.ApiPassword = apiPassword; mapiRequest.Channel = vmRequest.Channel; Response apiResp2 = mapi.GetMerchantDetails(mapiRequest); bool NotReferenced = false; bool IsReferenced = bool.TryParse(apiResp2.Customer.CustomerType, out NotReferenced); if (IsReferenced) { if (apiResp2.Status.Equals("0")) { if (vmRequest.MerchantCode.Equals("108633")) { TotalLogic total = new TotalLogic(); CardValidationResponse rr = new CardValidationResponse(); rr = total.CallWebService(vmRequest.CustomerRef); apiresponse.CustomerName = rr.HolderName; apiresponse.MerchantName = apiResp2.Customer.FullName; apiresponse.StatusCode = rr.StatusCode; apiresponse.StatusDescription = rr.StatusDescription; apiresponse.MerchantCode = vmRequest.MerchantCode; apiresponse.OutstandingBalance = "0"; apiresponse.MinimumBalance = "0"; xmlResponse = GetValidateCustRefXmlResponse(apiresponse); } else { mapiRequest.ReferenceId = vmRequest.CustomerRef; apiResp2 = mapi.GetMerchantCustomer(mapiRequest); apiresponse.MerchantName = apiResp2.Customer.FullName; apiresponse.CustomerName = apiResp2.Customer.FullName; apiresponse.MerchantCode = vmRequest.MerchantCode; apiresponse.OutstandingBalance = apiResp2.Customer.RunningBalance; apiresponse.StatusCode = apiResp2.Status; apiresponse.StatusDescription = apiResp2.StatusDescription; xmlResponse = GetValidateCustRefXmlResponse(apiresponse); } } else { apiresponse.StatusCode = "29"; apiresponse.StatusDescription = "Invalid Merchant Code"; xmlResponse = GetValidateCustRefXmlResponse(apiresponse); } } else { apiresponse.StatusCode = "29"; apiresponse.StatusDescription = "Merchant Customer Not Referenced"; xmlResponse = GetValidateCustRefXmlResponse(apiresponse); } } else { apiresponse.StatusCode = "30"; apiresponse.StatusDescription = "Invalid Digital Signature"; xmlResponse = GetValidateCustRefXmlResponse(apiresponse); } } else { apiresponse.StatusCode = "100"; apiresponse.StatusDescription = "Invalid Vendor Credentials"; xmlResponse = GetValidateCustRefXmlResponse(apiresponse); } return(xmlResponse); }