public Guid Save(PaymentRequest entity) { PaymentRequest existingEntity = _ctx.AsynchronousPaymentRequest.FirstOrDefault (n => n.Id == entity.Id); if (existingEntity == null) { existingEntity = new PaymentRequest(); existingEntity.ClientRequestResponseType = ClientRequestResponseType.AsynchronousPaymentNotification; existingEntity.DateCreated = DateTime.Now; existingEntity.Id = entity.Id; _ctx.AsynchronousPaymentRequest.Add(existingEntity); } existingEntity.DistributorCostCenterId = entity.DistributorCostCenterId; existingEntity.TransactionRefId = entity.TransactionRefId; existingEntity.Currency = entity.Currency; existingEntity.AccountId = entity.AccountId; existingEntity.AllowOverPayment = entity.AllowOverPayment; existingEntity.AllowPartialPayments = entity.AllowPartialPayments; existingEntity.Amount = entity.Amount; existingEntity.ApplicationId = entity.ApplicationId; _ctx.AsynchronousPaymentRequest.Add(existingEntity); _ctx.SaveChanges(); return existingEntity.Id; }
public ByteString GetPaymentRequest(string finalAccount, ulong amount) { PaymentDetails paymentDetails = new PaymentDetails(); paymentDetails.Network = isMainNet ? "main" : "test"; paymentDetails.Time = GetTimestamp(DateTime.UtcNow); paymentDetails.Expires = GetTimestamp(DateTime.UtcNow.AddHours(1)); paymentDetails.Memo = $"Funding Openchain account {finalAccount}"; Output paymentOutput = new Output(); paymentOutput.Amount = amount; paymentOutput.Script = Google.Protobuf.ByteString.CopyFrom(NBitcoin.Script.CreateFromDestinationAddress(destinationAddress).ToBytes()); Output dataOutput = new Output(); dataOutput.Amount = dustValue; dataOutput.Script = Google.Protobuf.ByteString.CopyFrom( new[] { (byte)OpcodeType.OP_RETURN }.Concat(Op.GetPushOp(Encoding.UTF8.GetBytes("OG" + finalAccount)).ToBytes()).ToArray()); paymentDetails.Outputs.Add(paymentOutput); paymentDetails.Outputs.Add(dataOutput); PaymentRequest request = new PaymentRequest(); request.SerializedPaymentDetails = paymentDetails.ToByteString(); request.PkiType = "none"; return new ByteString(request.ToByteArray()); }
/// <summary> /// Initializes a new instance of the <see cref="PaymentProcessor"/> class. /// </summary> /// <param name="merchelloContext"> /// The merchello context. /// </param> /// <param name="request"> /// The request. /// </param> public PaymentProcessor(IMerchelloContext merchelloContext, PaymentRequest request) { Mandate.ParameterNotNull(merchelloContext, "merchelloContext"); _merchelloContext = merchelloContext; Build(request); }
public void GetPaymentUrl_ThrowsWhenPriceInCentsIsEqualOrLessThanZero(int priceInCents) { var request = new PaymentRequest { CallbackUri = new Uri("https://domain.extension/callback"), DisplayName = "TestShop", Currency = Currencies.GBP, PriceInCents = priceInCents, Description = @"Some description here", OrderId = "order_123" }; Assert.Throws<ArgumentOutOfRangeException>(() => _sut.GetPaymentUrl(request)); }
public void GetPaymentUrl_GeneratesUrl() { var request = new PaymentRequest { CallbackUri = _callBackUri, DisplayName = DisplayName, Currency = Currencies.GBP, PriceInCents = 1050, Description = @"Some description here", OrderId = OrderId }; var actual = _sut.GetPaymentUrl(request); Assert.IsNotNull(actual); }
public PaymentResponse TakePayment(PaymentRequest paymentRequest) { WebClient webClient = new WebClient(); byte[] responseBytes = null; try { responseBytes = webClient.UploadValues(_purchaseUrl, "POST", BuildPostData(paymentRequest)); } catch (WebException ex) { // Check for the most common error... unable to reach the purchase URL. return new PaymentResponse(false) { Message = string.Format("An error has occurred whilst trying to register this transaction. The status is {0}, and the description is '{1}'.", ex.Status, ex.Message) }; } // No transport level errors, so the message got to Sage Pay. // Analyse the response from Direct to check that everything is okay. // Registration results come back in the Status and StatusDetail fields. string response = Encoding.ASCII.GetString(responseBytes); NameValueCollection responseData = null; try { responseData = ParseResponseData(response); } catch (Exception ex) { return new PaymentResponse(false) { Message = string.Format("An error has occurred whilst trying to read the payment gateway's response. The description is '{0}'.", ex.Message) }; } string status = responseData["Status"]; string statusDetail = responseData["StatusDetail"]; switch (status) { case "3DAUTH" : throw new NotImplementedException(); default : // If this isn't 3D-Auth, then this is an authorisation result (either successful or otherwise). return ProcessAuthorisationResponse(status, statusDetail, responseData); } }
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { var uniqueId = orderInfo.OrderNumber + "x" + DateTime.Now.ToString("hhmmss"); uniqueId = (uniqueId.Length > 12) ? uniqueId.Substring(0, 12) : uniqueId.PadRight(12, '0'); var request = new PaymentRequest(); PaymentProviderHelper.SetTransactionId(orderInfo, uniqueId); HttpContext.Current.Session.Add("TransactionId", uniqueId); orderInfo.PaymentInfo.Url = request.PaymentUrl; orderInfo.PaymentInfo.Parameters = request.ParametersAsString; orderInfo.Save(); return request; }
static void Main() { using (var proxy = new RecurringClient()) // do not use RecurringPortTypeClient { try { var thisUserDetail = new RecurringDetailsRequest(); thisUserDetail.shopperReference = "[Shopper Reference]"; thisUserDetail.recurring = new Adyen.RecurringSample.Adyen.Recurring.Recurring() { contract = "RECURRING" }; var recContractDetails = proxy.ListRecurringDetails(thisUserDetail); Trace.TraceInformation("Shoppermail {0}", recContractDetails.lastKnownShopperEmail); Trace.TraceInformation("Creation date {0}", recContractDetails.creationDate.Value.ToShortDateString()); } catch (Exception ex) { Trace.TraceError("error using RecurringClient.listRecurringDetails {0}", ex.Message); throw ex; } } ///etc... using (var proxy = new PaymentClient()) { try { var paymentRequest = new PaymentRequest(); proxy.Authorise(paymentRequest); } catch (Exception ex) { } } }
internal static void Write(XmlWriter writer, PaymentRequest payment) { if (writer == null) throw new ArgumentNullException("writer"); if (payment == null) throw new ArgumentNullException("payment"); writer.WriteStartElement(PaymentRequestSerializer.Checkout); writer.WriteElementString(PaymentRequestSerializer.Currency, payment.Currency); if (payment.Sender != null) { SenderSerializer.Write(writer, payment.Sender); } if (payment.RedirectUri != null) { writer.WriteElementString(PaymentRequestSerializer.RedirectUrl, payment.RedirectUri.ToString()); } if (payment.Items.Count > 0) { ItemListSerializer.Write(writer, payment.Items); } SerializationHelper.WriteElementStringNotNull(writer, PaymentRequestSerializer.ExtraAmount, payment.ExtraAmount, 2); SerializationHelper.WriteElementStringNotNull(writer, PaymentRequestSerializer.Reference, payment.Reference); if (payment.Shipping != null) { ShippingSerializer.Write(writer, payment.Shipping); } SerializationHelper.WriteElementStringNotNull(writer, PaymentRequestSerializer.MaxAge, payment.MaxAge); SerializationHelper.WriteElementStringNotNull(writer, PaymentRequestSerializer.MaxUses, payment.MaxUses); writer.WriteEndElement(); }
public async Task<PaymentResponse> PaymentRequestAsync(PaymentRequest request) { PaymentResponse _response = new PaymentResponse(); HttpClient httpClient = setupHttpClient(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string url = "api/bridge/payment/paymentrequest"; try { var response = await httpClient.PostAsJsonAsync(url, request); _response = await response.Content.ReadAsAsync<PaymentResponse>(); } catch (Exception ex) { string error = "Failed to retrieve payment response.\n" + (ex.InnerException == null ? "" : ex.InnerException.Message); _log.Error(error); _response.StatusCode = "Error"; _response.StatusDetail = error; } return _response; }
private void Build(PaymentRequest request) { _invoice = _merchelloContext.Services.InvoiceService.GetByKey(request.InvoiceKey); if (request.PaymentKey != null) _payment = _merchelloContext.Services.PaymentService.GetByKey(request.PaymentKey.Value); _paymentGatewayMethod = _merchelloContext.Gateways.Payment.GetPaymentGatewayMethodByKey(request.PaymentMethodKey); _amount = request.Amount; foreach (var arg in request.ProcessorArgs) { _args.Add(arg.Key, arg.Value); } }
public void SetPageOutput(AbstractPageBuilder builder, PaymentRequest paymentRequest) { var page = builder.Build(paymentRequest); HttpContext.Current.Response.Write(page); }
protected virtual IDictionary <string, string> AddParameters(PaymentRequest paymentRequest) { string successUrl = paymentRequest.PaymentMethod.DynamicProperty <string>().SuccessUrl; string failureUrl = paymentRequest.PaymentMethod.DynamicProperty <string>().FailureUrl; string notificationUrl = paymentRequest.PaymentMethod.DynamicProperty <string>().NotificationUrl; string vendor = paymentRequest.PaymentMethod.DynamicProperty <string>().Vendor; string txType = paymentRequest.PaymentMethod.DynamicProperty <string>().TxType; if (paymentRequest.Payment == null) { paymentRequest.Payment = CreatePayment(paymentRequest); } IDictionary <string, string> dictionary = new Dictionary <string, string>(); var payment = paymentRequest.Payment; var billingAddress = payment.PurchaseOrder.GetBillingAddress(); string country = billingAddress.Country.TwoLetterISORegionName; string surname = UrlEncodeString(billingAddress.LastName); string firstnames = UrlEncodeString(billingAddress.FirstName); string address1 = UrlEncodeString(billingAddress.Line1); string address2 = UrlEncodeString(billingAddress.Line2); string city = UrlEncodeString(billingAddress.City); string postcode = UrlEncodeString(billingAddress.PostalCode); string email = UrlEncodeString(billingAddress.EmailAddress); string phone = UrlEncodeString(billingAddress.PhoneNumber); string state = UrlEncodeString(billingAddress.State); dictionary.Add("VendorTxCode", payment.ReferenceId); dictionary.Add("Amount", payment.Amount.ToString("0.00", CultureInfo.InvariantCulture)); dictionary.Add("Currency", paymentRequest.Amount.Currency.ISOCode); dictionary.Add("Description", PaymentMessages.PurchaseDescription); dictionary.Add("SuccessURL", new Uri(_absoluteUrlService.GetAbsoluteUrl(successUrl)).AddOrderGuidParameter(payment.PurchaseOrder).ToString()); dictionary.Add("FailureURL", new Uri(_absoluteUrlService.GetAbsoluteUrl(failureUrl)).AddOrderGuidParameter(payment.PurchaseOrder).ToString()); dictionary.Add("NotificationURL", _callbackUrl.GetCallbackUrl(notificationUrl, payment)); dictionary.Add("SendEMail", "0"); dictionary.Add("Apply3DSecure", "2"); dictionary.Add("BillingFirstnames", firstnames); dictionary.Add("BillingSurname", surname); dictionary.Add("BillingAddress1", address1); dictionary.Add("BillingAddress2", address2); dictionary.Add("BillingCity", city); dictionary.Add("BillingPostCode", postcode); dictionary.Add("BillingCountry", country); dictionary.Add("BillingPhone", phone); if (!string.IsNullOrEmpty(state)) { dictionary.Add("BillingState", state); } dictionary.Add("CustomerEMail", email); // Get shipping address if one exists, otherwise use billing address var deliveryAddress = billingAddress; var shipment = payment.PurchaseOrder.Shipments.FirstOrDefault(); if (shipment != null) { deliveryAddress = shipment.ShipmentAddress ?? billingAddress; } country = deliveryAddress.Country.TwoLetterISORegionName; surname = UrlEncodeString(deliveryAddress.LastName); firstnames = UrlEncodeString(deliveryAddress.FirstName); address1 = UrlEncodeString(deliveryAddress.Line1); city = UrlEncodeString(deliveryAddress.City); postcode = UrlEncodeString(deliveryAddress.PostalCode); phone = UrlEncodeString(deliveryAddress.PhoneNumber); state = UrlEncodeString(deliveryAddress.State); dictionary.Add("DeliverySurname", surname); dictionary.Add("DeliveryFirstnames", firstnames); dictionary.Add("DeliveryAddress1", address1); dictionary.Add("DeliveryCity", city); dictionary.Add("DeliveryPostCode", postcode); dictionary.Add("DeliveryCountry", country); dictionary.Add("DeliveryPhone", phone); if (!string.IsNullOrEmpty(state)) { dictionary.Add("DeliveryState", state); } dictionary.Add("VPSProtocol", PROTOCOL_VERSION); dictionary.Add("TxType", txType); dictionary.Add("Vendor", vendor); return(dictionary); }
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { try { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id); var reportUrl = paymentProvider.ReportUrl(); //Use https://idealtest.secure-ing.com/ideal/iDEALv3 during integration/test //Use https://ideal.secure-ing.com/ideal/iDEALv3 only for production // <provider title="IngAdvanced"> // <IssuerId>1111111</IssuerId> // <MerchantId>1111111</MerchantId> // <EntranceCode>22222222</EntranceCode> // </provider> var issuerId = orderInfo.PaymentInfo.MethodId; var merchantId = paymentProvider.GetSetting("MerchantId"); var entranceCode = paymentProvider.GetSetting("EntranceCode"); var transaction = new Transaction { Amount = orderInfo.ChargedAmount, Description = orderInfo.OrderNumber, PurchaseId = orderInfo.OrderNumber, IssuerId = issuerId, EntranceCode = entranceCode }; var connector = new Connector { MerchantReturnUrl = new Uri(reportUrl), MerchantId = merchantId, SubId = "0", ExpirationPeriod = "PT10M" }; transaction = connector.RequestTransaction(transaction); if (transaction.Status == Transaction.TransactionStatus.Success) { var transactionId = transaction.Id; var authenticateUrl = transaction.IssuerAuthenticationUrl.ToString(); var acquirerId = transaction.AcquirerId; PaymentProviderHelper.SetTransactionId(orderInfo, transactionId); orderInfo.PaymentInfo.Url = authenticateUrl; orderInfo.PaymentInfo.Parameters = acquirerId; orderInfo.Save(); } else { // todo: failure handling, so don't change anything, user will not be redirected } } catch (IDealException ex) { Log.Instance.LogError("ING Advanced PaymentRequestHander: " + ex); } var request = new PaymentRequest(); return(request); }
public void GetPaymentUrl_ThrowsWhenMissingArguments() { var request = new PaymentRequest(); Assert.Throws<ArgumentNullException>(() => _sut.GetPaymentUrl(request)); }
private void LoadingShipping(PostProcessPaymentRequest postProcessPaymentRequest, PaymentRequest payment) { payment.Shipping = new Shipping(); payment.Shipping.ShippingType = ShippingType.NotSpecified; Address adress = new Address(); adress.Complement = string.Empty; adress.District = string.Empty; adress.Number = string.Empty; if (postProcessPaymentRequest.Order.ShippingAddress != null) { adress.City = postProcessPaymentRequest.Order.ShippingAddress.City; adress.Country = postProcessPaymentRequest.Order.ShippingAddress.Country.Name; adress.PostalCode = postProcessPaymentRequest.Order.ShippingAddress.ZipPostalCode; adress.State = postProcessPaymentRequest.Order.ShippingAddress.StateProvince.Name; adress.Street = postProcessPaymentRequest.Order.ShippingAddress.Address1; } payment.Shipping.Cost = Math.Round(GetConvertedRate(postProcessPaymentRequest.Order.OrderShippingInclTax), 2); }
private void BindControl() { SiteSettings siteSettings = SettingsManager.GetMasterSettings(); this.txtContactName.Text = siteSettings.HiPOSContactName; this.txtContactPhone.Text = siteSettings.HiPOSContactPhone; this.txtSellerName.Text = siteSettings.HiPOSSellerName; this.txtExpireAt.Text = siteSettings.HiPOSExpireAt; PaymentModeInfo paymentModeInfo = null; IList <PaymentModeInfo> paymentModes = SalesHelper.GetPaymentModes(PayApplicationType.payOnAll); (from c in paymentModes where c.Gateway.Contains("alipay") select c).ForEach(delegate(PaymentModeInfo alipayPayment) { paymentModeInfo = SalesHelper.GetPaymentMode(alipayPayment.ModeId); Globals.EntityCoding(paymentModeInfo, false); ConfigablePlugin configablePlugin2 = PaymentRequest.CreateInstance(paymentModeInfo.Gateway.ToLower()); if (configablePlugin2 == null) { base.GotoResourceNotFound(); } else { Globals.EntityCoding(paymentModeInfo, false); ConfigData configData2 = new ConfigData(HiCryptographer.Decrypt(paymentModeInfo.Settings)); this.configXml = configData2.SettingsXml; this.txtZFBConfigData.Value = configData2.SettingsXml; string text5 = this.GetNodeValue(this.txtZFBConfigData.Value, "Partner").Trim(); if (string.IsNullOrEmpty(this.txtZFBPID.Text)) { this.txtZFBPID.Text = text5; } } }); (from c in paymentModes where c.Gateway.Contains(".wx") select c).ForEach(delegate(PaymentModeInfo wxPayment) { paymentModeInfo = SalesHelper.GetPaymentMode(wxPayment.ModeId); Globals.EntityCoding(paymentModeInfo, false); ConfigablePlugin configablePlugin = PaymentRequest.CreateInstance(paymentModeInfo.Gateway.ToLower()); if (configablePlugin == null) { base.GotoResourceNotFound(); } else { Globals.EntityCoding(paymentModeInfo, false); ConfigData configData = new ConfigData(HiCryptographer.Decrypt(paymentModeInfo.Settings)); this.txtWXConfigData.Value = configData.SettingsXml; string text = (!string.IsNullOrEmpty(siteSettings.HiPOSWXAppId)) ? siteSettings.HiPOSWXAppId : this.GetNodeValue(this.txtWXConfigData.Value, "AppId").Trim(); string text2 = (!string.IsNullOrEmpty(siteSettings.HiPOSWXMchId)) ? siteSettings.HiPOSWXMchId : this.GetNodeValue(this.txtWXConfigData.Value, "MCHID").Trim(); string text3 = (!string.IsNullOrEmpty(siteSettings.HiPOSWXCertPath)) ? siteSettings.HiPOSWXCertPath : this.GetNodeValue(this.txtWXConfigData.Value, "CertPath").Trim(); if (string.IsNullOrEmpty(this.txtWXAppId.Text)) { this.txtWXAppId.Text = text; } if (string.IsNullOrEmpty(this.txtWXMchId.Text)) { this.txtWXMchId.Text = text2; } if (string.IsNullOrEmpty(this.hdCertPath.Value) && !string.IsNullOrEmpty(text3)) { string text4 = text3.Replace("\\", "/").Replace("//", "/").Replace("/", "\\"); if (!File.Exists(text4)) { text4 = Globals.PhysicalPath(text3).Replace("\\", "/").Replace("//", "/") .Replace("/", "\\"); } this.hdCertPath.Value = text4 + " 删除重传"; this.fuWXCertPath.Style.Add("display", "none"); } } }); this.ooZFB.SelectedValue = siteSettings.EnableHiPOSZFB; this.ooWX.SelectedValue = siteSettings.EnableHiPOSWX; if (siteSettings.EnableHiPOSZFB) { this.txtZFBPID.Text = siteSettings.HiPOSZFBPID; } else { this.ulZFB.Style.Add("display", "none"); } if (siteSettings.EnableHiPOSWX) { this.txtWXAppId.Text = siteSettings.HiPOSWXAppId; this.txtWXMchId.Text = siteSettings.HiPOSWXMchId; this.txtWXAPIKey.Text = siteSettings.HiPOSWXAPIKey; } else { this.ulWX.Style.Add("display", "none"); } if (string.IsNullOrEmpty(this.txtZFBKey.Text.Trim())) { this.txtZFBKey.Text = this.CreatePubKeyContent(); } }
private void LoadingItems(PostProcessPaymentRequest postProcessPaymentRequest, PaymentRequest payment) { foreach (var product in postProcessPaymentRequest.Order.OrderItems) { Item item = new Item(); item.Amount = Math.Round(GetConvertedRate(product.UnitPriceInclTax), 2); item.Description = product.Product.Name; item.Id = product.Id.ToString(); item.Quantity = product.Quantity; if (product.ItemWeight.HasValue) { item.Weight = Convert.ToInt64(product.ItemWeight); } payment.Items.Add(item); } }
private void LoadingSender(PostProcessPaymentRequest postProcessPaymentRequest, PaymentRequest payment) { payment.Sender = new Sender(); payment.Sender.Email = postProcessPaymentRequest.Order.Customer.Email; payment.Sender.Name = $"{postProcessPaymentRequest.Order.BillingAddress.FirstName} {postProcessPaymentRequest.Order.BillingAddress.LastName}"; }
public PaymentResponse ProcessPayment(PaymentRequest request) { try { _logger.LogInformation($"MerchantId:{request.MerchantId} MerchantPaymentRequestId:{request.MerchantPaymentRequestId} Validating request"); if (!_registeredMerchants.ContainsKey(request.MerchantId)) { _logger.LogWarning($"MerchantId:{request.MerchantId} MerchantPaymentRequestId:{request.MerchantPaymentRequestId} Merchant Unregisterd"); return(new PaymentResponse { status = false, Message = "Merchant Unregistered", MerchantId = request.MerchantId }); } if (!_paymentRequestValidator.TryValidate(request, out string msg)) { return(new PaymentResponse { status = false, Message = msg, MerchantId = request.MerchantId }); } _logger.LogInformation($"MerchantId:{request.MerchantId} MerchantPaymentRequestId:{request.MerchantPaymentRequestId} Processing request"); Guid paymentId = Guid.NewGuid(); TransactionResponse txResponse = _bankClient.ProcessTransaction(new TransactionRequest { Amount = request.Amount, CardNumber = request.CardNumber, Ccy = request.Ccy, CVV = request.CVV, ExpiryMonthDate = request.ExpiryMonthDate, PaymentGatewayTxId = paymentId, MerchantName = _registeredMerchants[request.MerchantId] } ); _logger.LogInformation($"MerchantId:{request.MerchantId} MerchantPaymentRequestId:{request.MerchantPaymentRequestId} Storing payment response from bank"); _processedPaymentCache[new ProcessedPaymentKey(request.MerchantId, paymentId)] = new ProcessedPaymentDetails { Amount = request.Amount, Cvv = request.CVV, Ccy = request.Ccy, ExpiryMonthDate = request.ExpiryMonthDate, MerchantId = request.MerchantId, Status = txResponse.Status, CheckoutTransactionId = paymentId, MerchantPaymentRequestId = request.MerchantPaymentRequestId, //Masking CardNumber here in case crash damp is access wherein complete card numbere may be accessible CardNumber = MaskPaymentCardNumber(request.CardNumber), PaymentGatewayTxId = paymentId, BankTransactionId = txResponse.BankTransactionId, Message = txResponse.Message }; _logger.LogInformation($"MerchantId:{request.MerchantId} MerchantPaymentRequestId:{request.MerchantPaymentRequestId} Processing complete"); return(new PaymentResponse { status = txResponse.Status, MerchantId = request.MerchantId, TransactionId = txResponse.BankTransactionId, PaymentGatewayTxId = paymentId, Message = txResponse.Message, MerchantPaymentRequestId = request.MerchantPaymentRequestId }); } catch (Exception e) { _logger.LogError($"MerchantId:{request.MerchantId} MerchantPaymentRequestId:{request.MerchantPaymentRequestId} Error processing request", e); throw; } }
/// <summary> /// عملیات خرید /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <ServiceResultClient> PaymentRequestAsync(PaymentRequest model) { try { Payment payment = new Payment(model.CustomerId); var requestCpIn = new requestCPIn(); requestCpIn.authInfo = new authInfo() { userName = Request.AuthInfo.Username, password = Request.AuthInfo.Password }; payment.MerchantID = requestCpIn.merchantID = Request.MerchantID; requestCpIn.terminalID = Request.TerminalID; payment.Amount = requestCpIn.amount = model.Amount.ToString(); payment.Date = requestCpIn.date = Request.Date; payment.Time = requestCpIn.time = Request.Time; requestCpIn.localIP = Request.LocalIP; payment.PAN = requestCpIn.PAN = model.PAN; requestCpIn.PINBlock = model.PINBlock; requestCpIn.serial = Request.Serial; payment.STAN = requestCpIn.STAN = Request.STAN; requestCpIn.track2Ciphered = model.Track2Ciphered; requestCpIn.custMobile = Request.Mobile; payment.InvoiceNo = requestCpIn.invoiceNo = Request.InvoiceNo; SoapMobileClient s = new SoapMobileClient(); var resultRequestCP = s.requestCP(requestCpIn); try { log.InsertLog(payment, resultRequestCP.responseCode); } catch (Exception) { } var resultRequestCPMessage = TransactionMessage(resultRequestCP.responseCode, resultRequestCP.responseMsg); if (resultRequestCPMessage.Status != TransactionStatus.SuccessfulTransaction.ToString()) { payment.Success = false; payment.RefNo = resultRequestCP.refNo; return(resultRequestCPMessage); } else { var settleReverseIn = new settleReverseIn() { authInfo = requestCpIn.authInfo, custMobile = requestCpIn.custMobile, date = requestCpIn.date, localIP = requestCpIn.localIP, merchantID = requestCpIn.merchantID, orgRefNo = resultRequestCP.refNo, terminalID = requestCpIn.terminalID, serial = requestCpIn.serial, time = requestCpIn.time, orgAmount = requestCpIn.amount, transType = "paymentrequest", STAN = requestCpIn.STAN, version = requestCpIn.version }; var resultSettlement = s.settlement(settleReverseIn); var resultSettlementMessage = TransactionMessage(resultSettlement.responseCode, resultSettlement.responseMsg); resultSettlementMessage.ClientRefNo = settleReverseIn.STAN; resultSettlementMessage.Date = settleReverseIn.date; resultSettlementMessage.RefNo = settleReverseIn.orgRefNo; resultSettlementMessage.Time = settleReverseIn.time; payment.Success = resultSettlementMessage.Status == TransactionStatus.SuccessfulTransaction.ToString() ? true : false; return(resultSettlementMessage); } } catch (Exception ex) { return(AppGlobal.ServiceResultClientInstance(true, "عملیات نا موفق")); } }
public Task <bool> CheckIfPaymentGetwayExist(PaymentRequest paymentRequest) { return(Task.FromResult(true)); }
private string GetPaymentRequestJson() { using (StructureMap.IContainer cont = NestedContainer) { PaymentTransactionRefId = Guid.NewGuid() /*new Guid("69d84aba-97fc-471a-9790-d5cb518c8a00")*/; string modifiedSubscriberId = "tel:" + SubscriberId; if (!SubscriberIdIsTel) modifiedSubscriberId = "id:" + SubscriberId; var pr = new PaymentRequest { Id = Guid.NewGuid(), DistributorCostCenterId = Using<IConfigService>(cont).Load().CostCentreId, AccountId = AccountNo, SubscriberId = modifiedSubscriberId, PaymentInstrumentName = SelectedMMoneyOption.Name, OrderNumber = OrderDocReference, InvoiceNumber = InvoiceDocReference, //Extra = // SelectedMMoneyOption.Name == "BuyGoods" // ? TheOrder.DocumentIssuerUser.TillNumber // : "", TransactionRefId = PaymentTransactionRefId.ToString(), ApplicationId = Using<IConfigService>(cont).Load().CostCentreApplicationId.ToString(), Amount = (double)MMoneyAmount, ClientRequestResponseType = ClientRequestResponseType.AsynchronousPayment, DateCreated = DateTime.Now, AllowOverPayment = false, //set at service provider level AllowPartialPayments = false, //set at service provider level Currency = Currency, //todo: get from master data smsDescription = SMS, }; _clientRequestResponses.Add(pr); return JsonConvert.SerializeObject(pr, new IsoDateTimeConverter()); } }
protected void LinkButtonHistorico_Click1(object sender, EventArgs e) { /// EXERCICIO: /// Conclua a integração com o PagSeguro /// EXERCICIO: /// Implemente a integração com o Paypal //Use global configuration PagSeguroConfiguration.UrlXmlConfiguration = "PagSeguroConfig.xml"; bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new payment request PaymentRequest payment = new PaymentRequest(); // Sets the currency payment.Currency = Currency.Brl; List <VendaDetalheDTO> ListaVenda = VendaAtual.ListaVendaDetalhe; foreach (VendaDetalheDTO objVenda in ListaVenda) { payment.Items.Add(new Item(objVenda.Produto.CodigoInterno.ToString(), objVenda.Produto.Nome, 1, objVenda.Produto.ValorVenda.Value)); } // Sets a reference code for this payment request, it is useful to identify this payment in future notifications. payment.Reference = "REF1234"; // Sets shipping information for this payment request payment.Shipping = new Shipping(); payment.Shipping.ShippingType = ShippingType.Sedex; //Passando valor para ShippingCost payment.Shipping.Cost = 10.00m; payment.Shipping.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); // Sets your customer information. payment.Sender = new Sender( "Joao Comprador", "*****@*****.**", new Phone("11", "56273440") ); SenderDocument document = new SenderDocument(Documents.GetDocumentByType("CPF"), "12345678909"); payment.Sender.Documents.Add(document); // Sets the url used by PagSeguro for redirect user after ends checkout process payment.RedirectUri = new Uri("http://www.t2ti.com"); // Add installment without addition per payment method payment.AddPaymentMethodConfig(PaymentMethodConfigKeys.MaxInstallmentsNoInterest, 6, PaymentMethodGroup.CreditCard); // Add and remove groups and payment methods List <string> accept = new List <string>(); accept.Add(ListPaymentMethodNames.DebitoItau); accept.Add(ListPaymentMethodNames.DebitoHSBC); payment.AcceptPaymentMethodConfig(ListPaymentMethodGroups.CreditCard, accept); List <string> exclude = new List <string>(); exclude.Add(ListPaymentMethodNames.Boleto); payment.ExcludePaymentMethodConfig(ListPaymentMethodGroups.Boleto, exclude); try { /// Create new account credentials /// This configuration let you set your credentials from your ".cs" file. AccountCredentials credentials = new AccountCredentials("*****@*****.**", "zxcvzxcv5CC65465487922CA498797F"); /// @todo with you want to get credentials from xml config file uncommend the line below and comment the line above. //AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); Uri paymentRedirectUri = payment.Register(credentials); Response.Redirect(paymentRedirectUri.ToString()); //Console.WriteLine("URL do pagamento : " + paymentRedirectUri); //Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
private string GetPaymentRequestJson(string currency, bool SubscriberIdIsTel, string subscriberId, string sMs, string accountNo, string selectedMMoneyOption, string orderDocReference = "", string invoiceDocReference = "", string tillNumber="") { Guid PaymentTransactionRefId = Guid.NewGuid() /*new Guid("69d84aba-97fc-471a-9790-d5cb518c8a00")*/; string modifiedSubscriberId = "tel:" + subscriberId; if (!SubscriberIdIsTel) modifiedSubscriberId = "id:" + subscriberId; var pr = new PaymentRequest { Id = Guid.NewGuid(), DistributorCostCenterId = _configService.Load().CostCentreId, AccountId = accountNo, SubscriberId = modifiedSubscriberId, PaymentInstrumentName = selectedMMoneyOption, OrderNumber = orderDocReference, InvoiceNumber = invoiceDocReference, //Extra =selectedMMoneyOption == "BuyGoods"?tillNumber: "", TransactionRefId = PaymentTransactionRefId.ToString(), ApplicationId =_configService.Load().CostCentreApplicationId.ToString(), Amount = (double)MMoneyAmount, ClientRequestResponseType = ClientRequestResponseType.AsynchronousPayment, DateCreated = DateTime.Now, AllowOverPayment = false, //set at service provider level AllowPartialPayments = false, //set at service provider level Currency = currency, //todo: get from master data smsDescription = sMs, }; _clientRequestResponses.Add(pr); return JsonConvert.SerializeObject(pr, new IsoDateTimeConverter()); }
public async Task SaveHistory(PaymentRequest request, PaymentResult result) { var history = BuildHistory(request, result); await _historyRepository.Save(history); }
protected void ProcessTransaction_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid && ValidateAmmount()) { ShoppingCart.CartItems.Clear();//.ClearData(); AddProductToShoppingCart(); GetImagePath(); AddOrder(); //Retrieve the InstallationID, MerchantCode and XMLPassword values from the web.config WorldPayDirectDotNet.PaymentRequest PaymentRequest = new PaymentRequest(); PaymentRequest.MerchantCode = WebConfigurationManager.AppSettings["MerchantCode"]; PaymentRequest.XMLPassword = WebConfigurationManager.AppSettings["XMLPassword"]; //OrderCode - If your system has created a unique order/cart ID, enter it here. PaymentRequest.OrderCode = order.OrderID.ToString(); //amount - A decimal number giving the cost of the purchase in terms of the minor currency unit e.g. £12.56 = 1256 PaymentRequest.amount = (int)(double.Parse(txtDonationAmount.Text) * 100); //currencyCode - 3 letter ISO code for the currency of this payment. PaymentRequest.currencyCode = "GBP"; //testMode - set to 0 for Live Mode, set to 100 for Test Mode. string URL=""; if(ValidationHelper.GetInteger(WebConfigurationManager.AppSettings["testMode"], 0) == 0) { URL= "https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp"; } else { URL="https://secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp"; } PaymentRequest.orderContent = ""; //WorldPayDirectDotNet.PaymentRequest.PaymentResult PaymentResult = PaymentRequest.SubmitTransaction(PaymentRequest); StringBuilder builder = SubmitTransaction(PaymentRequest); string returnURL = string.Format("https://{0}/DonationReturn.aspx", CMSContext.CurrentSite.DomainName); string credentials = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(PaymentRequest.MerchantCode + ":" + PaymentRequest.XMLPassword)); HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create(URL); wReq.ContentType = "text/xml"; wReq.UserAgent = "Worldpay Payments"; wReq.Timeout = 45 * 1000; // milliseconds wReq.AllowAutoRedirect = true; wReq.Headers.Add("Authorization", "Basic " + credentials); wReq.ContentLength = builder.ToString().Length; wReq.Method = "POST"; StreamWriter sReq = new StreamWriter(wReq.GetRequestStream()); sReq.Write(builder.ToString()); sReq.Flush(); sReq.Close(); HttpWebResponse wResp = (HttpWebResponse)wReq.GetResponse(); StreamReader sResp = new StreamReader(wResp.GetResponseStream()); String responseXML = sResp.ReadToEnd(); XmlDocument derp = new XmlDocument(); derp.LoadXml(responseXML); XmlNode response = derp.DocumentElement.SelectSingleNode("reply"); string URLExts = string.Format("&successURL={0}&failureURL={1}&pendingURL={2}&cancelURL={3}", returnURL, returnURL, returnURL, returnURL + "?paymentStatus=CANCELLED"); if (response.InnerText != null) { Response.Redirect(response.InnerText + URLExts); } } }
public async Task <ServiceResultClient> PaymentRequest(PaymentRequest model) { return(await TransactionService.PaymentRequestAsync(model)); }
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias); var reportUrl = paymentProvider.ReportUrl(); var pspId = paymentProvider.GetSetting("PSPID"); var shaInSignature = paymentProvider.GetSetting("SHAInSignature"); var secureHashAlgorithm = paymentProvider.GetSetting("SecureHashAlgorithm"); var liveUrl = "https://secure.ogone.com/ncol/prod/orderstandard.asp"; var testUrl = "https://secure.ogone.com/ncol/test/orderstandard.asp"; var configLiveUrl = paymentProvider.GetSetting("Url"); var configTestUrl = paymentProvider.GetSetting("testUrl"); if (!string.IsNullOrEmpty(configLiveUrl)) { liveUrl = configLiveUrl; } if (!string.IsNullOrEmpty(configTestUrl)) { testUrl = configTestUrl; } var url = paymentProvider.TestMode ? testUrl : liveUrl; var request = new PaymentRequest(); request.Parameters.Add("PSPID", pspId); request.Parameters.Add("ORDERID", orderInfo.OrderNumber); var amount = orderInfo.ChargedAmountInCents; request.Parameters.Add("AMOUNT", amount.ToString()); request.Parameters.Add("CURRENCY", orderInfo.StoreInfo.Store.CurrencyCultureSymbol); request.Parameters.Add("LANGUAGE", orderInfo.StoreInfo.LanguageCode + "_" + orderInfo.StoreInfo.CountryCode); request.Parameters.Add("EMAIL", OrderHelper.CustomerInformationValue(orderInfo, "customerEmail")); request.Parameters.Add("ACCEPTURL", reportUrl); request.Parameters.Add("DECLINEURL", reportUrl); request.Parameters.Add("EXCEPTIONURL", reportUrl); request.Parameters.Add("CANCELURL", reportUrl); //action => 'Normal Authorization' (with operation => 'SAL' (default)) //action => 'Authorization Only' (with operation => 'RES' (default)) then action => 'Post Authorization' (with operation => 'SAS' (default)) request.Parameters.Add("OPERATION", "SAL"); var transactionId = orderInfo.UniqueOrderId.ToString().Replace("-", ""); request.Parameters.Add("PARAMPLUS", string.Format("TransactionId={0}", transactionId)); if (orderInfo.PaymentInfo.MethodId.Contains('-')) { var splitarray = orderInfo.PaymentInfo.MethodId.Split('-'); var pm = splitarray[0]; var brand = splitarray[1]; request.Parameters.Add("PM", pm); request.Parameters.Add("BRAND", brand); } else { request.Parameters.Add("PM", orderInfo.PaymentInfo.MethodTitle); } var stringToHash = string.Empty; var sortedParameters = request.Parameters.OrderBy(x => x.Key); foreach (var parameter in sortedParameters) { stringToHash += string.Format("{0}={1}{2}", parameter.Key, parameter.Value, shaInSignature); } switch (secureHashAlgorithm) { case "SHA1": request.Parameters.Add("SHASIGN", GetSHA1Hash(stringToHash).ToUpper()); break; case "SHA256": request.Parameters.Add("SHASIGN", GetSHA256Hash(stringToHash).ToUpper()); break; case "SHA512": request.Parameters.Add("SHASIGN", GetSHA512Hash(stringToHash).ToUpper()); break; } request.PaymentUrlBase = url; orderInfo.PaymentInfo.Url = request.PaymentUrl; orderInfo.PaymentInfo.Parameters = request.ParametersAsString; PaymentProviderHelper.SetTransactionId(orderInfo, transactionId); return request; }
public Task PayAsync(PaymentRequest request) { return(_runner.RunWithDefaultErrorHandlingAsync(() => _paymentRequestsApi.PayAsync(request))); }
protected override void AttachChildControls() { this.orderId = this.Page.Request.QueryString["orderId"]; List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(this.orderId); decimal amount = 0M; if (orderMarkingOrderInfo.Count == 0) { this.Page.Response.Redirect("/Vshop/MemberOrders.aspx?status=0"); } bool flag = true; foreach (OrderInfo info in orderMarkingOrderInfo) { amount += info.GetTotal(); foreach (LineItemInfo info2 in info.LineItems.Values) { if (info2.Type == 0) { flag = false; } } } if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.offlinerequest")) { this.litMessage = (Literal)this.FindControl("litMessage"); this.litMessage.SetWhenIsNotNull(SettingsManager.GetMasterSettings(false, wid).OffLinePayContent); } this.btnToPay = (HtmlAnchor)this.FindControl("btnToPay"); if (!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway == "hishop.plugins.payment.weixinrequest")) { this.btnToPay.Visible = true; this.btnToPay.HRef = "~/pay/wx_Submit.aspx?orderId=" + this.orderId; } if ((!string.IsNullOrEmpty(orderMarkingOrderInfo[0].Gateway) && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.podrequest")) && ((orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.offlinerequest") && (orderMarkingOrderInfo[0].Gateway != "hishop.plugins.payment.weixinrequest"))) { PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderMarkingOrderInfo[0].PaymentTypeId); string attach = ""; string showUrl = string.Format("http://{0}/vshop/", HttpContext.Current.Request.Url.Host); PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.orderId, amount, "订单支付", "订单号-" + this.orderId, orderMarkingOrderInfo[0].EmailAddress, orderMarkingOrderInfo[0].OrderDate, showUrl, Globals.FullPath("/pay/PaymentReturn_url.aspx"), Globals.FullPath("/pay/PaymentNotify_url.aspx"), attach).SendRequest(); } else { this.litOrderId = (Literal)this.FindControl("litOrderId"); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.litPaymentType = (HtmlInputHidden)this.FindControl("litPaymentType"); int result = 0; this.litPaymentType.SetWhenIsNotNull("0"); if (int.TryParse(this.Page.Request.QueryString["PaymentType"], out result)) { this.litPaymentType.SetWhenIsNotNull(result.ToString()); } this.litOrderId.SetWhenIsNotNull(this.orderId); if (flag) { this.litOrderTotal.SetWhenIsNotNull("您需要支付:\x00a5" + amount.ToString("F2")); } this.litHelperText = (Literal)this.FindControl("litHelperText"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid); this.litHelperText.SetWhenIsNotNull(masterSettings.OffLinePayContent); PageTitle.AddSiteNameTitle("下单成功"); } }
public PaymentRequest GetPaymentRequest() { var request = new PaymentRequest(); return(request); }
private static bool ValidateCardNumber(PaymentRequest request) { return(Regex.Match(request.CardNumber, CardNumberRegex).Success); }
public async Task <IActionResult> Index(PaymentModel paymentModel) { if (!this.ModelState.IsValid || paymentModel == null) { return(this.View()); } var token = ""; using (var httpClient = new HttpClient()) { var tokenRequest = new APIModeModel() { apiKey = paymentModel.APIKey }; StringContent content = new StringContent(JsonConvert.SerializeObject(tokenRequest), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync($"{_configuration.GetSection("appSettings")["PaymentAPI"]}/Token", content)) { token = await response.Content.ReadAsStringAsync(); } } var request = new PaymentRequest() { amount = new Amount() { currency = paymentModel.Currency, value = paymentModel.Amount.ToString() }, description = paymentModel.Description, locale = "DE", redirectUrl = $"{_httpContextAccessor.HttpContext.Request.Scheme}://{_httpContextAccessor.HttpContext.Request.Host.Value}/home/Success", sequenceType = 1, webhookUrl = $"{_httpContextAccessor.HttpContext.Request.Scheme}://{_httpContextAccessor.HttpContext.Request.Host.Value}/home/Success", method = 1 }; PaymentResponseMessage paymentResponseMessage = null; using (var httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); StringContent content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync($"{_configuration.GetSection("appSettings")["PaymentAPI"]}/CreatePaymentAPI", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); paymentResponseMessage = JsonConvert.DeserializeObject <PaymentResponseMessage>(apiResponse); } } if (paymentResponseMessage != null) { if (paymentResponseMessage.ErrorCode == string.Empty) { return(this.Redirect(paymentResponseMessage.PaymentResponse.CheckoutUrl)); } else { _logger.LogError(paymentResponseMessage.ErrorMessage); // Show Error return(View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier })); } } return(View()); }
static void Main(string[] args) { //Use global configuration //PagSeguroConfiguration.UrlXmlConfiguration = "../../../../../Configuration/PagSeguroConfig.xml"; bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new payment request PaymentRequest payment = new PaymentRequest(); // Sets the currency payment.Currency = Currency.Brl; // Add an item for this payment request payment.Items.Add(new Item("0001", "Notebook Prata", 1, 2430.00m)); // Add another item for this payment request payment.Items.Add(new Item("0002", "Notebook Rosa", 2, 150.99m)); // Sets a reference code for this payment request, it is useful to identify this payment in future notifications. payment.Reference = "REF1234"; // Sets shipping information for this payment request payment.Shipping = new Shipping(); payment.Shipping.ShippingType = ShippingType.Sedex; //Passando valor para ShippingCost payment.Shipping.Cost = 10.00m; payment.Shipping.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); // Sets your customer information. payment.Sender = new Sender( "Joao Comprador", "*****@*****.**", new Phone("11", "56273440") ); SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "12345678909"); payment.Sender.Documents.Add(senderCPF); // Sets the url used by PagSeguro for redirect user after ends checkout process payment.RedirectUri = new Uri("http://www.lojamodelo.com.br"); // Add checkout metadata information payment.AddMetaData(MetaDataItemKeys.GetItemKeyByDescription("CPF do passageiro"), "123.456.789-09", 1); payment.AddMetaData("PASSENGER_PASSPORT", "23456", 1); // Another way to set checkout parameters payment.AddParameter("senderBirthday", "07/05/1980"); payment.AddIndexedParameter("itemColor", "verde", 1); payment.AddIndexedParameter("itemId", "0003", 3); payment.AddIndexedParameter("itemDescription", "Mouse", 3); payment.AddIndexedParameter("itemQuantity", "1", 3); payment.AddIndexedParameter("itemAmount", "200.00", 3); // Add discount per payment method payment.AddPaymentMethodConfig(PaymentMethodConfigKeys.DiscountPercent, 50.00, PaymentMethodGroup.CreditCard); // Add installment without addition per payment method payment.AddPaymentMethodConfig(PaymentMethodConfigKeys.MaxInstallmentsNoInterest, 6, PaymentMethodGroup.CreditCard); // Add installment limit per payment method payment.AddPaymentMethodConfig(PaymentMethodConfigKeys.MaxInstallmentsLimit, 8, PaymentMethodGroup.CreditCard); // Add and remove groups and payment methods List<string> accept = new List<string>(); accept.Add(AcceptedPaymentNames.DebitoItau); accept.Add(AcceptedPaymentNames.DebitoHSBC); payment.AcceptPaymentMethodConfig(AcceptedPaymentGroups.CreditCard, accept); List<string> exclude = new List<string>(); exclude.Add(AcceptedPaymentNames.Boleto); payment.ExcludePaymentMethodConfig(AcceptedPaymentGroups.Boleto, exclude); try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); Uri paymentRedirectUri = payment.Register(credentials); Console.WriteLine("URL do pagamento : " + paymentRedirectUri); Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
private static void AddItemExample() { PaymentRequest paymentRequest = new PaymentRequest(); paymentRequest.Items.Add(new Item("0001", "Notebook", 1, 2430.00m)); }
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias); var liveUrl = "https://checkout.buckaroo.nl/nvp/"; var testUrl = "https://testcheckout.buckaroo.nl/nvp/"; var configLiveUrl = paymentProvider.GetSetting("Url"); var configTestUrl = paymentProvider.GetSetting("testUrl"); var lowercaseUrls = paymentProvider.GetSetting("LowercaseUrls"); var trailingSlash = paymentProvider.GetSetting("AddTrailingSlash"); var lowercase = false; var addslash = false; if (!string.IsNullOrEmpty(lowercaseUrls)) { if (lowercaseUrls == "true" || lowercaseUrls == "1" || lowercaseUrls == "on") { lowercase = true; } } if (!string.IsNullOrEmpty(trailingSlash)) { if (trailingSlash == "true" || trailingSlash == "1" || trailingSlash == "on") { addslash = true; } } if(!string.IsNullOrEmpty(configLiveUrl)) { liveUrl = configLiveUrl; } if(!string.IsNullOrEmpty(configTestUrl)) { testUrl = configTestUrl; } var url = paymentProvider.TestMode ? testUrl : liveUrl; var providerSettingsXML = paymentProvider.GetSettingsXML(); var service = orderInfo.PaymentInfo.MethodId; string issuer = null; var issuerElement = providerSettingsXML.Descendants().FirstOrDefault(x => x.Value.ToLowerInvariant() == orderInfo.PaymentInfo.MethodId.ToLowerInvariant()); if (issuerElement != null) { issuer = issuerElement.Value; if (issuerElement.Name.LocalName.ToLowerInvariant() != "issuer") { var firstOrDefault = issuerElement.AncestorsAndSelf("Service").FirstOrDefault(); if (firstOrDefault != null) { service = firstOrDefault.Attribute("name").Value; } } } var reportUrl = paymentProvider.ReportUrl(); if (lowercase) { reportUrl = reportUrl.ToLowerInvariant(); } if (!reportUrl.EndsWith("/") && addslash) { reportUrl = reportUrl + "/"; } BuckarooRequestParameters requestParams = new BuckarooRequestParameters(paymentProvider.GetSetting("SecretKey")); requestParams.Amount = orderInfo.ChargedAmountInCents / 100m; requestParams.Culture = System.Threading.Thread.CurrentThread.CurrentCulture.Name; requestParams.Currency = orderInfo.StoreInfo.Store.CurrencyCultureSymbol; requestParams.InvoiceNumber = orderInfo.OrderNumber; requestParams.PaymentMethod = service; requestParams.ReturnUrl = reportUrl; requestParams.ReturnCancelUrl = reportUrl; requestParams.ReturnErrorUrl = reportUrl; requestParams.ReturnReject = reportUrl; requestParams.WebsiteKey = paymentProvider.GetSetting("Websitekey"); var transactionId = orderInfo.UniqueOrderId.ToString(); requestParams.TransactionId = transactionId; string IssuersServiceKeyName = null; string IssuerServiceKeyValue = null; string IssuerActionKeyName = null; string IssuerActionKeyValue = null; if (!string.IsNullOrEmpty(issuer)) { IssuersServiceKeyName = string.Format("brq_service_{0}_issuer", service); IssuerServiceKeyValue = issuer; IssuerActionKeyName = string.Format("brq_service_{0}_action", service); IssuerActionKeyValue = "Pay"; requestParams.AddCustomParameter(IssuersServiceKeyName, IssuerServiceKeyValue); requestParams.AddCustomParameter(IssuerActionKeyName, IssuerActionKeyValue); } if (service.Equals("transfer")) { requestParams.AddCustomParameter("brq_service_transfer_customeremail", orderInfo.CustomerEmail); requestParams.AddCustomParameter("brq_service_transfer_customerfirstname", orderInfo.CustomerFirstName); requestParams.AddCustomParameter("brq_service_transfer_customerlastname", orderInfo.CustomerLastName); } if (service.Equals("onlinegiro")) { requestParams.AddCustomParameter("brq_service_onlinegiro_customergender", "9"); requestParams.AddCustomParameter("brq_service_onlinegiro_customeremail", orderInfo.CustomerEmail); requestParams.AddCustomParameter("brq_service_onlinegiro_customerfirstname", orderInfo.CustomerFirstName); requestParams.AddCustomParameter("brq_service_onlinegiro_customerlastname", orderInfo.CustomerLastName); } requestParams.Sign(); var request = new PaymentRequest(); //request.Parameters.Add("add_transactionReference", Add_transactionReference); //request.Parameters.Add("brq_amount", Brq_amount); //request.Parameters.Add("brq_currency", Brq_currency); //request.Parameters.Add("brq_invoicenumber", Brq_invoicenumber); //request.Parameters.Add("brq_payment_method", Brq_payment_method); //request.Parameters.Add("brq_return", Brq_return); //request.Parameters.Add("brq_returncancel", Brq_returncancel); //request.Parameters.Add("brq_returnerror", Brq_returnerror); //request.Parameters.Add("brq_returnreject", Brq_returnreject); //if (!string.IsNullOrEmpty(issuer)) //{ // request.Parameters.Add(IssuerActionKeyName, IssuerActionKeyValue); // request.Parameters.Add(IssuersServiceKeyName, IssuerServiceKeyValue); //} //request.Parameters.Add("brq_websitekey", Brq_websitekey); //request.Parameters.Add("brq_signature", Brq_signature); request.Parameters = requestParams.GetParameters(); var uri = new Uri(url); var webrequest = WebRequest.Create(uri); var encoding = new UTF8Encoding(); var requestData = encoding.GetBytes(request.ParametersAsString); webrequest.ContentType = "application/x-www-form-urlencoded"; webrequest.Method = "POST"; webrequest.ContentLength = requestData.Length; using (var stream = webrequest.GetRequestStream()) { stream.Write(requestData, 0, requestData.Length); } using (var response = webrequest.GetResponse()) { var stream = response.GetResponseStream(); if (stream == null) throw new Exception("No response from POST request to " + url); using (var reader = new StreamReader(stream, Encoding.ASCII)) { var value = reader.ReadToEnd(); var result = HttpUtility.ParseQueryString(value); orderInfo.PaymentInfo.Url = result["brq_redirecturl"]; if (service == "onlinegiro" || service == "transfer") { orderInfo.PaymentInfo.Url = reportUrl + "?" + value; } } } PaymentProviderHelper.SetTransactionId(orderInfo, transactionId); return request; }
protected void Page_Load(object sender, System.EventArgs e) { this.btnConfirmPay.Click += new System.EventHandler(this.btnConfirmPay_Click); this.btnBack.Click += new System.EventHandler(this.btnBack_Click); this.btnBack1.Click += new System.EventHandler(this.btnBack_Click); this.imgBtnBack.Click += new System.Web.UI.ImageClickEventHandler(this.btnBack_Click); if (string.IsNullOrEmpty(base.Request.QueryString["PurchaseOrderId"])) { base.GotoResourceNotFound(); return; } this.purchaseOrderId = base.Request.QueryString["PurchaseOrderId"]; this.purchaseOrder = SubsiteSalesHelper.GetPurchaseOrder(this.purchaseOrderId); if (!base.IsPostBack) { if (this.purchaseOrder == null) { base.GotoResourceNotFound(); return; } int num; int.TryParse(base.Request["PayMode"], out num); PaymentModeInfo paymentMode = SubsiteStoreHelper.GetPaymentMode(num); if (num > 0 && paymentMode.Gateway != "hishop.plugins.payment.advancerequest") { SubsiteStoreHelper.GetDistributor(); string showUrl = Globals.FullPath(Globals.GetSiteUrls().Home); if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest") { showUrl = base.Server.UrlEncode(string.Format("http://{0}/shopadmin/purchaseorder/MyPurchaseOrderDetails.aspx?purchaseOrderId={1}", base.Request.Url.Host, this.purchaseOrder.PurchaseOrderId)); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { this.purchaseOrder.PurchaseOrderId })); } if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0) { showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { this.purchaseOrder.PurchaseOrderId })); } string attach = ""; System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { attach = httpCookie.Value; } PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), this.purchaseOrder.PurchaseOrderId, this.purchaseOrder.GetPurchaseTotal(), "采购单支付", "采购单号-" + this.purchaseOrder.PurchaseOrderId, "", this.purchaseOrder.PurchaseDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("DistributorPaymentNotify_url", new object[] { paymentMode.Gateway })), attach); paymentRequest.SendRequest(); } if (this.purchaseOrder.IsManualPurchaseOrder) { this.litorder.Visible = false; this.litOrderId.Visible = false; } else { this.litOrderId.Text = this.purchaseOrder.OrderId; } this.litPurchaseOrderId.Text = this.purchaseOrder.PurchaseOrderId; this.lblPurchaseDate.Time = this.purchaseOrder.PurchaseDate; this.lblTotalPrice.Money = this.purchaseOrder.GetPurchaseTotal(); AccountSummaryInfo myAccountSummary = SubsiteStoreHelper.GetMyAccountSummary(); this.lblUseableBalance.Money = myAccountSummary.UseableBalance; } }
/// <summary> /// Renders the forms to be submitted to the payment provider. /// </summary> /// <param name="paymentRequest">The payment request.</param> /// <returns>A string containing the html form.</returns> public override string RenderPage(PaymentRequest paymentRequest) { return(PageBuilder.Build(paymentRequest)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.activity_main); merchantServerUrl = TextUtils.IsEmpty(merchantServerUrl) ? SERVER_URL : merchantServerUrl; merchantApiSecretKey = TextUtils.IsEmpty(merchantApiSecretKey) ? API_KEY : merchantApiSecretKey; merchantApiHeaderKeyForApiSecretKey = TextUtils.IsEmpty(merchantApiHeaderKeyForApiSecretKey)? API_HEADER_KEY: merchantApiHeaderKeyForApiSecretKey; context = this; SetStatusBarTranslucent(true); Button checkoutButton = (Button)FindViewById(Resource.Id.checkout_button); // checkoutButton.Click += (s, e) => { if (TextUtils.IsEmpty(merchantApiSecretKey) || TextUtils.IsEmpty(merchantApiHeaderKeyForApiSecretKey) || TextUtils.IsEmpty(merchantServerUrl)) { Toast.MakeText(ApplicationContext, "Server parameters have not been configured correctly", ToastLength.Long).Show(); return; } paymentRequest = new PaymentRequest(context, paymentRequestListener); paymentRequest.Start(); }; // paymentRequestListener = new PaymentRequestListener { PaymentDataRequested = (paymentRequest, token, paymentDataCallback) => { Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("Content-Type", "application/json; charset=UTF-8"); headers.Add(merchantApiHeaderKeyForApiSecretKey, merchantApiSecretKey); AsyncHttpClient.Post(merchantServerUrl + SETUP, headers, GetSetupDataString(token), new HttpResponseCallback { Success = (response) => { paymentDataCallback.CompletionWithPaymentData(response); }, Failure = (e) => { Log.Error(TAG, "HTTP Response problem: ", e); System.Diagnostics.Debug.Write("HTTP Response problem: " + e); } }); }, PaymentResult = (paymentRequest, paymentRequestResult) => { if (paymentRequestResult.IsProcessed && (paymentRequestResult.Payment.GetPaymentStatus() == Payment.PaymentStatus.Authorised || paymentRequestResult.Payment.GetPaymentStatus() == Payment.PaymentStatus.Received)) { verifyPayment(paymentRequestResult.Payment); Intent intent = new Intent(context, typeof(SuccessActivity)); StartActivity(intent); Finish(); } else { Intent intent = new Intent(context, typeof(FailureActivity)); StartActivity(intent); Finish(); } } }; }
async void ApiSendPaymentRequest() { using (StructureMap.IContainer c = NestedContainer) { PaymentTransactionRefId = Guid.NewGuid(); string modifiedSubscriberId = "tel:" + SubscriberId; if (!SubscriberIdIsTel) modifiedSubscriberId = "id:" + SubscriberId; var pr = new PaymentRequest { Id = Guid.NewGuid(), DistributorCostCenterId = Using<IConfigService>(c).Load().CostCentreId, AccountId = AccountNo, SubscriberId = modifiedSubscriberId, PaymentInstrumentName = SelectedMMoneyOption.Name, OrderNumber = OrderDocReference, InvoiceNumber = InvoiceDocReference, TransactionRefId = PaymentTransactionRefId.ToString(), ApplicationId = Using<IConfigService>(c).Load().CostCentreApplicationId.ToString(), Amount = (double)MMoneyAmount, ClientRequestResponseType = ClientRequestResponseType.AsynchronousPayment, DateCreated = DateTime.Now, AllowOverPayment = false, //set at service provider level AllowPartialPayments = false, //set at service provider level Currency = Currency, //todo: get from master data smsDescription = SMS, }; if (SelectedMMoneyOption.Name.ToLower().Contains("buygoods")) { pr.Extra = new Dictionary<string, string>() ; pr.Extra.Add("tillNo", TillNumber); } _clientRequestResponses.Add(pr); PaymentResponse response = await Using<IPaymentGatewayProxy>(c).PaymentRequestAsync(pr); ProcessPaymentRequestResponse(response); } }
public void OnPaymentDataRequested(PaymentRequest p0, string p1, IPaymentDataCallback p2) { PaymentDataRequested?.Invoke(p0, p1, p2); }
PaymentResponse GenerateSamplePaymentResponse(PaymentRequest request) { PaymentResponse apr = new PaymentResponse(); Random ran = new Random(); apr.BusinessNumber = Guid.NewGuid().ToString(); apr.ClientRequestResponseType = ClientRequestResponseType.AsynchronousPayment; apr.DateCreated = DateTime.Now; apr.TransactionRefId = request.TransactionRefId; apr.Id = Guid.NewGuid(); apr.SDPTransactionRefId = sampleInternalTrxId.ToString(); apr.LongDescription = "Long description"; apr.SDPReferenceId = "12345678";// ran.Next(10000000, 99999999); apr.ShortDescription = "Short Desc."; apr.StatusDetail = "OK"; return apr; }
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id); var reportUrl = paymentProvider.ReportUrl(); // <provider title="OmniKassa"> // <MerchantId>002020000000001</MerchantId> // <CurrencyCode>978</CurrencyCode> // <normalReturnUrl>http://www.hetanker.tv</normalReturnUrl> // <KeyVersion>1</KeyVersion> // <TestAmount>56</TestAmount> // </provider> var merchantId = paymentProvider.GetSetting("MerchantId"); var keyVersion = paymentProvider.GetSetting("KeyVersion"); var currencyCode = paymentProvider.GetSetting("CurrencyCode"); var testAmount = paymentProvider.GetSetting("testAmount"); var liveUrl = "https://payment-webinit.omnikassa.rabobank.nl/paymentServlet"; var testUrl = "https://payment-webinit.simu.omnikassa.rabobank.nl/paymentServlet"; var configLiveUrl = paymentProvider.GetSetting("Url"); var configTestUrl = paymentProvider.GetSetting("testUrl"); if (!string.IsNullOrEmpty(configLiveUrl)) { liveUrl = configLiveUrl; } if (!string.IsNullOrEmpty(configTestUrl)) { testUrl = configTestUrl; } var liveForwardUrl = "https://payment-web.omnikassa.rabobank.nl/payment"; var testForwardUrl = "https://payment-web.simu.omnikassa.rabobank.nl/payment"; var configForwardLiveUrl = paymentProvider.GetSetting("forwardUrl"); var configForwardTestUrl = paymentProvider.GetSetting("testForwardUrl"); if (!string.IsNullOrEmpty(configForwardLiveUrl)) { liveForwardUrl = configForwardLiveUrl; } if (!string.IsNullOrEmpty(configForwardTestUrl)) { testForwardUrl = configForwardTestUrl; } var securityKey = paymentProvider.GetSetting("SecurityKey"); var postUrl = paymentProvider.TestMode ? testUrl : liveUrl; var forwardUrl = paymentProvider.TestMode ? testForwardUrl : liveForwardUrl; var amount = paymentProvider.TestMode ? testAmount : orderInfo.ChargedAmountInCents.ToString(); var orderId = orderInfo.OrderNumber; if (orderId.Length > 32) { Log.Instance.LogError("OmniKassa: orderInfo.OrderNumber: Too Long, Max 32 Characters! orderInfo.OrderNumber: " + orderInfo.OrderNumber); orderId = orderInfo.OrderNumber.Substring(0, 31); } var transactionId = orderId + "x" + DateTime.Now.ToString("hhmmss"); var rgx = new Regex("[^a-zA-Z0-9]"); transactionId = rgx.Replace(transactionId, ""); if (transactionId.Length > 35) { Log.Instance.LogError("OmniKassa: uniqueId (orderId + 'x' + DateTime.Now.ToString('hhmmss')): Too Long, Max 35 Characters! uniqueId: " + transactionId); transactionId = transactionId.Substring(0, 34); } if (reportUrl.Length > 512) { Log.Instance.LogError("OmniKassa: reportUrl: Too Long, Max 512 Characters! reportUrl: " + reportUrl); } // Data-veld samenstellen var data = string.Format("merchantId={0}", merchantId) + string.Format("|orderId={0}", orderId) + string.Format("|amount={0}", amount) + string.Format("|customerLanguage={0}", "NL") + string.Format("|keyVersion={0}", keyVersion) + string.Format("|currencyCode={0}", currencyCode) // + string.Format("|PaymentMeanBrandList={0}", "IDEAL") + string.Format("|normalReturnUrl={0}", reportUrl) + string.Format("|automaticResponseUrl={0}", reportUrl) + string.Format("|transactionReference={0}", transactionId); // Seal-veld berekenen var sha256 = SHA256.Create(); var hashValue = sha256.ComputeHash(new UTF8Encoding().GetBytes(data + securityKey)); // POST data samenstellen var postData = new NameValueCollection {{"Data", data}, {"Seal", ByteArrayToHexString(hashValue)}, {"InterfaceVersion", "HP_1.0"}}; //// Posten van data byte[] response; using (var client = new WebClient()) response = client.UploadValues(postUrl, postData); try { var responseData = Encoding.UTF8.GetString(response); var trimmedResponse = responseData.Trim(); var matchedHiddenfield = Regex.Matches(trimmedResponse, "<input type=HIDDEN.+/>", RegexOptions.IgnoreCase | RegexOptions.Multiline); var postValueFromHiddenField = Regex.Matches(matchedHiddenfield[0].Value, "(?<=\\bvalue=\")[^\"]*", RegexOptions.IgnoreCase | RegexOptions.Multiline); var redirectionDataField = string.Format("redirectionData={0}", postValueFromHiddenField[0].Value); PaymentProviderHelper.SetTransactionId(orderInfo, transactionId); orderInfo.PaymentInfo.Url = forwardUrl; orderInfo.PaymentInfo.Parameters = redirectionDataField; orderInfo.Save(); var request = new PaymentRequest(); return request; } catch { var responseResult = Encoding.UTF8.GetString(response); Log.Instance.LogError("Omnikassa: " + responseResult); throw new Exception("OmniKassa Issue Please Notice Shopowner"); } }
public StringBuilder SubmitTransaction(PaymentRequest PaymentRequest) { OrderItemInfo oii = OrderItemInfoProvider.GetOrderItemInfo(ShoppingCart.GetShoppingCartItem(ShoppingCart.CartItems[0].CartItemGUID)); StringBuilder builder = new StringBuilder(); builder.AppendLine("<?xml version='1.0' encoding='UTF-8'?>"); builder.AppendLine("<!DOCTYPE paymentService PUBLIC '-//WorldPay/DTD WorldPay PaymentService v1//EN' 'http://dtd.worldpay.com/paymentService_v1.dtd'>"); builder.AppendLine("<paymentService version='1.4' merchantCode='" + PaymentRequest.MerchantCode + "'>"); builder.AppendLine("<submit>"); builder.AppendLine(string.Concat(new object[] { "<order orderCode='", PaymentRequest.OrderCode, "'>" })); builder.AppendLine("<description>" + txtTitle.Text + " " + TxtCustomerName.Text + " " + txtCustomerSurname.Text + ", " + oii.OrderItemSKUName + ", Gift Aid=" + gift_aid.Checked.ToString() + "</description>"); builder.AppendLine(string.Concat(new object[] { "<amount value='", PaymentRequest.amount, "' currencyCode='", PaymentRequest.currencyCode, "' exponent='2'/>" })); builder.AppendLine("<orderContent>"); builder.AppendLine("<![CDATA[ordercontent]]>"); builder.AppendLine("</orderContent>"); builder.AppendLine("<paymentMethodMask>"); builder.AppendLine("<include code=\"ALL\"/>"); builder.AppendLine("</paymentMethodMask>"); builder.AppendLine("<shopper>"); builder.AppendLine("<shopperEmailAddress>" + PaymentRequest.shopperEmailAddress + "</shopperEmailAddress>"); builder.AppendLine("</shopper>"); //builder.AppendLine("<shippingAddress><address><firstName></firstName><lastName></lastName><address1></address1><address2></address2><address3></address3><postalCode></postalCode><city></city>test<state></state><countryCode>UK</countryCode><telephoneNumber></telephoneNumber></address></shippingAddress>"); builder.AppendLine("</order>"); builder.AppendLine("</submit>"); builder.AppendLine("</paymentService>"); return builder; }
void ListenerCallback(IAsyncResult ar) { try { var context = _Listener.EndGetContext(ar); var type = context.Request.QueryString.Get("type"); var businessId = int.Parse(context.Request.QueryString.Get("id")); if(type == "Request") { Assert.Equal(PaymentRequest.MediaType, context.Request.AcceptTypes[0]); context.Response.ContentType = PaymentRequest.MediaType; PaymentRequest request = new PaymentRequest(); request.Details.MerchantData = BitConverter.GetBytes(businessId); request.Details.PaymentUrl = new Uri(_Prefix + "?id=" + businessId + "&type=Payment"); request.Sign(File.ReadAllBytes("data/NicolasDorierMerchant.pfx"), PKIType.X509SHA256); request.WriteTo(context.Response.OutputStream); } else if(type == "Payment") { Assert.Equal(PaymentMessage.MediaType, context.Request.ContentType); Assert.Equal(PaymentACK.MediaType, context.Request.AcceptTypes[0]); var payment = PaymentMessage.Load(context.Request.InputStream); Assert.Equal(businessId, BitConverter.ToInt32(payment.MerchantData, 0)); context.Response.ContentType = PaymentACK.MediaType; var ack = payment.CreateACK(); ack.WriteTo(context.Response.OutputStream); } else Assert.False(true, "Impossible"); context.Response.Close(); _Listener.BeginGetContext(ListenerCallback, null); } catch(Exception) { if(!_Stopped) throw; } }
public void OnPaymentResult(PaymentRequest p0, PaymentRequestResult p1) { PaymentResult?.Invoke(p0, p1); }
public IActionResult AddPaymentRequest(PaymentRequest request) { RequestQueue.Enqueue(request); Console.WriteLine($"+++ PaymentRequest: {request.PublicPaymentId}"); return(Ok()); }
private static void CanCreatePaymentRequestCore(object cert) { var request = new PaymentRequest(); request.Details.Memo = "hello"; request.Sign(cert, PKIType.X509SHA256); Assert.NotNull(request.MerchantCertificate); #if WIN Assert.False(new X509Certificate2(request.MerchantCertificate, "", X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable).HasPrivateKey); #endif Assert.True(request.VerifySignature()); Assert.False(request.VerifyChain()); AssertEx.CollectionEquals(request.ToBytes(), PaymentRequest.Load(request.ToBytes()).ToBytes()); Assert.True(PaymentRequest.Load(request.ToBytes()).VerifySignature()); }
/// <summary> /// Creates a payment request for this payment provider /// </summary> /// <param name="orderInfo"> </param> /// <returns>Payment request</returns> public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias); #region build urls var baseUrl = PaymentProviderHelper.GenerateBaseUrl(); var returnUrl = paymentProvider.SuccessUrl(); var reportUrl = paymentProvider.ReportUrl(); #endregion #region config helper var accountId = paymentProvider.GetSetting("AccountId"); var liveUrl = "https://www.paypal.com/cgi-bin/webscr"; var testUrl = "https://www.sandbox.paypal.com/us/cgi-bin/webscr"; var configLiveUrl = paymentProvider.GetSetting("Url"); var configTestUrl = paymentProvider.GetSetting("testUrl"); if (!string.IsNullOrEmpty(configLiveUrl)) { liveUrl = configLiveUrl; } if (!string.IsNullOrEmpty(configTestUrl)) { testUrl = configTestUrl; } #endregion var trasactionId = orderInfo.OrderNumber + "x" + DateTime.Now.ToString("hhmmss"); var request = new PaymentRequest(); request.Parameters.Add("cmd", "_xclick"); // retrieve Account ID request.Parameters.Add("business", accountId); //request.Parameters.Add("invoice", order.OrderInfo.OrderNumber.ToString()); request.Parameters.Add("invoice", orderInfo.OrderNumber); var ci = new CultureInfo("en-US"); var totalAmountAsString = orderInfo.ChargedAmount.ToString("N", ci); request.Parameters.Add("amount", totalAmountAsString); request.Parameters.Add("tax_cart", totalAmountAsString); request.Parameters.Add("no_note", "0"); var ri = new RegionInfo(orderInfo.StoreInfo.Store.CurrencyCultureInfo.LCID); request.Parameters.Add("currency_code", ri.ISOCurrencySymbol); request.Parameters.Add("lc", orderInfo.StoreInfo.CultureInfo.TwoLetterISOLanguageName); request.Parameters.Add("return", returnUrl); request.Parameters.Add("shopping_url", baseUrl); request.Parameters.Add("notify_url", reportUrl); #region testmode if (paymentProvider.TestMode) { request.Parameters.Add("cn", "Test"); } #endregion // Order as shown with PayPal request.Parameters.Add("item_name", orderInfo.OrderNumber); // Set GUID to identify order in SSWS // Sent GUID for identification to PayPal // PayPal will return custom value to validate order request.Parameters.Add("custom", trasactionId); // check if provider is in testmode to send request to right URL request.PaymentUrlBase = paymentProvider.TestMode ? testUrl : liveUrl; PaymentProviderHelper.SetTransactionId(orderInfo, trasactionId); orderInfo.PaymentInfo.Url = request.PaymentUrl; orderInfo.PaymentInfo.Parameters = request.ParametersAsString; return request; }
public PaymentMessage(PaymentRequest request) { this.MerchantData = request.Details.MerchantData; }
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { try { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id); var reportUrl = paymentProvider.ReportUrl(); //Use https://idealtest.secure-ing.com/ideal/iDEALv3 during integration/test //Use https://ideal.secure-ing.com/ideal/iDEALv3 only for production // <provider title="IngAdvanced"> // <IssuerId>1111111</IssuerId> // <MerchantId>1111111</MerchantId> // <EntranceCode>22222222</EntranceCode> // </provider> var issuerId = orderInfo.PaymentInfo.MethodId; var merchantId = paymentProvider.GetSetting("MerchantId"); var entranceCode = paymentProvider.GetSetting("EntranceCode"); var transaction = new Transaction { Amount = orderInfo.ChargedAmount, Description = orderInfo.OrderNumber, PurchaseId = orderInfo.OrderNumber, IssuerId = issuerId, EntranceCode = entranceCode }; var connector = new Connector { MerchantReturnUrl = new Uri(reportUrl), MerchantId = merchantId, SubId = "0", ExpirationPeriod = "PT10M" }; transaction = connector.RequestTransaction(transaction); if (transaction.Status == Transaction.TransactionStatus.Success) { var transactionId = transaction.Id; var authenticateUrl = transaction.IssuerAuthenticationUrl.ToString(); var acquirerId = transaction.AcquirerId; PaymentProviderHelper.SetTransactionId(orderInfo, transactionId); orderInfo.PaymentInfo.Url = authenticateUrl; orderInfo.PaymentInfo.Parameters = acquirerId; orderInfo.Save(); } else { // todo: failure handling, so don't change anything, user will not be redirected } } catch (IDealException ex) { Log.Instance.LogError("ING Advanced PaymentRequestHander: " + ex); } var request = new PaymentRequest(); return request; }
private NameValueCollection BuildPostData(PaymentRequest paymentRequest) { NameValueCollection postData = new NameValueCollection(); // Now to build the Direct POST. For more details see the Direct Protocol 2.22. // NB: Fields potentially containing non ASCII characters are URLEncoded when included in the POST postData["VPSProtocol"] = _vpsProtocol; postData["TxType"] = GetTransactionType(paymentRequest.TransactionType); postData["Vendor"] = _vendorName; postData["VendorTxCode"] = paymentRequest.TransactionCode; postData["Amount"] = paymentRequest.Amount.ToString("F2"); // Formatted to 2 decimal places with leading digit but no commas or currency symbols postData["Currency"] = _currency; if (!string.IsNullOrEmpty(paymentRequest.Description)) postData["Description"] = paymentRequest.Description.Left(100); // Up to 100 chars of free format description postData["CardHolder"] = paymentRequest.Card.NameOnCard; postData["CardNumber"] = paymentRequest.CardNumber; if (paymentRequest.Card.ValidFrom != null) postData["StartDate"] = paymentRequest.Card.ValidFrom.Value.ToString("MMyy"); postData["ExpiryDate"] = paymentRequest.Card.ValidTo.ToString("MMyy"); if (!string.IsNullOrEmpty(paymentRequest.Card.IssueNumber)) postData["IssueNumber"] = paymentRequest.Card.IssueNumber; postData["CV2"] = paymentRequest.CardSecurityCode; postData["CardType"] = GetCardType(paymentRequest.Card.CardType); postData["BillingSurname"] = paymentRequest.BillingAddress.Surname; postData["BillingFirstnames"] = paymentRequest.BillingAddress.FirstName; postData["BillingAddress1"] = paymentRequest.BillingAddress.AddressLine1; if (!string.IsNullOrEmpty(paymentRequest.BillingAddress.AddressLine2)) postData["BillingAddress2"] = paymentRequest.BillingAddress.AddressLine2; postData["BillingCity"] = paymentRequest.BillingAddress.TownCity; postData["BillingPostCode"] = paymentRequest.BillingAddress.Postcode; if (paymentRequest.BillingAddress.Country.Title == "United States") { postData["BillingState"] = paymentRequest.BillingAddress.StateRegion; } if (paymentRequest.BillingAddress.Country != null) postData["BillingCountry"] = paymentRequest.BillingAddress.Country.Alpha2; else postData["BillingCountry"] = "GB"; postData["DeliverySurname"] = paymentRequest.ShippingAddress.Surname; postData["DeliveryFirstnames"] = paymentRequest.ShippingAddress.FirstName; postData["DeliveryAddress1"] = paymentRequest.ShippingAddress.AddressLine1; if (!string.IsNullOrEmpty(paymentRequest.ShippingAddress.AddressLine2)) postData["DeliveryAddress2"] = paymentRequest.ShippingAddress.AddressLine2; postData["DeliveryCity"] = paymentRequest.ShippingAddress.TownCity; postData["DeliveryPostCode"] = paymentRequest.ShippingAddress.Postcode; if (paymentRequest.ShippingAddress.Country != null) postData["DeliveryCountry"] = paymentRequest.ShippingAddress.Country.Alpha2; else postData["DeliveryCountry"] = "GB"; if (!string.IsNullOrEmpty(paymentRequest.TelephoneNumber)) postData["DeliveryPhone"] = paymentRequest.TelephoneNumber; if (paymentRequest.ShippingAddress.Country.Title == "United States") { postData["DeliveryState"] = paymentRequest.ShippingAddress.StateRegion; } postData["CustomerEMail"] = paymentRequest.EmailAddress; // postData["Basket"] = FormatBasket(paymentRequest); // TODO // Allow fine control over AVS/CV2 checks and rules by changing this value. 0 is Default. // It can be changed dynamically, per transaction, if you wish. See the Direct Protocol document. postData["ApplyAVSCV2"] = "0"; // Send the IP address of the person entering the card details. postData["ClientIPAddress"] = paymentRequest.ClientIpAddress; // Allow fine control over 3D-Secure checks and rules by changing this value. 0 is Default. // It can be changed dynamically, per transaction, if you wish. See the Direct Protocol document. postData["Apply3DSecure"] = "0"; // Send the account type to be used for this transaction. Web sites should us E for e-commerce // If you are developing back-office applications for Mail Order/Telephone order, use M // If your back office application is a subscription system with recurring transactions, use C // Your Sage Pay account MUST be set up for the account type you choose. If in doubt, use E. postData["AccountType"] = "E"; return postData; }
public override string RenderPage(PaymentRequest paymentRequest) { throw new NotImplementedException("SagePay provider doesn't need a form post for integration."); }
public override string RenderPage(PaymentRequest paymentRequest) { throw new NotSupportedException("EWay does not need a local form. Use RequestPayment instead."); }
public async Task <string> GenerateCart(HttpClient client) { //var baseUrl = "https://sandbox-api-pay.line.me"; var baseUrl = "https://api-pay.line.me"; var requestUrl = "/v3/payments/request"; var channelId = "1653957456"; var channelSecret = "c35bfea4d5ae857d9f1c15614c48e935"; var nonce = Guid.NewGuid().ToString(); var product = new PaymentRequest { Amount = 0.02, Currency = "THB", OrderId = Guid.NewGuid().ToString(), Packages = new Package[] { new Package { Id = "1", Amount = 0.02, Products = new Product[] { new Product { Id = "PENB001", Name = "Pen Brown", ImageUrl = "https://droidsans.com/wp-content/uploads/2020/01/line4.jpg", Price = 0.01, Quantity = 2 } } } }, RedirectUrls = new RedirectUrl { ConfirmUrlType = "SERVER", ConfirmUrl = "https://linepaymentapi.herokuapp.com/api/payment/authorize", CancelUrl = "https://pay-store.line.com/order/payment/cancel" } }; var payload = JsonSerializer.Serialize(product, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, }); var data = channelSecret + requestUrl + payload + nonce; var hashHMAC = HashHMAC(channelSecret, data); client.DefaultRequestHeaders.Add("X-LINE-ChannelId", channelId); client.DefaultRequestHeaders.Add("X-LINE-Authorization-Nonce", nonce); client.DefaultRequestHeaders.Add("X-LINE-Authorization", Convert.ToBase64String(hashHMAC)); var stringContent = new StringContent(payload, Encoding.UTF8, "application/json"); var res = await client.PostAsync(baseUrl + requestUrl, stringContent); var payment = JsonSerializer.Deserialize <PaymentResponse>(await res.Content.ReadAsStringAsync(), new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, }); return($"https://chart.apis.google.com/chart?cht=qr&chs=500x500&chl={payment.Info.PaymentUrl.App}"); }
public void RequestPayment(PaymentRequest paymentRequest) { SharpConnectionHelperSingleton.Instance.RequestPayment(paymentRequest); }
/// <summary> /// /// </summary> /// <param name="payment"></param> /// <returns></returns> public static IDictionary <string, string> GetData(PaymentRequest payment) { IDictionary <string, string> data = new Dictionary <string, string>(); // reference if (payment.Reference != null) { data["reference"] = payment.Reference; } // sender if (payment.Sender != null) { if (payment.Sender.Name != null) { data["senderName"] = payment.Sender.Name; } if (payment.Sender.Email != null) { data["senderEmail"] = payment.Sender.Email; } // phone if (payment.Sender.Phone != null) { if (payment.Sender.Phone.AreaCode != null) { data["senderAreaCode"] = payment.Sender.Phone.AreaCode; } if (payment.Sender.Phone.Number != null) { data["senderPhone"] = payment.Sender.Phone.Number; } } // documents if (payment.Sender.Documents != null) { var documents = payment.Sender.Documents; if (documents.Count == 1) { foreach (SenderDocument document in documents) { if (document != null) { if (document.Type.Equals("Cadastro de Pessoa Física")) { data["senderCPF"] = document.Value; } else { data["senderCNPJ"] = document.Value; } } } } } } // currency if (payment.Currency != null) { data["currency"] = payment.Currency; } // items if (payment.Items.Count > 0) { var items = payment.Items; int i = 0; foreach (Item item in items) { i++; if (item.Id != null) { data["itemId" + i] = item.Id; } if (item.Description != null) { data["itemDescription" + i] = item.Description; } if (item.Quantity != null) { data["itemQuantity" + i] = item.Quantity.ToString(); } if (item.Amount != null) { data["itemAmount" + i] = PagSeguroUtil.DecimalFormat(item.Amount); } if (item.Weight != null) { data["itemWeight" + i] = item.Weight.ToString(); } if (item.ShippingCost != null) { data["itemShippingCost" + i] = PagSeguroUtil.DecimalFormat((decimal)item.ShippingCost); } } } //preApproval if (payment.PreApproval != null) { data["preApprovalCharge"] = payment.PreApproval.Charge; data["preApprovalName"] = payment.PreApproval.Name; data["preApprovalDetails"] = payment.PreApproval.Details; data["preApprovalPeriod"] = payment.PreApproval.Period; data["preApprovalFinalDate"] = payment.PreApproval.FinalDate.ToString("yyyy-MM-dd") + "T01:00:00.45-03:00"; data["preApprovalMaxTotalAmount"] = payment.PreApproval.MaxTotalAmount.ToString("F").Replace(",", "."); data["preApprovalAmountPerPayment"] = payment.PreApproval.AmountPerPayment.ToString("F").Replace(",", "."); if (payment.PreApproval.Charge == Charge.Manual) { data["preApprovalInitialDate"] = payment.PreApproval.InitialDate.ToString("yyyy-MM-dd") + "T01:00:00.45-03:00"; data["preApprovalMaxAmountPerPeriod"] = payment.PreApproval.MaxAmountPerPeriod.ToString("F").Replace(",", "."); data["preApprovalMaxPaymentsPerPeriod"] = payment.PreApproval.MaxPaymentsPerPeriod.ToString(); if (payment.PreApproval.Period == Period.Yearly) { data["preApprovalDayOfYear"] = payment.PreApproval.DayOfYear.ToString(); } if (payment.PreApproval.Period == Period.Monthly || payment.PreApproval.Period == Period.Bimonthly || payment.PreApproval.Period == Period.Trimonthly || payment.PreApproval.Period == Period.SemiAnnually) { data["preApprovalDayOfMonth"] = payment.PreApproval.DayOfMonth.ToString(); } if (payment.PreApproval.Period == Period.Weekly) { data["preApprovalDayOfWeek"] = payment.PreApproval.DayOfWeek.ToString(); } } data["reviewUrl"] = payment.ReviewUri.ToString(); } //preApproval payment if (payment.PreApprovalCode != null) { data["preApprovalCode"] = payment.PreApprovalCode; } // extraAmount if (payment.ExtraAmount != null) { data["extraAmount"] = PagSeguroUtil.DecimalFormat((decimal)payment.ExtraAmount); } // shipping if (payment.Shipping != null) { if (payment.Shipping.ShippingType != null && payment.Shipping.ShippingType.Value != null) { data["shippingType"] = payment.Shipping.ShippingType.Value.ToString(); } if (payment.Shipping.Cost != null) { data["shippingCost"] = PagSeguroUtil.DecimalFormat((decimal)payment.Shipping.Cost); } // address if (payment.Shipping.Address != null) { if (payment.Shipping.Address.Street != null) { data["shippingAddressStreet"] = payment.Shipping.Address.Street; } if (payment.Shipping.Address.Number != null) { data["shippingAddressNumber"] = payment.Shipping.Address.Number; } if (payment.Shipping.Address.Complement != null) { data["shippingAddressComplement"] = payment.Shipping.Address.Complement; } if (payment.Shipping.Address.City != null) { data["shippingAddressCity"] = payment.Shipping.Address.City; } if (payment.Shipping.Address.State != null) { data["shippingAddressState"] = payment.Shipping.Address.State; } if (payment.Shipping.Address.District != null) { data["shippingAddressDistrict"] = payment.Shipping.Address.District; } if (payment.Shipping.Address.PostalCode != null) { data["shippingAddressPostalCode"] = payment.Shipping.Address.PostalCode; } if (payment.Shipping.Address.Country != null) { data["shippingAddressCountry"] = payment.Shipping.Address.Country; } } } // maxAge if (payment.MaxAge != null) { data["maxAge"] = payment.MaxAge.ToString(); } // maxUses if (payment.MaxUses != null) { data["maxUses"] = payment.MaxUses.ToString(); } // redirectURL if (payment.RedirectUri != null) { data["redirectURL"] = payment.RedirectUri.ToString(); } // notificationURL if (payment.NotificationURL != null) { data["notificationURL"] = payment.NotificationURL; } // metadata if (payment.MetaData.Items.Count > 0) { int i = 0; var metaDataItems = payment.MetaData.Items; foreach (MetaDataItem item in metaDataItems) { if (!PagSeguroUtil.IsEmpty(item.Key) && !PagSeguroUtil.IsEmpty(item.Value)) { i++; data["metadataItemKey" + i] = item.Key; data["metadataItemValue" + i] = item.Value; if (item.Group != null) { data["metadataItemGroup" + i] = item.Group.ToString(); } } } } // parameter if (payment.Parameter.Items.Count > 0) { var parameterItems = payment.Parameter.Items; foreach (ParameterItem item in parameterItems) { if (!PagSeguroUtil.IsEmpty(item.Key) && !PagSeguroUtil.IsEmpty(item.Value)) { if (item.Group != null) { data[item.Key + "" + item.Group] = item.Value; } else { data[item.Key] = item.Value; } } } } // paymentMethodConfig if (payment.PaymentMethodConfig.Items.Count > 0) { int i = 0; var configItems = payment.PaymentMethodConfig.Items; foreach (PaymentMethodConfigItem item in configItems) { if (!PagSeguroUtil.IsEmpty(item.Key) && !PagSeguroUtil.IsEmpty(item.Group)) { i++; data["paymentMethodGroup" + i] = item.Group; data["paymentMethodConfigKey" + i + "_1"] = item.Key; if (item.Key.Equals(PaymentMethodConfigKeys.DiscountPercent)) { data["paymentMethodConfigValue" + i + "_1"] = PagSeguroUtil.DecimalFormat(item.Value); } else { data["paymentMethodConfigValue" + i + "_1"] = PagSeguroUtil.DoubleToInt(item.Value); } } } } // paymentMethodConfig if (payment.AcceptedPaymentMethods.Items.Count > 0) { var acceptGroupList = new List <string>(); var acceptNameList = new List <string>(); var excludeGroupList = new List <string>(); var excludeNameList = new List <string>(); var config = payment.AcceptedPaymentMethods.Items; foreach (AcceptedPayments item in config) { if (item.GetType() == typeof(AcceptPaymentMethod)) { if (!acceptGroupList.Contains(item.Group)) { acceptGroupList.Add(item.Group); } if (item.Name != null && item.Name.Any()) { acceptNameList = item.Name; } } if (item.GetType() == typeof(ExcludePaymentMethod)) { if (!excludeGroupList.Contains(item.Group)) { excludeGroupList.Add(item.Group); } if (item.Name != null && item.Name.Any()) { excludeNameList = item.Name; } } } if (acceptGroupList.Count > 0 && acceptNameList.Count > 0) { data["acceptPaymentMethodGroup"] = String.Join(",", acceptGroupList.ToArray()); data["acceptPaymentMethodName"] = String.Join(",", acceptNameList.ToArray()); } if (excludeGroupList.Count > 0 && excludeNameList.Count > 0) { data["excludePaymentMethodGroup"] = String.Join(",", excludeGroupList.ToArray()); data["excludePaymentMethodName"] = String.Join(",", excludeNameList.ToArray()); } } return(data); }
public ActionResult <string> Post([FromBody] PaymentRequest request) { return("Completed"); }
public PaymentRequest CreatePaymentRequest(OrderInfo orderInfo) { var paymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias); var returnUrl = paymentProvider.SuccessUrl(); var cancelUrl = paymentProvider.ErrorUrl(); var reportUrl = paymentProvider.ReportUrl(); #region config helper var apiURL = "https://www.sisow.nl/Sisow/iDeal/RestHandler.ashx/TransactionRequest"; var transactionUrl = paymentProvider.GetSetting("TransactionRequestUrl"); if (!string.IsNullOrEmpty(transactionUrl)) { apiURL = paymentProvider.GetSetting("TransactionRequestUrl"); } var merchantId = paymentProvider.GetSetting("merchantid"); var merchantKey = paymentProvider.GetSetting("merchantkey"); #endregion var request = new PaymentRequest(); var orderGuidAsString = orderInfo.UniqueOrderId.ToString(); var transactionId = orderGuidAsString.Substring(0, 16); request.Parameters.Add("shopid", "001"); request.Parameters.Add("merchantid", merchantId); request.Parameters.Add("payment", string.Empty); // character purchase ID (max 16 characters) request.Parameters.Add("purchaseid", transactionId); var totalAmountInCents = orderInfo.ChargedAmountInCents; request.Parameters.Add("amount", totalAmountInCents.ToString()); request.Parameters.Add("issuerid", orderInfo.PaymentInfo.MethodId); request.Parameters.Add("testmode", paymentProvider.TestMode.ToString()); request.Parameters.Add("entrancecode", orderInfo.OrderNodeId.ToString()); request.Parameters.Add("description", orderInfo.OrderNumber); request.Parameters.Add("returnurl", returnUrl); request.Parameters.Add("cancelurl", cancelUrl); request.Parameters.Add("callbackurl", reportUrl); request.Parameters.Add("notifyurl", reportUrl); #region esend //request.Parameters.Add("shipping_firstname", "#todo - optional"); //request.Parameters.Add("shipping_lastname", "#todo"); //request.Parameters.Add("shipping_mail", "#todo - optional"); //request.Parameters.Add("shipping_company", "#todo - optional"); //request.Parameters.Add("shipping_address1", "#todo"); //request.Parameters.Add("shipping_address2", "#todo - optional"); //request.Parameters.Add("shipping_zip", "#todo"); //request.Parameters.Add("shipping_city", "#todo"); //request.Parameters.Add("shipping_country", "#todo"); //request.Parameters.Add("shipping_countrycode", "#todo"); //request.Parameters.Add("shipping_phone", "#todo -optional"); //request.Parameters.Add("weight", "#todo -optional"); //request.Parameters.Add("shipping", "#todo -optional"); //request.Parameters.Add("handling", "#todo -optional"); #endregion //de SHA1 waarde van purchaseid/entrancecode/amount/shopid/merchantid/merchantkey var sha1Hash = GetSHA1(transactionId + orderInfo.OrderNodeId.ToString() + totalAmountInCents.ToString() + "001" + merchantId + merchantKey); request.Parameters.Add("sha1", sha1Hash); request.PaymentUrlBase = apiURL; var responseString = _requestSender.SendRequest(request.PaymentUrlBase, request.ParametersAsString); XNamespace ns = "https://www.sisow.nl/Sisow/REST"; if (responseString == null) { Log.Instance.LogError("SiSow responseString == null orderInfo.UniqueOrderId: " + orderInfo.UniqueOrderId); return null; } Log.Instance.LogDebug("SiSow responseString: " + responseString + ", paymentProviderNodeId: " + paymentProvider.Id); var issuerXml = XDocument.Parse(responseString); var url = issuerXml.Descendants(ns + "issuerurl").FirstOrDefault(); var trxId = issuerXml.Descendants(ns + "trxid").FirstOrDefault(); var decodeUrl = Uri.UnescapeDataString(url.Value); if (trxId == null) { Log.Instance.LogError("SiSow issuerXml: " + issuerXml + ", paymentProviderNodeId: " + paymentProvider.Id); return null; } var returnedTransactionId = trxId.Value; orderInfo.PaymentInfo.Url = decodeUrl; orderInfo.PaymentInfo.TransactionId = returnedTransactionId; PaymentProviderHelper.SetTransactionId(orderInfo, returnedTransactionId); orderInfo.Save(); return null; }