/// <summary> /// Processes the specified order. /// </summary> /// <typeparam name="T">The order type.</typeparam> /// <param name="order">The order instance.</param> /// <exception cref="InvalidTypeException">The provider doesn't implement IReservable interface.</exception> protected override void Process <T>(T order) { bool cancelSuccess = false; ReservationTicket reservationTicket = new ReservationTicket(order); PaymentArgs paymentArgs = new PaymentArgs(); PaymentProvider paymentProvider = Context.Entity.Resolve <PaymentProvider>(order.PaymentSystem.Code); IReservable reservableProvider = paymentProvider as IReservable; if (reservableProvider != null) { reservableProvider.CancelReservation(order.PaymentSystem, paymentArgs, reservationTicket); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); string result = transactionDataProvider.GetPersistentValue(order.OrderNumber) as string; if (string.Compare(result, "Canceled", StringComparison.OrdinalIgnoreCase) == 0) { cancelSuccess = true; } } if (!cancelSuccess) { order.Status = Context.Entity.Resolve <OrderStatus>("Processing"); IOrderManager <Order> orderManager = Context.Entity.Resolve <IOrderManager <Order> >(); orderManager.SaveOrder(order); } if (reservableProvider == null) { throw new InvalidTypeException("The provider doesn't implement IReservable interface."); } }
/// <summary> /// Cancels payment reservation /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> /// <param name="reservationTicket">The reservation ticket.</param> public void CancelReservation([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs, [NotNull] ReservationTicket reservationTicket) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.ArgumentNotNull(reservationTicket, "reservationTicket"); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); long accountNumber = TypeUtil.TryParse <long>(paymentSystem.Username, 0); int transactionNumber = int.Parse(reservationTicket.TransactionNumber); string encryptionKey = paymentSystem.Password; ArrayList param = new ArrayList { accountNumber, transactionNumber, encryptionKey }; string hash = this.CreateMD5Hash(param); PxOrder order = new PxOrder(); string xmlReturn = order.Cancel2(accountNumber, transactionNumber, hash); string errorCode = this.ParseRes(xmlReturn, "/payex/status/errorCode"); string description = this.ParseRes(xmlReturn, "/payex/status/description"); if (errorCode == "OK" && description == "OK") { transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, PaymentConstants.CancelSuccess); } else { transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, string.Format("errorCode={0} description={1}", errorCode, description)); } }
/// <summary> /// Processes the order. /// </summary> /// <param name="order">The order.</param> /// <param name="parameters">The parameters.</param> /// <returns> /// The result. /// </returns> public override string ProcessOrder([NotNull] Order order, [NotNull] IDictionary <string, object> parameters) { Assert.ArgumentNotNull(order, "order"); Assert.ArgumentNotNull(parameters, "parameters"); Assert.IsNotNull(order.PaymentMeans, "Order payment means cannot be null."); string paymentSystemCode = order.PaymentMeans.PaymentChannelCode; Assert.IsNotNullOrEmpty(paymentSystemCode, "Order payment channel code cannot be null or empty."); Assert.IsNotNull(order.ReservationTicket, "Order reservation ticket cannot be null"); PaymentProvider paymentProvider = this.paymentProviderFactory.GetProvider(paymentSystemCode); Assert.IsTrue(paymentProvider is IReservable, "Unable to cancel amount reservation. Reservable payment provider is expected."); IReservable reservablePaymentProvider = (IReservable)paymentProvider; this.merchantOrderManager.Save(order); reservablePaymentProvider.CancelReservation(paymentProvider.PaymentOption, new PaymentArgs(), order.GetReservationTicket()); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); string result = transactionDataProvider.GetPersistentValue(order.OrderId).ToString(); if (result == "Canceled") { result = SuccessfulResult; } return(result); }
public TransactionsFeeDataGenerator(ITransactionData transactionData, IDataGenerator dataGenerator, IFeeCalculator feeCalculator, IOutputWritter outputWritter) { _transactionData = transactionData; _dataGenerator = dataGenerator; _feeCalculator = feeCalculator; _consoleWritter = outputWritter; }
public Transaction(ITransactionData entity) { if (entity != null) { Id = entity.Id; UpdateAt = entity.UpdateAt; } }
/// <summary> /// Begins the payment. /// </summary> /// <param name="paymentSystem">The payment System.</param> /// <param name="paymentArgs">The payment arguments.</param> public override void Invoke([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); base.Invoke(paymentSystem, paymentArgs); string sequence = new Random().Next(0, 1000).ToString(); string timeStamp = ((int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds).ToString(); string currency = this.Currency(paymentArgs.ShoppingCart.Currency.Code); string fingerprint = this.HmacMD5(paymentSystem.Password, paymentSystem.Username + "^" + sequence + "^" + timeStamp + "^" + paymentArgs.ShoppingCart.Totals.TotalPriceIncVat.RoundToCents() + "^" + currency); NameValueCollection data = new NameValueCollection { { "x_login", paymentSystem.Username }, { "x_invoice_num", paymentArgs.ShoppingCart.OrderNumber }, { "x_po_num", paymentArgs.ShoppingCart.OrderNumber }, { "x_receipt_link_url", paymentArgs.PaymentUrls.ReturnPageUrl }, { "x_amount", paymentArgs.ShoppingCart.Totals.TotalPriceIncVat.RoundToCents() }, { "x_tax", paymentArgs.ShoppingCart.Totals.TotalVat.RoundToCents() }, { "x_currency_code", currency }, { "x_description", paymentArgs.Description }, { "x_fp_sequence", sequence }, { "x_fp_timestamp", timeStamp }, { "x_customer_ip", HttpContext.Current.Request.UserHostAddress }, { "x_fp_hash", fingerprint }, { "x_first_name", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.Name }, { "x_last_name", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.Name2 }, { "x_address", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.Address }, { "x_city", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.City }, { "x_state", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.State }, { "x_zip", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.Zip }, { "x_country", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.Country.Title }, { "x_ship_to_first_name", paymentArgs.ShoppingCart.CustomerInfo.ShippingAddress.Name }, { "x_ship_to_last_name", paymentArgs.ShoppingCart.CustomerInfo.ShippingAddress.Name2 }, { "x_ship_to_address", paymentArgs.ShoppingCart.CustomerInfo.ShippingAddress.Address }, { "x_ship_to_city", paymentArgs.ShoppingCart.CustomerInfo.ShippingAddress.City }, { "x_ship_to_state", paymentArgs.ShoppingCart.CustomerInfo.ShippingAddress.State }, { "x_ship_to_zip", paymentArgs.ShoppingCart.CustomerInfo.ShippingAddress.Zip }, { "x_ship_to_country", paymentArgs.ShoppingCart.CustomerInfo.ShippingAddress.Country.Title }, { "x_phone", paymentArgs.ShoppingCart.CustomerInfo.Phone }, { "x_fax", paymentArgs.ShoppingCart.CustomerInfo.Fax }, { "x_email", paymentArgs.ShoppingCart.CustomerInfo.Email }, { "x_header_email_receipt", paymentArgs.ShoppingCart.CustomerInfo.Email }, }; PaymentSettingsReader paymentSettingsReader = new PaymentSettingsReader(paymentSystem); data.Add(paymentSettingsReader.GetProviderSettings()); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); transactionDataProvider.SaveStartValues(paymentArgs.ShoppingCart.OrderNumber, paymentArgs.ShoppingCart.Totals.TotalPriceIncVat.RoundToCents(), currency, paymentSystem.Code); this.PostData(paymentSystem.PaymentUrl, data); }
/// <summary> /// Captures the payment /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> /// <param name="reservationTicket">The reservation ticket.</param> /// <param name="amount">The amount.</param> public void Capture([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs, [NotNull] ReservationTicket reservationTicket, decimal amount) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.ArgumentNotNull(reservationTicket, "reservationTicket"); Assert.ArgumentCondition((amount > 0), "amount", "An amount should be greater than zero"); Assert.ArgumentCondition((amount <= reservationTicket.Amount), "amount", "An amount should not be greater than the original reserved one"); var configuration = new PaymentSettingsReader(paymentSystem); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); string protocolInput = configuration.GetSetting("protocol"); const string MsgtypeInput = "capture"; string merchantInput = paymentSystem.Username; string amountInput = amount.ToCents(); string transaction = reservationTicket.TransactionNumber; string secretInput = paymentSystem.Password; string apiUrl = configuration.GetSetting("apiURL"); string tohashInput = string.Concat(protocolInput, MsgtypeInput, merchantInput, amountInput, transaction, secretInput); string hashInput = this.GetMD5Hash(tohashInput); string requestString = string.Format( "protocol={0}&msgtype={1}&merchant={2}&amount={3}&transaction={4}&md5check={5}", protocolInput, MsgtypeInput, paymentSystem.Username, amountInput, transaction, hashInput); string message = "UnCaptured: "; string information = string.Empty; string xmlReturn = this.SendRequest(apiUrl, requestString, ref information); if (!string.IsNullOrEmpty(xmlReturn)) { var quickPayResponse = this.ParseResult(xmlReturn); string secret = paymentSystem.Password; string tohash = string.Join(string.Empty, quickPayResponse.Where(x => x.Key != "md5check").Select(x => x.Value).ToArray()) + secret; string md5Check = this.GetMD5Hash(tohash); if (md5Check.Equals(quickPayResponse["md5check"]) && quickPayResponse["qpstat"].Equals("000")) { transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, PaymentConstants.CaptureSuccess); return; } message += string.Format("qpstat={0}", quickPayResponse["qpstat"]); } else { message += information; } transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, message); }
/// <summary> /// Processes the callback in terms of the HttpRequest and extracts either hidden form fields, or querystring parameters /// that is returned from the payment provider. /// Determines the payment status and saves that indication for later, could be in session, in db, or other storage. /// This information is important and used in the GetPaymentStatus(). /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> public override void ProcessCallback([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.IsNotNull(paymentArgs.ShoppingCart, "Shopping cart is null"); this.PaymentStatus = PaymentStatus.Failure; HttpRequest request = HttpContext.Current.Request; ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); string autocapture = configuration.GetSetting("autocapture"); if (request.QueryString[PaymentConstants.ActionKey] != PaymentConstants.CancelResponse) { string xmlReturn = this.CheckStatus(paymentSystem, paymentArgs); if (!string.IsNullOrEmpty(xmlReturn)) { var quickPayResponse = this.ParseResult(xmlReturn); string secret = paymentSystem.Password; string tohash = string.Join(string.Empty, quickPayResponse.Where(x => x.Key != "md5check").Select(x => x.Value).ToArray()) + secret; string md5Check = this.GetMD5Hash(tohash); if (md5Check.Equals(quickPayResponse["md5check"]) && quickPayResponse["qpstat"].Equals("000")) { this.PaymentStatus = PaymentStatus.Succeeded; transactionDataProvider.SaveCallBackValues(paymentArgs.ShoppingCart.OrderNumber, this.PaymentStatus.ToString(), quickPayResponse["transaction"], quickPayResponse["amount"], quickPayResponse["currency"], string.Empty, string.Empty, string.Empty, quickPayResponse["cardtype"]); if (string.Compare(autocapture, this.ReservableBehavior, StringComparison.OrdinalIgnoreCase) == 0) { string transactionAmount = transactionDataProvider.GetPersistentValue(paymentArgs.ShoppingCart.OrderNumber, TransactionConstants.TotalAmount) as string; string orderNumber = paymentArgs.ShoppingCart.OrderNumber; string transactionNumber = transactionDataProvider.GetPersistentValue(paymentArgs.ShoppingCart.OrderNumber, TransactionConstants.TransactionNumber) as string; decimal amount = transactionAmount.FromCents(); ReservationTicket reservationTicket = new ReservationTicket { InvoiceNumber = orderNumber, AuthorizationCode = PaymentConstants.EmptyAuthorizationCode, TransactionNumber = transactionNumber, Amount = amount }; transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, PaymentConstants.ReservationTicket, reservationTicket); } } } } else { this.PaymentStatus = PaymentStatus.Canceled; } if (this.PaymentStatus != PaymentStatus.Succeeded) { transactionDataProvider.SavePersistentValue(paymentArgs.ShoppingCart.OrderNumber, TransactionConstants.PaymentStatus, this.PaymentStatus.ToString()); } }
public async Task Transaction_is_started_automatically_from_incoming_trace_header() { // Arrange ITransactionData transaction = null; var sentryClient = Substitute.For <ISentryClient>(); var hub = new Internal.Hub(sentryClient, new SentryOptions { Dsn = DsnSamples.ValidDsnWithoutSecret, TracesSampleRate = 1 }); var server = new TestServer(new WebHostBuilder() .UseDefaultServiceProvider(di => di.EnableValidation()) .UseSentry() .ConfigureServices(services => { services.AddRouting(); services.RemoveAll(typeof(Func <IHub>)); services.AddSingleton <Func <IHub> >(() => hub); }) .Configure(app => { app.UseRouting(); app.UseSentryTracing(); app.UseEndpoints(routes => { routes.Map("/person/{id}", _ => { transaction = hub.GetSpan() as ITransactionData; return(Task.CompletedTask); }); }); }) ); var client = server.CreateClient(); // Act using var request = new HttpRequestMessage(HttpMethod.Get, "/person/13") { Headers = { { "sentry-trace", "75302ac48a024bde9a3b3734a82e36c8-1000000000000000-0" } } }; await client.SendAsync(request); // Assert transaction.Should().NotBeNull(); transaction?.Name.Should().Be("GET /person/{id}"); transaction.TraceId.Should().Be(SentryId.Parse("75302ac48a024bde9a3b3734a82e36c8")); transaction.ParentSpanId.Should().Be(SpanId.Parse("1000000000000000")); transaction.IsSampled.Should().BeFalse(); }
/// <summary> /// Initializes a new instance of the <see cref="CaptureOrderProcessingStrategy"/> class. /// </summary> /// <param name="paymentProviderFactory">The payment provider factory.</param> /// <param name="transactionDataProvider">The transaction Data Provider.</param> /// <param name="pipelineWrapper">The pipeline wrapper.</param> public CaptureOrderProcessingStrategy(PaymentProviderFactory paymentProviderFactory, ITransactionData transactionDataProvider, PipelineWrapper pipelineWrapper) { Assert.ArgumentNotNull(paymentProviderFactory, "paymentProviderFactory"); Assert.ArgumentNotNull(transactionDataProvider, "transactionDataProvider"); Assert.ArgumentNotNull(pipelineWrapper, "pipelineWrapper"); this.paymentProviderFactory = paymentProviderFactory; this.transactionDataProvider = transactionDataProvider; this.pipelineWrapper = pipelineWrapper; }
/// <summary> /// Initializes a new instance of the <see cref="TransientOrderManager" /> class. /// </summary> /// <param name="innerRepository">The inner repository.</param> /// <param name="orderConverter">The order converter.</param> /// <param name="orderIdGenerator">The order id generator.</param> /// <param name="customerManager">The customer manager.</param> /// <param name="entityHelper">The entity helper.</param> /// <param name="transactionData">The transaction data.</param> /// <param name="shopContext">The shop context.</param> public TransientOrderManager(VisitorOrderManager innerRepository, TransientOrderConverter orderConverter, OrderIDGenerator orderIdGenerator, ICustomerManager <CustomerInfo> customerManager, EntityHelper entityHelper, ITransactionData transactionData, ShopContext shopContext) { this.innerRepository = innerRepository; this.orderConverter = orderConverter; this.orderIDGenerator = orderIdGenerator; this.customerManager = customerManager; this.entityHelper = entityHelper; this.transactionData = transactionData; this.shopContext = shopContext; }
/// <summary> /// Initializes a new instance of the <see cref="CaptureOrderProcessingStrategy"/> class. /// </summary> /// <param name="paymentProviderFactory">The payment provider factory.</param> /// <param name="transactionDataProvider">The transaction Data Provider.</param> /// <param name="pipelineWrapper">The pipeline wrapper.</param> public CaptureOrderProcessingStrategy(PaymentProviderFactory paymentProviderFactory, ITransactionData transactionDataProvider, PipelineWrapper pipelineWrapper) { Assert.ArgumentNotNull(paymentProviderFactory, "paymentProviderFactory"); Assert.ArgumentNotNull(transactionDataProvider, "transactionDataProvider"); Assert.ArgumentNotNull(pipelineWrapper, "pipelineWrapper"); this.paymentProviderFactory = paymentProviderFactory; this.transactionDataProvider = transactionDataProvider; this.pipelineWrapper = pipelineWrapper; }
/// <summary> /// Processes the callback in terms of the HttpRequest and extracts either hidden form fields, or querystring parameters /// that is returned from the payment provider. /// Determines the payment status and saves that indication for later, could be in session, in db, or other storage. /// This information is important and used in the GetPaymentStatus(). /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> public override void ProcessCallback([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.IsNotNull(paymentArgs.ShoppingCart, "Shopping cart is null"); this.PaymentStatus = PaymentStatus.Failure; HttpRequest request = HttpContext.Current.Request; PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); string instantcapture = configuration.GetSetting("instantcapture"); if (request.QueryString[PaymentConstants.ActionKey] != PaymentConstants.CancelResponse) { string transactionNumber = request.QueryString["tid"]; string cardid = request.QueryString["cardid"]; string currency = request.QueryString["cur"]; string orderid = request.QueryString["orderid"]; string amount = request.QueryString["amount"]; string hashString = request.QueryString["eKey"]; string date = request.QueryString["date"]; if (!this.CallBackIsvalid(paymentSystem, paymentArgs, currency, transactionNumber, amount, orderid, hashString, date)) { Log.Error("Callback parameters are invalid.", this); } else { this.PaymentStatus = PaymentStatus.Succeeded; transactionDataProvider.SaveCallBackValues(orderid, this.PaymentStatus.ToString(), transactionNumber, amount, currency, string.Empty, string.Empty, string.Empty, cardid); if (string.Compare(instantcapture, this.ReservableBehavior, StringComparison.OrdinalIgnoreCase) == 0) { ReservationTicket reservationTicket = new ReservationTicket { InvoiceNumber = orderid, AuthorizationCode = hashString, TransactionNumber = transactionNumber, Amount = amount.FromCents() }; transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, PaymentConstants.ReservationTicket, reservationTicket); } } } else { this.PaymentStatus = PaymentStatus.Canceled; } if (this.PaymentStatus != PaymentStatus.Succeeded) { transactionDataProvider.SavePersistentValue(paymentArgs.ShoppingCart.OrderNumber, TransactionConstants.PaymentStatus, this.PaymentStatus.ToString()); } }
/// <summary> /// Processes the callback in terms of the HttpRequest and extracts either hidden form fields, or querystring parameters /// that is returned from the payment provider. /// Determines the payment status and saves that indication for later, could be in session, in db, or other storage. /// This information is important and used in the GetPaymentStatus(). /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> public override void ProcessCallback([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.IsNotNull(paymentArgs.ShoppingCart, "Shopping cart is null"); this.PaymentStatus = PaymentStatus.Failure; HttpRequest request = HttpContext.Current.Request; ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); string transactionType = configuration.GetSetting("x_type"); if (request.QueryString[PaymentConstants.ActionKey] != PaymentConstants.CancelResponse) { string transactionId = request.Form["x_split_tender_id"] ?? request.Form["x_trans_id"]; string invoiceNumber = request.Form["x_invoice_num"]; string authorizationCode = request.Form["x_auth_code"]; string totalPrice = request.Form["x_amount"]; string responseCode = request.Form["x_response_code"]; string responseReasonCode = request.Form["x_response_reason_code"]; string responseReasonText = request.Form["x_response_reason_text"]; string method = request.Form["x_method"]; string hash = request.Form["x_MD5_Hash"]; string hashMD5 = Crypto.GetMD5Hash(paymentSystem.Password + paymentSystem.Username + transactionId + totalPrice); if (!string.IsNullOrEmpty(hash) && !string.IsNullOrEmpty(hashMD5) && string.Equals(hashMD5, hash, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(responseCode) && responseCode.Equals("1")) { this.PaymentStatus = PaymentStatus.Succeeded; transactionDataProvider.SaveCallBackValues(paymentArgs.ShoppingCart.OrderNumber, PaymentStatus.Succeeded.ToString(), transactionId, totalPrice, string.Empty, responseCode, responseReasonCode, responseReasonText, method); if (string.Compare(transactionType, this.ReservableTransactionType, StringComparison.OrdinalIgnoreCase) == 0) { ReservationTicket reservationTicket = new ReservationTicket { InvoiceNumber = invoiceNumber, AuthorizationCode = authorizationCode, TransactionNumber = transactionId, Amount = TypeUtil.TryParse(totalPrice, decimal.Zero) }; transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, PaymentConstants.ReservationTicket, reservationTicket); } } } else { this.PaymentStatus = PaymentStatus.Canceled; } if (this.PaymentStatus != PaymentStatus.Succeeded) { transactionDataProvider.SavePersistentValue(paymentArgs.ShoppingCart.OrderNumber, TransactionConstants.PaymentStatus, this.PaymentStatus.ToString()); } }
public async Task Transaction_is_automatically_populated_with_request_data() { // Arrange ITransactionData transaction = null; var sentryClient = Substitute.For <ISentryClient>(); var hub = new Internal.Hub(new SentryOptions { Dsn = DsnSamples.ValidDsnWithoutSecret, TracesSampleRate = 1 }, sentryClient); var server = new TestServer(new WebHostBuilder() .UseDefaultServiceProvider(di => di.EnableValidation()) .UseSentry() .ConfigureServices(services => { services.AddRouting(); services.RemoveAll(typeof(Func <IHub>)); services.AddSingleton <Func <IHub> >(() => hub); }) .Configure(app => { app.UseRouting(); app.UseSentryTracing(); app.UseEndpoints(routes => { routes.Map("/person/{id}", _ => { transaction = hub.GetSpan() as ITransactionData; return(Task.CompletedTask); }); }); }) ); var client = server.CreateClient(); // Act using var request = new HttpRequestMessage(HttpMethod.Get, "/person/13") { Headers = { { "foo", "bar" } } }; await client.SendAsync(request); // Assert transaction.Should().NotBeNull(); transaction?.Request.Method.Should().Be("GET"); transaction?.Request.Url.Should().Be("http://localhost/person/13"); transaction?.Request.Headers.Should().Contain(new KeyValuePair <string, string>("foo", "bar")); }
/// <summary> /// Recovers the session. /// </summary> /// <param name="recoveredData">The recovered data.</param> public void Recover(ITransactionData <TData> recoveredData) { this.started = true; this.Recovered = true; this.StepEnumeratorInstance.CurrentStepIndex = recoveredData.CurrentStepIndex; this.StepEnumeratorInstance.Data = this.RunSettings.DontRecoverTransactionData() ? this.RunSettings.Data : recoveredData.Data; this.SessionId = recoveredData.SessionId; this.StartTimestamp = recoveredData.StartTimestamp; }
/// <summary> /// Invokes the payment. /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> /// <exception cref="NotImplementedException"><c>NotImplementedException</c>.</exception> public override void Invoke(DomainModel.Payments.PaymentSystem paymentSystem, PaymentArgs paymentArgs) { string ordernumber = paymentArgs.ShoppingCart.OrderNumber; string amount = paymentArgs.ShoppingCart.Totals.TotalPriceIncVat.ToCents(); string currency = paymentArgs.ShoppingCart.Currency.Code; ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); transactionDataProvider.SaveStartValues(ordernumber, amount, currency, paymentSystem.Code); HttpContext.Current.Response.Redirect(paymentArgs.PaymentUrls.ReturnPageUrl); }
public decimal AddDiscount(ITransactionData transaction) { foreach (var discountEntry in _merchantDiscountsList) { if (discountEntry.mechantName.Equals(transaction.MerchantName)) { return(transaction.Fee * discountEntry.discount); } } return(transaction.Fee); }
public BudgetQuery(ITransactionData data) { Field <ExpenseMonthType>( "monthExpense", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "monthId" }), resolve: context => data.GetMonthExpense(context.GetArgument <int>("monthId")) ); Field <ExpenseYearType>( "yearExpense", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "year" }), resolve: context => data.GetYearExpense(context.GetArgument <int>("year")) ); Field <IncomeMonthType>( "monthIncome", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "monthId" }), resolve: context => data.GetMonthIncome(context.GetArgument <int>("monthId")) ); Field <IncomeYearType>( "yearIncome", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "year" }), resolve: context => data.GetYearIncome(context.GetArgument <int>("year")) ); // new Field <PerformanceMonthType>( "monthPerformance", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "monthId" }), resolve: context => data.GetMonthPerformance(context.GetArgument <int?>("monthId")) ); Field <PerformanceYearType>( "yearPerformance", arguments: new QueryArguments(new QueryArgument <IntGraphType> { Name = "year" }), resolve: context => data.GetYearPerformance(context.GetArgument <int?>("year")) ); Field <TransactionResponseType>( "transactions", arguments: new QueryArguments(new QueryArgument <TransactionFilterType> { Name = "filter" }), resolve: context => data.GetTransactions(context.GetArgument <TransactionFilter>("filter")) ); }
/// <summary> /// Begins the payment. /// </summary> /// <param name="paymentSystem">The payment System.</param> /// <param name="paymentArgs">The payment arguments.</param> public override void Invoke([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); string protocol = configuration.GetSetting("protocol"); string msgtype = configuration.GetSetting("msgtype"); string merchant = paymentSystem.Username; string language = this.Language(Sitecore.Context.Language.Name); string ordernumber = paymentArgs.ShoppingCart.OrderNumber; string amount = paymentArgs.ShoppingCart.Totals.TotalPriceIncVat.ToCents(); string callbackurl = paymentArgs.PaymentUrls.ReturnPageUrl; string currency = this.Currency(paymentArgs.ShoppingCart.Currency.Code); string continueurl = paymentArgs.PaymentUrls.ReturnPageUrl; string cancelurl = continueurl + PaymentConstants.CancelQueryString; string description = paymentArgs.Description; string ipaddress = HttpContext.Current.Request.UserHostAddress; string testmode = configuration.GetSetting("testmode"); string autocapture = configuration.GetSetting("autocapture"); string secret = paymentSystem.Password; string tohash = string.Concat(protocol, msgtype, merchant, language, ordernumber, amount, currency, continueurl, cancelurl, callbackurl, autocapture, description, ipaddress, testmode, secret); string hash = this.GetMD5Hash(tohash); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); transactionDataProvider.SaveStartValues(ordernumber, amount, currency, paymentSystem.Code); NameValueCollection data = new NameValueCollection { { "protocol", protocol }, { "msgtype", msgtype }, { "merchant", merchant }, { "language", language }, { "ordernumber", ordernumber }, { "amount", amount }, { "currency", currency }, { "continueurl", continueurl }, { "cancelurl", cancelurl }, { "callbackurl", callbackurl }, { "autocapture", autocapture }, { "description", description }, { "ipaddress", ipaddress }, { "testmode", testmode }, { "md5check", hash }, }; this.PostData(paymentSystem.PaymentUrl, data); }
/// <summary> /// Processes the callback in terms of the HttpRequest and extracts either hidden form fields, or querystring parameters /// that is returned from the payment provider. /// Determines the payment status and saves that indication for later, could be in session, in db, or other storage. /// This information is important and used in the GetPaymentStatus(). /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> public override void ProcessCallback([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.IsNotNull(paymentArgs.ShoppingCart, "Shopping cart is null"); this.PaymentStatus = PaymentStatus.Failure; HttpRequest request = HttpContext.Current.Request; ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); bool capturenow = !string.IsNullOrEmpty(configuration.GetSetting("capturenow")); if (request[PaymentConstants.ActionKey] != PaymentConstants.CancelResponse) { string transactionNumber = request["transact"]; string amount = request["amount"]; string merchant = request["merchant"]; string orderid = request["orderid"]; string authkey = request["authkey"]; string cardType = request["paytype"] ?? string.Empty; if (this.CallBackIsvalid(paymentSystem, paymentArgs, transactionNumber, amount, merchant, orderid)) { this.PaymentStatus = PaymentStatus.Succeeded; transactionDataProvider.SaveCallBackValues(orderid, this.PaymentStatus.ToString(), transactionNumber, amount, string.Empty, string.Empty, string.Empty, string.Empty, cardType); if (!capturenow) { ReservationTicket reservationTicket = new ReservationTicket { InvoiceNumber = orderid, AuthorizationCode = authkey, TransactionNumber = transactionNumber, Amount = amount.FromCents() }; transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, PaymentConstants.ReservationTicket, reservationTicket); } } } else { this.PaymentStatus = PaymentStatus.Canceled; } if (this.PaymentStatus != PaymentStatus.Succeeded) { transactionDataProvider.SavePersistentValue(paymentArgs.ShoppingCart.OrderNumber, TransactionConstants.PaymentStatus, this.PaymentStatus.ToString()); } }
/// <summary> /// Cancels the payment reservation /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> /// <param name="reservationTicket">The reservation ticket.</param> public void CancelReservation([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs, [NotNull] ReservationTicket reservationTicket) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.ArgumentNotNull(reservationTicket, "reservationTicket"); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); Payment payment = new Payment(); int pbsResponse = 0; bool deleteResult = payment.delete(int.Parse(paymentSystem.Username), long.Parse(reservationTicket.TransactionNumber), string.Empty, paymentSystem.Password, ref pbsResponse); transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, deleteResult ? PaymentConstants.CancelSuccess : string.Format("pbsResponse={0}", pbsResponse)); }
public async Task Transaction_is_bound_on_the_scope_automatically() { // Arrange ITransactionData transaction = null; var sentryClient = Substitute.For <ISentryClient>(); var hub = new Internal.Hub(new SentryOptions { Dsn = DsnSamples.ValidDsnWithoutSecret }, sentryClient); var server = new TestServer(new WebHostBuilder() .UseDefaultServiceProvider(di => di.EnableValidation()) .UseSentry() .ConfigureServices(services => { services.AddRouting(); services.RemoveAll(typeof(Func <IHub>)); services.AddSingleton <Func <IHub> >(() => hub); }) .Configure(app => { app.UseRouting(); app.UseSentryTracing(); app.UseEndpoints(routes => { routes.Map("/person/{id}", _ => { transaction = hub.GetSpan() as ITransactionData; return(Task.CompletedTask); }); }); }) ); var client = server.CreateClient(); // Act await client.GetStringAsync("/person/13"); // Assert transaction.Should().NotBeNull(); transaction?.Name.Should().Be("GET /person/{id}"); }
public decimal AddMonthlyFee(ITransactionData transaction) { if ((transaction.Date.Month > _lastTransactionDate.Month) || (transaction.Date.Year > _lastTransactionDate.Year)) { _monthlyFeeIssuedTo.Clear(); } if (!_monthlyFeeIssuedTo.Contains(transaction.MerchantName) && transaction.Fee > 0) { transaction.Fee = transaction.Fee + _monthlyInvoiceFee; _monthlyFeeIssuedTo.Add(transaction.MerchantName); } _lastTransactionDate = transaction.Date; return(transaction.Fee); }
/// <summary> /// Processes the callback in terms of the HttpRequest and extracts either hidden form fields, or querystring parameters /// that is returned from the payment provider. /// Determines the payment status and saves that indication for later, could be in session, in db, or other storage. /// This information is important and used in the GetPaymentStatus(). /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> public override void ProcessCallback([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.IsNotNull(paymentArgs.ShoppingCart, "Shopping cart is null"); this.PaymentStatus = PaymentStatus.Failure; HttpRequest request = HttpContext.Current.Request; ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); if (request.QueryString[PaymentConstants.ActionKey] != PaymentConstants.CancelResponse) { string orderRef = request["orderRef"]; long accountNumber = TypeUtil.TryParse <long>(paymentSystem.Username, 0); string secretKey = paymentSystem.Password; if (!string.IsNullOrEmpty(orderRef) && accountNumber > 0) { ArrayList param = new ArrayList { accountNumber, orderRef, secretKey }; string hash = this.CreateMD5Hash(param); try { this.CompleteCallback(paymentSystem, orderRef, accountNumber, hash, transactionDataProvider); } catch (Exception exception) { Log.Warn(exception.Message, exception, this); } } } else { this.PaymentStatus = PaymentStatus.Canceled; } if (this.PaymentStatus != PaymentStatus.Succeeded) { transactionDataProvider.SavePersistentValue(paymentArgs.ShoppingCart.OrderNumber, TransactionConstants.PaymentStatus, this.PaymentStatus.ToString()); } }
public virtual string FinalizePayment() { Assert.IsNotNull(this.ShoppingCart, "Shopping cart is null"); if (string.IsNullOrEmpty(this.ShoppingCart.OrderNumber)) { ITransactionData transactionData = Context.Entity.Resolve <ITransactionData>(); string transactionNumber = transactionData.GetPersistentValue(this.ShoppingCart.OrderNumber, TransactionConstants.TransactionNumber) as string; if (!string.IsNullOrEmpty(transactionNumber)) { return(transactionNumber); } } return(string.Empty); }
/// <summary> /// Captures the payment /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> /// <param name="reservationTicket">The reservation ticket.</param> /// <param name="amount">The amount.</param> public void Capture([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs, [NotNull] ReservationTicket reservationTicket, decimal amount) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.ArgumentNotNull(reservationTicket, "reservationTicket"); Assert.ArgumentCondition((amount > 0), "amount", "An amount should be greater than zero"); Assert.ArgumentCondition((amount <= reservationTicket.Amount), "amount", "An amount should not be greater than the original reserved one"); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); Payment payment = new Payment(); int pbsResponse = 0; int epayresponse = 0; bool captureResult = payment.capture(int.Parse(paymentSystem.Username), long.Parse(reservationTicket.TransactionNumber), int.Parse(amount.ToCents()), string.Empty, paymentSystem.Password, ref pbsResponse, ref epayresponse); transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, captureResult ? PaymentConstants.CaptureSuccess : string.Format("pbsResponse={0} epayresponse={1}", pbsResponse, epayresponse)); }
public bool GenerateDataFromLine(string fileLine, ref ITransactionData transaction) { string[] lineItems = fileLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (lineItems.Length == 3) { DateTime.TryParse(lineItems[0], out _dateTemp); transaction.Date = _dateTemp; transaction.MerchantName = lineItems[1]; decimal.TryParse(lineItems[2], out _amountTemp); transaction.Amount = _amountTemp; return(true); } return(false); }
/// <summary> /// Cancels the payment reservation. /// </summary> /// <param name="paymentSystem">The payment System.</param> /// <param name="paymentArgs">The payment arguments.</param> /// <param name="reservationTicket">The reservation ticket.</param> public void CancelReservation([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs, [NotNull] ReservationTicket reservationTicket) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.ArgumentNotNull(reservationTicket, "reservationTicket"); PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); bool isTest; Boolean.TryParse(configuration.GetSetting("x_test_request"), out isTest); var request = new VoidRequest(reservationTicket.TransactionNumber); var gate = new Gateway(paymentSystem.Username, paymentSystem.Password, isTest); var response = gate.Send(request); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, response.Approved ? PaymentConstants.CancelSuccess : response.Message); }
/// <summary> /// Captures the payment /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="paymentArgs">The payment args.</param> /// <param name="reservationTicket">The reservation ticket.</param> /// <param name="amount">The amount.</param> public void Capture([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs, [NotNull] ReservationTicket reservationTicket, decimal amount) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); Assert.ArgumentNotNull(reservationTicket, "reservationTicket"); Assert.ArgumentCondition((amount > 0), "amount", "An amount should be greater than zero"); Assert.ArgumentCondition((amount <= reservationTicket.Amount), "amount", "An amount should not be greater than the original reserved one"); PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); string key1 = configuration.GetSetting("key1"); string key2 = configuration.GetSetting("key2"); string url = configuration.GetSetting("captureUrl"); string merchant = paymentSystem.Username; string password = paymentSystem.Password; string orderId = reservationTicket.InvoiceNumber; string transact = reservationTicket.TransactionNumber; string amountInput = amount.ToCents(); const string Textreply = "yes"; const string Fullreply = "yes"; string forHash = string.Format("merchant={0}&orderid={1}&transact={2}&amount={3}", merchant, orderId, transact, amountInput); string md5Key = this.CalculateMd5Key(key1, key2, forHash); NameValueCollection data = new NameValueCollection { { "merchant", merchant }, { "orderid", orderId }, { "transact", transact }, { "amount", amountInput }, { "md5key", md5Key }, { "textreply", Textreply }, { "fullreply", Fullreply }, }; NameValueCollection result = new NameValueCollection(); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); transactionDataProvider.SavePersistentValue(orderId, this.SendRequest(merchant, password, url, data, ref result) ? PaymentConstants.CaptureSuccess : string.Format("UnCaptured. Reason={0}", result["reason"])); }
/// <summary> /// Begins the payment. /// </summary> /// <param name="paymentSystem">The payment System.</param> /// <param name="paymentArgs">The payment arguments.</param> public override void Invoke([NotNull] PaymentSystem paymentSystem, [NotNull] PaymentArgs paymentArgs) { Assert.ArgumentNotNull(paymentSystem, "paymentSystem"); Assert.ArgumentNotNull(paymentArgs, "paymentArgs"); PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); string merchantId = paymentSystem.Username; string ordernumber = paymentArgs.ShoppingCart.OrderNumber; string amount = paymentArgs.ShoppingCart.Totals.TotalPriceIncVat.ToCents(); string currency = this.Currency(paymentArgs.ShoppingCart.Currency.Code); string key1 = configuration.GetSetting("key1"); string key2 = configuration.GetSetting("key2"); string concatanatedString = string.Format("merchant={0}&orderid={1}¤cy={2}&amount={3}", merchantId, ordernumber, currency, amount); string acceptUrl = paymentArgs.PaymentUrls.ReturnPageUrl; string cancelUrl = acceptUrl + PaymentConstants.CancelQueryString; NameValueCollection data = new NameValueCollection { { "merchant", paymentSystem.Username }, { "amount", amount }, { "currency", currency }, { "orderid", ordernumber }, { "accepturl", acceptUrl }, { "cancelurl", cancelUrl }, { "ip", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] }, { "lang", this.Language(Sitecore.Context.Language.Name) }, { "ordertext", paymentArgs.Description }, { "delivery1.Navn", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.Name }, { "delivery2.Adresse", paymentArgs.ShoppingCart.CustomerInfo.BillingAddress.Address }, { "delivery3.Kommentar", string.Empty }, { "md5key", this.CalculateMd5Key(key1, key2, concatanatedString) }, }; data.Add(configuration.GetProviderSettings(this.CustomSettings)); ITransactionData transactionDataProvider = Context.Entity.Resolve <ITransactionData>(); transactionDataProvider.SaveStartValues(ordernumber, amount, currency, paymentSystem.Code); this.PostData(paymentSystem.PaymentUrl, data); }
public IEnumerable<ILineItemData> GetLineItems( ITransactionData transaction ) { return GetLineItems( transaction ); }
public void SaveTransaction( ITransactionData transaction ) { Assert.PreCondition( ledger != null ); if( transaction.Id < 1 ) transaction.Id = GetNextTransactionId(); if( !ledger.Transactions.Contains( (Transaction)transaction ) ) ledger.Transactions.Add( (Transaction)transaction ); saveOnClose = true; }
public IEnumerable<ILineItemData> GetLineItems( ITransactionData transaction ) { Transaction trans = (Transaction)transaction; foreach( LineItem lineItem in trans.LineItems ) yield return lineItem; }
/// <summary> /// Performs the completion of the conversation with PayPal. /// </summary> /// <param name="paymentSystem">The payment system.</param> /// <param name="orderRef">The order ref.</param> /// <param name="accountNumber">The account number.</param> /// <param name="hash">The hash.</param> /// <param name="transactionDataProvider">The transaction data provider.</param> protected void CompleteCallback(PaymentSystem paymentSystem, string orderRef, long accountNumber, string hash, ITransactionData transactionDataProvider) { PaymentSettingsReader configuration = new PaymentSettingsReader(paymentSystem); string purchaseOperation = configuration.GetSetting("purchaseOperation"); PaymentStatus paymentStatusResult = PaymentStatus.Failure; PxOrder payexOrder = new PxOrder(); string xmlReturn = payexOrder.Complete(accountNumber, orderRef, hash); string transactionNumber = this.ParseRes(xmlReturn, "/payex/transactionNumber"); string orderNumber = this.ParseRes(xmlReturn, "/payex/orderId"); string transactionAmount = this.ParseRes(xmlReturn, "/payex/amount"); string errorCode = this.ParseRes(xmlReturn, "/payex/status/errorCode"); int transactionStatus = int.Parse(this.ParseRes(xmlReturn, "/payex/transactionStatus")); if (errorCode == "OK") { switch (transactionStatus) { case (int)TransactionStatus.Sale: case (int)TransactionStatus.Authorize: { paymentStatusResult = PaymentStatus.Succeeded; transactionDataProvider.SaveCallBackValues(orderNumber, paymentStatusResult.ToString(), transactionNumber, transactionAmount, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); if (string.Compare(purchaseOperation, this.ReservableTransactionType, StringComparison.OrdinalIgnoreCase) == 0) { decimal amount = transactionAmount.FromCents(); ReservationTicket reservationTicket = new ReservationTicket { InvoiceNumber = orderNumber, AuthorizationCode = PaymentConstants.EmptyAuthorizationCode, TransactionNumber = transactionNumber, Amount = amount }; transactionDataProvider.SavePersistentValue(reservationTicket.InvoiceNumber, PaymentConstants.ReservationTicket, reservationTicket); } break; } default: { string transactionErrorCode = this.ParseRes(xmlReturn, "/payex/errorDetails/transactionErrorCode"); if (transactionErrorCode == OperationCanceledError) { paymentStatusResult = PaymentStatus.Canceled; } break; } } } this.PaymentStatus = paymentStatusResult; }
public void SaveTransaction( ITransactionData transaction ) { storage.SaveTransaction( transaction ); }