本文整理汇总了C#中OrderInfo.Save方法的典型用法代码示例。如果您正苦于以下问题:C# OrderInfo.Save方法的具体用法?C# OrderInfo.Save怎么用?C# OrderInfo.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderInfo
的用法示例。
在下文中一共展示了OrderInfo.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo orderInfo)
{
var orderId = HttpContext.Current.Request.QueryString["orderid"] ?? "";
if (paymentProvider == null || string.IsNullOrEmpty(orderId))
{
return null;
}
orderInfo = OrderHelper.GetOrder(orderId);
if (orderInfo != null)
{
var localizedPaymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias);
var secret = paymentProvider.GetSetting("secret");
var amount = HttpContext.Current.Request.QueryString["amount"] ?? "0";
var validated = true;
if (secret != string.Empty)
{
var sb = new StringBuilder();
foreach (var key in HttpContext.Current.Request.QueryString.AllKeys)
{
if (key != "hash")
{
sb.Append(HttpContext.Current.Request.QueryString[key]);
}
}
var calculated = ePayPaymentBase.MD5(sb.ToString() + secret).ToUpperInvariant();
var incoming = (HttpContext.Current.Request.QueryString["hash"] ?? "").ToUpperInvariant();
validated = calculated == incoming;
if (!validated)
{
//checksum error
Log.Instance.LogError("Payment provider (ePay) error : Orderid " + orderId + " - incoming hash " + incoming + " - calculated hash " + calculated);
}
}
if (validated && (amount == orderInfo.ChargedAmountInCents.ToString()))
{
orderInfo.Paid = true;
orderInfo.Status = OrderStatus.ReadyForDispatch;
orderInfo.Save();
}
else
{
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.Save();
if (validated)
{
//checksum already logged, must be problem with amount
Log.Instance.LogError("Payment provider (ePay) error : Orderid " + orderId + " - incoming amount " + amount.ToString() + " - order amount " + orderInfo.ChargedAmountInCents.ToString());
}
}
}
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("OK");
HttpContext.Current.Response.Flush();
return orderInfo;
}
示例2: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo order)
{
order.Paid = true;
order.Status = OrderStatus.ReadyForDispatch;
order.Save();
// if success then succes, otherwise error (todo)
order.RedirectUrl = paymentProvider.SuccessUrl();
return order;
}
示例3: CreatePaymentRequest
/// <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 returnUrl = paymentProvider.SuccessUrl();
var reportUrl = paymentProvider.ReportUrl();
var testMode = paymentProvider.TestMode; //currently we don't have a testmode for easy-ideal this var is unused
#endregion
#region config helper
var merchantId = paymentProvider.GetSetting("merchantId");
var merchantKey = paymentProvider.GetSetting("merchantKey");
var merchantSecret = paymentProvider.GetSetting("merchantSecret");
var url = paymentProvider.GetSetting("url");
#endregion
var args = new SortedList<string, string>();
var ci = new CultureInfo("en-US");
args.Add("Amount", orderInfo.ChargedAmount.ToString("G", ci));
args.Add("Currency", "EUR");
args.Add("Bank", orderInfo.PaymentInfo.MethodId);
args.Add("Description", orderInfo.OrderNumber);
args.Add("Return", reportUrl);
var xmlRequest = GetXml(IDEAL_EXECUTE, args, merchantId, merchantKey, merchantSecret);
XDocument xmlResponse = XDocument.Parse(PostXml(xmlRequest, url));
var responseStatus = xmlResponse.Element("Response").Element("Status").FirstNode.ToString();
var transactionId = xmlResponse.Element("Response").Element("Response").Element("TransactionID").FirstNode.ToString();
var transactionCode = xmlResponse.Element("Response").Element("Response").Element("Code").FirstNode.ToString();
var bankUrl = HttpUtility.HtmlDecode(xmlResponse.Element("Response").Element("Response").Element("BankURL").FirstNode.ToString());
orderInfo.PaymentInfo.Url = bankUrl;
PaymentProviderHelper.SetTransactionId(orderInfo, transactionId); //transactionCode hierin verwerken??
//IO.Container.Resolve<IOrderUpdatingService>().AddCustomerFields(order, new Dictionary<string, string>({ "extraBilling", value }), CustomerDatatypes.Extra);
orderInfo.AddCustomerFields(new Dictionary<string, string> { { "extraTransactionCode", transactionCode } }, Common.CustomerDatatypes.Extra);
orderInfo.Save();
return new PaymentRequest();
}
示例4: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo orderInfo)
{
// Check for match
if (orderInfo != null && orderInfo.Paid == false)
{
if (!string.IsNullOrEmpty(orderInfo.PaymentInfo.Parameters))
{
var status = orderInfo.PaymentInfo.Parameters.Split('&')[0];
var message = orderInfo.PaymentInfo.Parameters.Split('&')[1];
// Get statusses from payment provider Response
switch (status.ToUpperInvariant())
{
case "OK":
orderInfo.Paid = true;
orderInfo.Status = OrderStatus.ReadyForDispatch;
break;
case "MALFORMED":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = message;
Log.Instance.LogError("SagePay Payment Error: " + message);
break;
case "INVALID":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = message;
Log.Instance.LogError("SagePay Payment Error: " + message);
break;
case "ERROR":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.Incomplete;
orderInfo.PaymentInfo.ErrorMessage = message;
Log.Instance.LogError("SagePay Payment Error: " + message);
break;
}
}
orderInfo.Save();
}
return orderInfo;
}
示例5: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo order)
{
var transactionId = HttpContext.Current.Request["trxid"];
if (string.IsNullOrEmpty(transactionId))
{
Log.Instance.LogDebug("IngAdvanced IPaymentResponseHandler transactionId == null");
return null;
}
if (order == null)
{
order = OrderHelper.GetOrder(transactionId);
}
if (order != null)
{
var status = RequestTransactionStatus(transactionId, order);
switch (status)
{
case Transaction.TransactionStatus.Success:
order.Paid = true;
order.Status = OrderStatus.ReadyForDispatch;
break;
case Transaction.TransactionStatus.Open:
order.Status = OrderStatus.WaitingForPaymentProvider;
break;
case Transaction.TransactionStatus.Failure:
case Transaction.TransactionStatus.Expired:
case Transaction.TransactionStatus.Cancelled:
order.Paid = false;
order.Status = OrderStatus.PaymentFailed;
order.PaymentInfo.ErrorMessage = status.ToString();
break;
default:
order.Paid = false;
order.Status = OrderStatus.PaymentFailed;
order.PaymentInfo.ErrorMessage = status.ToString();
break;
}
order.Save();
}
return order;
}
示例6: CreateOrder
public OrderInfo CreateOrder(Store store)
{
if (store == null)
{
throw new Exception("Trying to create order without store");
}
if (string.IsNullOrEmpty(store.Alias))
{
throw new Exception("Store without alias. Please (re)publish store and re-index examine External index");
}
var order = new OrderInfo();
order.CreatedInTestMode = store.EnableTestmode;
order.CustomerInfo.CustomerIPAddress = HttpContext.Current.Request.UserHostAddress;
order.ShippingCostsMightBeOutdated = true;
order.VATCheckService = IO.Container.Resolve<IVATCheckService>();
InitializeNewOrder(order);
UseDatabaseDiscounts(order);
order.CustomerInfo.CountryCode = !string.IsNullOrEmpty(store.DefaultCountryCode) ? store.DefaultCountryCode : store.CountryCode;
var currentMember = Membership.GetUser(); // TODO: dip
if (currentMember != null)
{
//uWebshopOrders.SetCustomer(order.UniqueOrderId, currentMember.UserName); heeft toch geen effect (geen row in db)
order.CustomerInfo.LoginName = currentMember.UserName;
if (currentMember.ProviderUserKey != null)
{
//uWebshopOrders.SetCustomerId(order.UniqueOrderId, (int)currentMember.ProviderUserKey); heeft toch geen effect (geen row in db)
order.CustomerInfo.CustomerId = (int)currentMember.ProviderUserKey;
}
}
order.Localization = StoreHelper.CurrentLocalization; // todo clean
order.AddStore(store);
order.Save();
return order;
}
示例7: CreatePaymentRequest
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;
}
示例8: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo orderInfo)
{
var orderId = library.Request("ec");
var transactionId = library.Request("trxid");
var status = library.Request("status");
orderInfo = OrderHelper.GetOrder(transactionId);
if (orderInfo != null && orderInfo.Paid == false)
{
switch (status)
{
case "Success":
orderInfo.Paid = true;
orderInfo.Status = OrderStatus.ReadyForDispatch;
break;
case "Cancelled":
case "Expired":
case "Failure":
case "Reversed":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = status;
break;
case "Open":
case "Pending":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.WaitingForPaymentProvider;
break;
}
orderInfo.Save();
}
else
{
Log.Instance.LogDebug("SISOW ORDERINFO == NULL!!!!");
}
return null;
}
示例9: HandlePaymentResponse
//.........这里部分代码省略.........
HttpContext.Current.Response.Redirect(succesUrl);
HttpContext.Current.Response.End();
}
else
{
redirectUrl = failUrl;
}
//190 Succes: De transactie is geslaagd en de betaling is ontvangen / goedgekeurd. Definitief Ja
//490 Mislukt: De transactie is mislukt. Definitief Nee
//491 Validatie mislukt: De transactie verzoek bevatte fouten en kon niet goed verwerkt worden Definitief Nee
//492 Technische storing: Door een technische storing kon de transactie niet worden afgerond
//Definitief Nee
//690 Afgekeurd: De transactie is afgewezen door de (derde) payment provider. Definitief Nee
//790 In afwachting van invoer: De transactie is in de wacht, terwijl de payment enginge staat te wachten
//op de inbreng van de consument. Tijdelijk Nee
//791 In afwachting van verwerking: De transactie wordt verwerkt. Tijdelijk Nee
//792 In afwachting van de consument: de betaling Engine wacht voor de consument om terug te keren van
//een website van derden, die nodig is om de transactie te voltooien. Tijdelijk Nee
//793 De transactie is onhold.
//Tijdelijk Nee
//890 Geannuleerd door Gebruiker: De transactie is geannuleerd door de klant.
//Definitief Nee
//891 Geannuleerd door Merchant: De merchant heeft de transactie geannuleerd. Definitief Nee
switch (buckarooParams.StatusCode)
{
case "190":
orderInfo.Paid = true;
orderInfo.Status = OrderStatus.ReadyForDispatch;
redirectUrl = succesUrl;
break;
case "490":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Transaction Failed (490) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "491":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Validation Failed (491) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "492":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Technical Failure (492) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "690":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Payment Denied by 3rd Party (690) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "790":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.WaitingForPayment;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Waiting for customer input (790) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "791":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.WaitingForPayment;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Waiting for transaction handling (791) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "792":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.WaitingForPayment;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Waiting for customer to return from 3rd party website (792) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "793":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.WaitingForPayment;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Transaction is On Hold (793) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "890":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.WaitingForPayment;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Transaction Cancelled by Customer (890) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
case "891":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.WaitingForPayment;
redirectUrl = failUrl;
Log.Instance.LogError("Buckaroo ResponseHandler Transaction Cancelled by Merchant (891) for transactionId: " + buckarooParams.TransactionId + " Ordernumber: " + orderInfo.OrderNumber);
break;
}
orderInfo.Save();
HttpContext.Current.Response.Redirect(redirectUrl);
return orderInfo;
}
示例10: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo orderInfo)
{
var transactionId = HttpContext.Current.Request["transactionid"];
if (string.IsNullOrEmpty(transactionId))
{
Log.Instance.LogDebug("MultiSafePay IPaymentResponseHandler transactionId == null");
return null;
}
orderInfo = OrderHelper.GetOrder(transactionId);
if (orderInfo.Paid != false)
{
Log.Instance.LogDebug("MultiSafePay IPaymentResponseHandler Order Already Paid for transactionId: " + transactionId);
return null;
}
var accountId = paymentProvider.GetSetting("accountId");
var siteId = paymentProvider.GetSetting("siteId");
var siteSecureId = paymentProvider.GetSetting("siteSecureId");
var testURL = paymentProvider.GetSetting("testURL");
var liveUrl = paymentProvider.GetSetting("url");
var statusRequest = new StatusRequest
{
AccountId = long.Parse(accountId),
TransactionId = transactionId,
SiteId = long.Parse(siteId),
SiteSecureId = long.Parse(siteSecureId)
};
var apiURL = paymentProvider.TestMode ? testURL : liveUrl;
try
{
var httpWebRequest = (HttpWebRequest) WebRequest.Create(apiURL);
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = Encoding.UTF8.GetByteCount(statusRequest.GetXml());
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream());
streamWriter.Write(statusRequest.GetXml());
streamWriter.Close();
var httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse();
var streamReader = new StreamReader(httpWebResponse.GetResponseStream());
var xmlDoc = XDocument.Parse(streamReader.ReadToEnd());
Log.Instance.LogDebug("MultiSafePay IPaymentResponseHandler XML Answer: " + HttpUtility.HtmlEncode(xmlDoc.ToString(SaveOptions.None)));
var ewallet = xmlDoc.Root.Element("ewallet");
var status = ewallet.Element("status").Value;
orderInfo.Status = OrderStatus.WaitingForPayment;
//– completed: succesvol voltooid
//– initialized: aangemaakt, maar nog niet voltooid
//– uncleared: aangemaakt, maar nog niet vrijgesteld (credit cards)
//– void: geannuleerd
//– declined: afgewezen
//– refunded: terugbetaald
//– expired: verlopen
switch (status)
{
case "completed":
orderInfo.Paid = true;
orderInfo.Status = OrderStatus.ReadyForDispatch;
break;
case "uncleared":
orderInfo.Status = OrderStatus.WaitingForPaymentProvider;
break;
case "declined":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = status;
break;
case "expired":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = status;
break;
case "void":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = status;
break;
}
orderInfo.Save();
}
catch (Exception ex)
{
Log.Instance.LogError("MultiSafePayPaymentResponseHandler.HandlePaymentResponse: " + ex);
}
return orderInfo;
}
示例11: ReloadOrderData
private void ReloadOrderData(OrderInfo order, ILocalization localization)
{
foreach (var line in order.OrderLines)
{
var product = new ProductInfo(_productService.GetById(line.ProductInfo.Id, localization), order, line.ProductInfo.ItemCount.GetValueOrDefault(1));
product.ProductVariants = line.ProductInfo.ProductVariants.Select(variant => new ProductVariantInfo(_productVariantService.GetById(variant.Id, localization), product, line.ProductInfo.ItemCount.GetValueOrDefault(1))).ToList();
line.ProductInfo = product;
}
AddPaymentProvider(order, order.PaymentInfo.Id, order.PaymentInfo.MethodId, localization);
AddShippingProvider(order, order.ShippingInfo.Id, order.ShippingInfo.MethodId, localization);
if (order.Status != OrderStatus.Incomplete)
{
Log.Instance.LogError("ReloadOrderData for NOT incomplete order: " + order.UniqueOrderId + " status: " +order.Status);
}
IO.Container.Resolve<IOrderService>().UseDatabaseDiscounts(order);
order.ResetCachedValues();
order.Save();
}
示例12: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo orderInfo)
{
// Ogone POSTS some values
var transactionId = HttpContext.Current.Request["TransactionId"];
var status = HttpContext.Current.Request["STATUS"];
if (string.IsNullOrEmpty(transactionId))
{
Log.Instance.LogError("Ogone TransactionId not Found!");
return null;
}
orderInfo = OrderHelper.GetOrder(transactionId);
Log.Instance.LogDebug("OGONE OrderNumber: " + orderInfo.OrderNumber + " TransactionID: " + transactionId + " Status: " + status);
var localizedPaymentProvider = PaymentProvider.GetPaymentProvider(orderInfo.PaymentInfo.Id, orderInfo.StoreInfo.Alias);
var returnUrl = localizedPaymentProvider.SuccessUrl();
var errorUrl = localizedPaymentProvider.ErrorUrl();
var cancelUrl = localizedPaymentProvider.CancelUrl();
var redirectUrl = returnUrl;
//0 Ongeldig of onvolledig
//1 Geannuleerd door de klant
//2 Autorisatie geweigerd
//4 Opgeslagen bestelling
//40
//41 Wachten op klantbetaling
//5 Geautoriseerd
//50
//51 Autorisatie pending
//52 Autorisatie onzeker
//55 Stand-by
//56 OK met geplande betalingen
//57
//59 Manueel te bekomen autorisatie
//6 Geautoriseerd en geannuleerd
//61 Annul. autor. pending
//62 Annul. autor. onzeker
//63 Annul. autor. geweigerd
//64 Geautoriseerd en geannuleerd
//7 Betaling geannuleerd
//71 Annul.betaling pending
//72 Annul. betaling onzeker
//73 Annul betaling geweigerd
//74 Betaling geannuleerd
//75 Annul. betaling verwerkt door merch
//8 Terugbetaald
//81 Terugbetaling pending
//82 Terugbetaling onzeker
//83 Terugbetaling geweigerd
//84 Betaling geweigerd door de bank
//85 Terugbet. verwerkt door merchant
//9 Betaling aangevraagd
//91 Betaling pending
//92 Betaling onzeker
//93 Betaling geweigerd
//94 Terubetaling geweigerd door de bank
//95 Betaling verwerkt door merchant
//99 Wordt verwerkt
if (orderInfo.Paid == false)
{
switch (status)
{
case "1":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = status;
redirectUrl = cancelUrl;
break;
case "5":
case "9":
orderInfo.Paid = true;
orderInfo.Status = OrderStatus.ReadyForDispatch;
break;
case "0":
case "2":
case "61":
case "62":
case "63":
case "71":
case "72":
case "73":
case "74":
case "75":
case "93":
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = status;
redirectUrl = errorUrl;
break;
default:
orderInfo.Status = OrderStatus.WaitingForPaymentProvider;
break;
}
orderInfo.Save();
//.........这里部分代码省略.........
示例13: HandlePaymentResponse
public OrderInfo HandlePaymentResponse(PaymentProvider paymentProvider, OrderInfo orderInfo)
{
try
{
var transactionId = HttpContext.Current.Request["transaction_id"];
Log.Instance.LogDebug("Mollie Transaction Id: " + transactionId);
if (string.IsNullOrEmpty(transactionId))
{
Log.Instance.LogError("Mollie: TransactionId IsNullOrEmpty");
return null;
}
orderInfo = OrderHelper.GetOrder(transactionId);
if (orderInfo == null)
{
Log.Instance.LogError("Mollie: Order Not Found For TransactionId: " + transactionId);
return null;
}
if (orderInfo.Paid != false)
{
Log.Instance.LogDebug("Mollie: Order already paid! TransactionId: " + transactionId);
return null;
}
var partnerId = paymentProvider.GetSetting("PartnerId");
var testMode = paymentProvider.TestMode;
var idealCheck = new IdealCheck(partnerId, testMode, transactionId);
if (idealCheck.Error)
{
if (idealCheck.Message != null)
{
Log.Instance.LogError(string.Format("Mollie idealCheck.Error Error! idealCheck.Message: {0}", idealCheck.Message));
}
if (idealCheck.ErrorMessage != null)
{
Log.Instance.LogError(string.Format("Mollie idealCheck.Error Error! idealCheck.ErrorMessage: {0}", idealCheck.ErrorMessage));
}
if (orderInfo.Status == OrderStatus.ReadyForDispatch)
{
return null;
}
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
if (idealCheck.ErrorMessage != null)
{
orderInfo.PaymentInfo.ErrorMessage = idealCheck.ErrorMessage;
}
}
if (idealCheck.Payed)
{
orderInfo.Paid = true;
orderInfo.Status = OrderStatus.ReadyForDispatch;
}
else
{
if (idealCheck.Message != null)
{
Log.Instance.LogError(string.Format("Mollie idealCheck.Payed Error! idealCheck.Message: {0}", idealCheck.Message));
}
if (idealCheck.ErrorMessage != null)
{
Log.Instance.LogError(string.Format("Mollie idealCheck.Payed Error! idealCheck.ErrorMessage: {0}", idealCheck.ErrorMessage));
}
orderInfo.Paid = false;
orderInfo.Status = OrderStatus.PaymentFailed;
orderInfo.PaymentInfo.ErrorMessage = idealCheck.ErrorMessage;
}
orderInfo.Save();
}
catch (Exception ex)
{
Log.Instance.LogError("MolliePaymentResponseHandler.HandlePaymentResponse: " + ex);
}
return null;
}
示例14: CreatePaymentRequest
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;
}
示例15: CreateCopyOfOrder
public OrderInfo CreateCopyOfOrder(OrderInfo order)
{
InitializeNewOrder(order);
order.PaymentInfo.TransactionId = string.Empty;
order.Save();
return order;
}