public void PrepaidPayment() { var binding = new WSHttpBinding(SecurityMode.None, true); var request = XElement.Parse(GetContentFromFile("PrepaidPayment.xml")); var sign = new EfawateerSigner("ARKAIM-TEST"); var time = DateTime.Now.ToString("s"); var guid = Guid.NewGuid().ToString(); request.Element("MsgHeader").Element("TmStp").Value = time; request.Element("MsgHeader").Element("GUID").Value = guid; request.Element("MsgBody").Element("TrxInf").Element("ProcessDate").Value = time; request.Element("MsgBody").Element("TrxInf").Element("BankTrxID").Value = guid; request.Element("MsgFooter").Element("Security").Element("Signature").Value = sign.SignData(request.Element("MsgBody").ToString()); var client = new PrepaidPaymentClient(binding, new EndpointAddress(UriContext.PrepaidPayment)); var upload = client.Pay(guid, GetToken(), request); Debug.WriteLine("PrepaidPayment " + upload); }
public PaymentResult PrepaidPaymentRequest(int cyberplatOperatorId, StringList parametersList, string session) { var result = new PaymentResult { Error = 0 }; var billerCode = ExpandBillerCodeFromCyberplatOpertaroId(cyberplatOperatorId); var token = Authenticate(); var request = GetRequestContent(Prepadpmtrq); var signer = new EfawateerSigner(_certificate); var now = DateTime.Now; var time = now.ToString("s"); var guid = GenerateGuid(); request.Element("MsgHeader").Element("TmStp").Value = time; request.Element("MsgHeader").Element("TrsInf").Element("SdrCode").Value = _customerCode; request.Element("MsgHeader").Element("GUID").Value = guid; var trxInf = request.Element("MsgBody").Element("TrxInf"); var accInfo = trxInf.Element("AcctInfo"); if (!parametersList.ContainsKey("BillingNo") || parametersList["BillingNo"].Contains("#")) { accInfo.Element("BillingNo").Remove(); } else { accInfo.Element("BillingNo").Value = parametersList["BillingNo"]; } accInfo.Element("BillerCode").Value = billerCode.ToString(); trxInf.Element("ServiceTypeDetails").Element("ServiceType").Value = parametersList.Get("ServiceType"); trxInf.Element("DueAmt").Value = parametersList.Get("DueAmt"); trxInf.Element("PaidAmt").Value = parametersList.Get("DueAmt"); trxInf.Element("ValidationCode").Value = parametersList.Get("ValidationCode"); trxInf.Element("ProcessDate").Value = time; trxInf.Element("BankTrxID").Value = session; Audit("PrepaidPaymentRequest request:" + request); request.Element("MsgFooter").Element("Security").Element("Signature").Value = signer.SignData(request.Element("MsgBody").ToString()); var service = new PrepaidPaymentClient(new WSHttpBinding(SecurityMode.None, true) { ReceiveTimeout = new TimeSpan(0, 0, 0, 0, _timeout) }, new EndpointAddress(_prepaidUrl)); var response = service.Pay(guid, token, request); Audit("PrepaidPaymentRequest response:" + response); trxInf = response.Element("MsgBody").Element("TrxInf"); result.JoebppsTrx = trxInf.Element("JOEBPPSTrx").Value; result.StmtDate = DateTime.Parse(trxInf.Element("STMTDate").Value); result.Error = Convert.ToInt32(trxInf.Element("Result").Element("ErrorCode").Value); result.Params = parametersList; return(result); }