public async Task When_getting_all_shipping_lines() { using (var contextFactory = new FakeShipRegistryContextFactory(_options)) { //arrange var uow = contextFactory.Create(); var repository = new ShippingLineRepositoryAsync(uow); var existingLineOne = new ShippingLine(new Id(), new LineName("Maersk")); await repository.AddAsync(existingLineOne); var existingLineTwo = new ShippingLine(new Id(), new LineName("Onassis")); await repository.AddAsync(existingLineTwo); var query = new ShippingLinesAllQuery(); var queryHandler = new ShippingLinesAllQueryHandler(contextFactory); //act var lines = await queryHandler.ExecuteAsync(query); //assert Assert.That(lines, Is.Not.Null); Assert.That(2, Is.EqualTo(lines.ShippingLines.Length)); } }
public void createShippingLine() { getApiKey(); conekta.Api.version = "2.0.0"; Order order = new conekta.Order().create(@"{ ""currency"":""MXN"", ""customer_info"": { ""name"": ""Jul Ceballos"", ""phone"": ""+5215555555555"", ""email"": ""*****@*****.**"" }, ""line_items"": [{ ""name"": ""Box of Cohiba S1s"", ""unit_price"": 35000, ""quantity"": 1 }] }"); Assert.AreEqual(order.id.GetType().ToString(), "System.String"); order = new Order().find(order.id); ShippingLine shipping_line = order.createShippingLine(@"{ ""amount"": 0, ""tracking_number"": ""TRACK123"", ""carrier"": ""USPS"", ""method"": ""Train"", ""metadata"": { ""random_key"": ""random_value"" } }"); Assert.AreEqual(shipping_line.tracking_number, "TRACK123"); }
public async Task When_updating_a_shipping_line_name() { using (var contextFactory = new FakeShipRegistryContextFactory(_options)) { //arrange var uow = contextFactory.Create(); var repository = new ShippingLineRepositoryAsync(uow); var existingLine = new ShippingLine(new Id(), new LineName("Maersk")); await repository.AddAsync(existingLine); var commandProcessor = new FakeCommandProcessor(); var command = new UpdateLineNameCommand(existingLine.Id, new LineName("Onassis")); var handler = new UpdateLineNameHandler(contextFactory, commandProcessor); //act await handler.HandleAsync(command); //assert var line = uow.Lines.SingleOrDefault(l => l.Id == existingLine.Id); Assert.That(line.LineName, Is.EqualTo(new LineName("Onassis"))); Assert.That(line.Version, Is.EqualTo(1)); var domainEvent = commandProcessor.Messages.SingleOrDefault(m => m.Action == Action.Post); Assert.That(domainEvent, Is.Not.Null); var addedMessage = (LineNameUpdatedEvent)domainEvent.Message; Assert.That(addedMessage.LineName, Is.EqualTo(new LineName("Onassis"))); Assert.That(addedMessage.Version, Is.EqualTo(1)); } }
public ActionResult Delete(int id) { ShippingLine con = db.ShippingLines.Where(x => x.ID == id).FirstOrDefault <ShippingLine>(); db.ShippingLines.Remove(con); db.SaveChanges(); return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet)); }
public override async Task <AddShippingLineCommand> HandleAsync(AddShippingLineCommand command, CancellationToken cancellationToken = new CancellationToken()) { using (var uow = _contextFactory.Create()) { var repository = new ShippingLineRepositoryAsync(uow); var line = new ShippingLine(new Id(command.Id), command.LineName); await repository.AddAsync(line); await _commandProcessor.PostAsync(new NewLineAddedEvent(line.Id, line.LineName)); } return(await base.HandleAsync(command, cancellationToken)); }
public ActionResult AddOrEdit(ShippingLine con) { if (con.ID == 0) { db.ShippingLines.Add(con); db.SaveChanges(); return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet)); } else { db.Entry(con).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet)); } }
public void updateShippingLine() { conekta.Api.apiKey = "key_eYvWV7gSDkNYXsmr"; conekta.Api.version = "2.0.0"; Order order = new conekta.Order().create(@"{ ""currency"":""MXN"", ""customer_info"": { ""name"": ""Jul Ceballos"", ""phone"": ""+5215555555555"", ""email"": ""*****@*****.**"" }, ""line_items"": [{ ""name"": ""Box of Cohiba S1s"", ""unit_price"": 35000, ""quantity"": 1 }] }" ); Assert.AreEqual(order.id.GetType().ToString(), "System.String"); order = new Order().find(order.id); ShippingLine shipping_line = order.createShippingLine(@"{ ""amount"": 0, ""tracking_number"": ""TRACK123"", ""carrier"": ""Fedex"", ""method"": ""Train"", ""contextual_data"": { ""random_key"": ""random_value"" } }" ); order = new Order().find(order.id); shipping_line = (ShippingLine)order.shipping_lines.at(0); shipping_line = shipping_line.update(@"{ ""carrier"": ""UPS"" }" ); Assert.AreEqual(shipping_line.carrier, "UPS"); }
public void Create(ShippingLineViewModel shippingLineVM) { var ShippingLine = new ShippingLine { Name = shippingLineVM.Name, AgentType = shippingLineVM.AgentType, BranchId = shippingLineVM.BranchId, Address = shippingLineVM.Address, PhoneNo = shippingLineVM.PhoneNo, MobileNo = shippingLineVM.MobileNo, FAX = shippingLineVM.FAX, Email = shippingLineVM.Email, Web = shippingLineVM.Web, ModifiedBy = shippingLineVM.ModifiedBy, MidifiedDate = shippingLineVM.MidifiedDate, Branch = shippingLineVM.Branch }; unitOfWork.ShippingLineRepository.Insert(ShippingLine); unitOfWork.Save(); }
public async Task When_getting_a_shipping_line() { using (var contextFactory = new FakeShipRegistryContextFactory(_options)) { //arrange var uow = contextFactory.Create(); var repository = new ShippingLineRepositoryAsync(uow); var existingLine = new ShippingLine(new Id(), new LineName("Maersk")); await repository.AddAsync(existingLine); var query = new ShippingLineByIdQuery(existingLine.Id); var queryHandler = new ShippingLineByIdQueryHandler(contextFactory); //act var line = await queryHandler.ExecuteAsync(query); //assert Assert.That(line, Is.Not.Null); Assert.That(line.Id, Is.EqualTo(existingLine.Id.Value)); Assert.That(line.LineName, Is.EqualTo(existingLine.LineName.ToString())); } }
public async Task When_removing_a_shipping_line() { using (var contextFactory = new FakeShipRegistryContextFactory(_options)) { //arrange var uow = contextFactory.Create(); var repository = new ShippingLineRepositoryAsync(uow); var existingLine = new ShippingLine(new Id(), new LineName("Maersk")); await repository.AddAsync(existingLine); var command = new RemoveLineCommand(existingLine.Id); var handler = new RemoveLineHandlerAsync(contextFactory); //act await handler.HandleAsync(command); //assert var line = uow.Lines.SingleOrDefault(l => l.Id == existingLine.Id); Assert.That(line, Is.Null); } }
private void lineNamesGridView_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { int RowHandler = e.RowHandle; int id = Convert.ToInt32(GetString(RowHandler, "Id")); ShippingLine shippingline = (id == 0) ? new ShippingLine() : Database.Connection.Get <ShippingLine>(id); shippingline.Name = GetString(RowHandler, "Name"); shippingline.Address = GetString(RowHandler, "Address"); shippingline.Phone = GetString(RowHandler, "Phone"); shippingline.Mail = GetString(RowHandler, "Mail"); if (id == 0) { Database.Connection.Insert <ShippingLine>(shippingline); lineNamesGridView.SetRowCellValue(RowHandler, "Id", shippingline.Id); } else { Database.Connection.Update <ShippingLine>(shippingline); } }
public ShippingLineByIdQueryResult(ShippingLine shippingLine) { Id = shippingLine.Id.Value; LineName = shippingLine.LineName.ToString(); }
public async Task <bool> RegistrarOrdenVenta(int ANIO, int MES, int SEMANA, CustomerGroup Customer, Consignee consignee, Notify Notify, ShippingLine Naviera, FinalClient Cliente, Country PaisDescarga, Port PuertoDescarga, Country PaisDestino, Vessel Nave, Country PaisEmbarque, Port PuertoEmbarque, SalesTerms TerminosVenta, TypeOfShipment TipoCarga, Brand Marca, BoxType TipoCaja, ExportedBy Exportador, Beneficiarios CiaFacturar, ArchivoBaseRow fila) { try { var op = _context.OrdenVentas.FirstOrDefault(c => c.Activo && c.cplan == fila.CPLAN && c.NumInvoiceSRI == fila.NFacturaSRI); if (op != null) { return(false); } OrdenVenta NuevoRegistro = new OrdenVenta(); var paisEC = _context.Countries.FirstOrDefault(c => c.Activo && c.Nombre.ToUpper() == "ECUADOR"); var tipoDoc = _context.TypeOfDocuments.FirstOrDefault(c => c.Activo && c.Nombre.ToUpper() == "COMMERCIAL INVOICE"); NuevoRegistro.FechaOrden = DateTime.Now; NuevoRegistro.ANIO = ANIO; NuevoRegistro.MES = MES; //NuevoRegistro.SEMANA = WeeksInYear(NuevoRegistro.FechaOrden); NuevoRegistro.SEMANA = SEMANA; NuevoRegistro.IdSalesTerms = TerminosVenta.IdSalesTerms; if (fila.TIPOCLIENTE == "CONTRATO") { NuevoRegistro.ContractTerms = true; } else { NuevoRegistro.ContractTerms = false; } NuevoRegistro.IdFDLorOtherInvoiceTo = Cliente.IdFinalClient; NuevoRegistro.IdCustomerGroup = Customer.IdCustomerGroup; NuevoRegistro.IdConsignee = consignee.IdConsignee; NuevoRegistro.IdNotify = Notify.IdNotify; NuevoRegistro.IdExportedBy = Exportador.IdExportedBy; NuevoRegistro.IdCiaFacturar = CiaFacturar.IdBeneficiario; NuevoRegistro.IdShippingLine = Naviera.IdShippingLine; NuevoRegistro.IdCountryFinalDestination = PaisDestino.IdCountry; NuevoRegistro.IdDischargePort = PuertoDescarga.IdPort; NuevoRegistro.IdCountryDiscargePort = PaisDescarga.IdCountry; NuevoRegistro.IdVessel = Nave.IdVessel; NuevoRegistro.Num_DAE = fila.DAE; NuevoRegistro.Num_BL = fila.No_BL; NuevoRegistro.NumInvoiceSRI = fila.NFacturaSRI; NuevoRegistro.IdTypeOfShipment = TipoCarga.IdTypeOfShipment; int c1 = 0; int c2 = 0; int.TryParse(fila.NUM_CTNRS.ToString(), out c1); int.TryParse(fila.CAJASTARJA.ToString(), out c2); NuevoRegistro.NumBOXES = c2; NuevoRegistro.NumCNTRS = c1; NuevoRegistro.INV_1_FDL_OR_OTHER_EXPORTERS_FOB_PRICE_SRI = fila.PRECIO_FOB; //NuevoRegistro.FDL_OR_OTHER_EXPORTERS_FOB_AMOUNT_PRICE = fila.PRECIO_FOB; //NuevoRegistro.FDL_OR_OTHER_EXPORTERS_FOB_PRICE_REAL = fila.PRECIO_FOB; NuevoRegistro.FINAL_SALES_PRICE = 0; NuevoRegistro.FINAL_SALES_PRICE_AMOUNT = 0; NuevoRegistro.DateOfInvoice = fila.FECHA_EMISION_FACT_EXPORT; NuevoRegistro.IdBrand = Marca.IdBrand; NuevoRegistro.IdBoxType = TipoCaja.IdBoxType; NuevoRegistro.DescripcionProducto = fila.PRODUCTO; NuevoRegistro.ReleaseDate = fila.FECHA_RELEASE; NuevoRegistro.TotalKiloBruto = fila.KILOBRUTO; NuevoRegistro.TotalKiloNeto = fila.KILONETO; NuevoRegistro.cplan = fila.CPLAN; NuevoRegistro.FechaCreacion = DateTime.Now; NuevoRegistro.Activo = true; NuevoRegistro.IdCountry = paisEC.IdCountry; NuevoRegistro.IdTypeOfDocument = tipoDoc.IdTypeOfDocument; NuevoRegistro.UsuarioCreacion = "SYSTEM"; _context.OrdenVentas.Add(NuevoRegistro); _context.SaveChanges(); return(true); } catch (Exception) { throw; } }
public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest) { /* * Dati transazione inviati verso GestPay * Alcuni dei parametri "importanti/principali" per creazione della stringa * "ShopLogin" :VarChar (30) - Obbligatorio - Codice Esercente (Shop Login) * "Currency" :Num (3) - Obbligatorio - Codice Identificativo della divisa per l'importo della transazione * "Amount" :Num (9) - Obbligatorio - [ll separatore delle migliaia non deve essere inserito. I decimali (max 2 cifre) sono opzionali ed il separatore è il punto.] * "ShopTransactionID" :VarChar (50) - Obbligatorio - Identificativo attribuito alla transazione dall'esercente. * "BuyerName" :VarChar (50) - Facoltativo - Nome e cognome dell'acquirente * "BuyerEmail" :VarChar (50) - Facoltativo - Indirizzo e-mail dell'acquirente * "Language" :Num (2) - Facoltativo - Codice che identifica la lingua utilizzata nella comunicazione con l'acquirente (vedi tabella Codici lingua). */ var encryptedString = ""; var errorDescription = ""; var nopBillingAddress = _addressService.GetAddressById(postProcessPaymentRequest.Order.BillingAddressId); var amount = Math.Round(postProcessPaymentRequest.Order.OrderTotal, 2); var shopTransactionId = postProcessPaymentRequest.Order.OrderGuid.ToString(); var buyerName = String.Format( "{0} {1}", nopBillingAddress?.FirstName, nopBillingAddress?.LastName ); var endpoint = _gestPayPaymentSettings.UseSandbox ? EndpointConfiguration.WSCryptDecryptSoap12Test : EndpointConfiguration.WSCryptDecryptSoap12; var objCryptDecrypt = new WSCryptDecryptSoapClient(endpoint); var billingCountry = _countryService.GetCountryById(Convert.ToInt32(nopBillingAddress.CountryId)); var billingStateProvince = _stateProvinceService.GetStateProvinceByAddress(nopBillingAddress); Address nopShippingAddress = null; Country shippingCountry = null; StateProvince shippingStateProvince = null; if (postProcessPaymentRequest.Order.ShippingAddressId != null) { nopShippingAddress = _addressService.GetAddressById((int)postProcessPaymentRequest.Order.ShippingAddressId); shippingCountry = _countryService.GetCountryById((int)nopShippingAddress.CountryId); shippingStateProvince = _stateProvinceService.GetStateProvinceByAddress(nopShippingAddress); } XmlNode xmlResponse; EcommGestpayPaymentDetails paymentDetails = new EcommGestpayPaymentDetails(); if (_gestPayPaymentSettings.EnableGuaranteedPayment) { FraudPrevention fraudPrevention = new FraudPrevention(); fraudPrevention.BeaconSessionID = _httpContextAccessor.HttpContext.Session.Id; fraudPrevention.SubmitForReview = "1"; fraudPrevention.OrderDateTime = postProcessPaymentRequest.Order.CreatedOnUtc.ToString(); fraudPrevention.Source = "desktop_web"; fraudPrevention.SubmissionReason = "rule_decision"; fraudPrevention.VendorName = _storeContext.CurrentStore.Name; paymentDetails.FraudPrevention = fraudPrevention; //var logger = Nop.Core.Infrastructure.EngineContext.Current.Resolve<Nop.Services.Logging.ILogger>(); //logger.Information("Gestpay BeaconId = " + _httpContextAccessor.HttpContext.Session.Id); var customer = _customerService.GetCustomerById(postProcessPaymentRequest.Order.CustomerId); CustomerDetail customerDetail = new CustomerDetail(); customerDetail.PrimaryEmail = nopBillingAddress?.Email; customerDetail.MerchantCustomerID = postProcessPaymentRequest.Order.CustomerId.ToString(); customerDetail.FirstName = nopBillingAddress?.FirstName; customerDetail.Lastname = nopBillingAddress?.LastName; customerDetail.PrimaryPhone = nopBillingAddress?.PhoneNumber; customerDetail.Company = nopBillingAddress?.Company; customerDetail.CreatedAtDate = customer?.CreatedOnUtc.ToString(); customerDetail.VerifiedEmail = "true"; customerDetail.AccountType = "normal"; paymentDetails.CustomerDetail = customerDetail; if (nopShippingAddress != null) { ShippingAddress shippingAddress = new ShippingAddress(); shippingAddress.ProfileID = postProcessPaymentRequest.Order.ShippingAddressId.ToString(); shippingAddress.FirstName = nopShippingAddress.FirstName; shippingAddress.Lastname = nopShippingAddress.LastName; shippingAddress.StreetName = nopShippingAddress.Address1; shippingAddress.Streetname2 = nopShippingAddress.Address2; shippingAddress.City = nopShippingAddress.City; shippingAddress.ZipCode = nopShippingAddress.ZipPostalCode; shippingAddress.State = shippingStateProvince?.Name; shippingAddress.CountryCode = shippingCountry?.TwoLetterIsoCode; shippingAddress.Email = nopShippingAddress.Email; shippingAddress.PrimaryPhone = nopShippingAddress.PhoneNumber; shippingAddress.Company = nopShippingAddress.Company; shippingAddress.StateCode = shippingStateProvince?.Abbreviation; paymentDetails.ShippingAddress = shippingAddress; } BillingAddress billingAddress = new BillingAddress(); billingAddress.ProfileID = postProcessPaymentRequest.Order.BillingAddressId.ToString(); billingAddress.FirstName = nopBillingAddress?.FirstName; billingAddress.Lastname = nopBillingAddress?.LastName; billingAddress.StreetName = nopBillingAddress?.Address1; billingAddress.Streetname2 = nopBillingAddress?.Address2; billingAddress.City = nopBillingAddress?.City; billingAddress.ZipCode = nopBillingAddress?.ZipPostalCode; billingAddress.State = billingStateProvince?.Name; billingAddress.CountryCode = billingCountry?.TwoLetterIsoCode; billingAddress.Email = nopBillingAddress?.Email; billingAddress.PrimaryPhone = nopBillingAddress?.PhoneNumber; billingAddress.Company = nopBillingAddress?.Company; billingAddress.StateCode = billingStateProvince?.Abbreviation; paymentDetails.BillingAddress = billingAddress; var orderItems = _orderService.GetOrderItems(postProcessPaymentRequest.Order.Id); var productDetails = new List <ProductDetail>(); decimal itemsTotalInclTax = 0; foreach (var item in orderItems) { var product = _productService.GetProductById(item.ProductId); if (product != null) { var productDetail = new ProductDetail(); productDetail.ProductCode = product.ManufacturerPartNumber; productDetail.SKU = product.Sku; productDetail.Name = product.Name; productDetail.Description = product.ShortDescription; productDetail.Quantity = item.Quantity.ToString(); productDetail.Price = item.PriceInclTax.ToString("0.00", CultureInfo.InvariantCulture); productDetail.UnitPrice = item.UnitPriceInclTax.ToString("0.00", CultureInfo.InvariantCulture); if ((!product.IsGiftCard && product.IsShipEnabled) || (product.IsGiftCard && product.GiftCardType == Core.Domain.Catalog.GiftCardType.Physical)) { productDetail.Type = "physical"; productDetail.RequiresShipping = "true"; } else { productDetail.Type = "digital"; productDetail.RequiresShipping = "false"; if (product.IsGiftCard) { DigitalGiftCardDetails giftcardDetails = new DigitalGiftCardDetails(); var associatedGiftCards = _giftCardService.GetAllGiftCards(postProcessPaymentRequest.Order.Id); foreach (var giftcard in associatedGiftCards) { giftcardDetails.SenderName = giftcard.SenderName; giftcardDetails.DisplayName = giftcard.SenderName; giftcardDetails.GreetingMessage = giftcard.Message; Recipient recipient = new Recipient(); recipient.Email = giftcard.RecipientEmail; giftcardDetails.Recipient = recipient; break; } productDetail.DigitalGiftCardDetails = giftcardDetails; } } productDetail.Vat = item.PriceInclTax > 0 ? "22" : "0"; productDetail.Condition = "new"; var productManufacturers = _manufacturerService.GetProductManufacturersByProductId(product.Id); productDetail.Brand = _manufacturerService.GetManufacturerById((int)productManufacturers.FirstOrDefault()?.ManufacturerId)?.Name; //productDetail.DeliveryAt = "home"; productDetails.Add(productDetail); itemsTotalInclTax += item.UnitPriceInclTax * item.Quantity; } } paymentDetails.ProductDetails = productDetails.ToArray(); IList <DiscountCode> discountCodes = new List <DiscountCode>(); IList <ShippingLine> shippingLines = new List <ShippingLine>(); // Discount on Sub Total var subTotalDiscountCode = new DiscountCode(); subTotalDiscountCode.Code = "Order subtotal discount"; subTotalDiscountCode.Amount = postProcessPaymentRequest.Order.OrderSubTotalDiscountInclTax.ToString("0.00", CultureInfo.InvariantCulture); discountCodes.Add(subTotalDiscountCode); // Discount on Total var discountCode = new DiscountCode(); discountCode.Code = "Order total discount"; discountCode.Amount = postProcessPaymentRequest.Order.OrderDiscount.ToString("0.00", CultureInfo.InvariantCulture); discountCodes.Add(discountCode); // Shipping var shipping = new ShippingLine(); shipping.Code = postProcessPaymentRequest.Order.ShippingRateComputationMethodSystemName; shipping.Title = postProcessPaymentRequest.Order.ShippingRateComputationMethodSystemName; shipping.Price = postProcessPaymentRequest.Order.OrderShippingInclTax.ToString("0.00", CultureInfo.InvariantCulture); shippingLines.Add(shipping); // Additional Charges / GiftWrap / GiftCard var extraAdjustment = postProcessPaymentRequest.Order.OrderTotal - (itemsTotalInclTax + postProcessPaymentRequest.Order.OrderShippingInclTax - postProcessPaymentRequest.Order.OrderDiscount - postProcessPaymentRequest.Order.OrderSubTotalDiscountInclTax); if (extraAdjustment > 0) { var additionalShipping = new ShippingLine(); additionalShipping.Code = "Additional Charge/Giftwrap"; additionalShipping.Title = "Additional Charge/Giftwrap"; additionalShipping.Price = extraAdjustment.ToString("0.00", CultureInfo.InvariantCulture); shippingLines.Add(additionalShipping); } else { var additionalDiscount = new DiscountCode(); additionalDiscount.Code = "Giftcard/Additional Discount"; additionalDiscount.Amount = (extraAdjustment * -1).ToString("0.00", CultureInfo.InvariantCulture); // * -1 converts into positive number discountCodes.Add(additionalDiscount); } paymentDetails.DiscountCodes = discountCodes.ToArray(); paymentDetails.ShippingLines = shippingLines.ToArray(); } // 3DS var threeDSTransDetails = new ThreeDSEncryptTransDetails(); threeDSTransDetails.type = "EC"; threeDSTransDetails.authenticationAmount = amount.ToString("0.00", CultureInfo.InvariantCulture); var threeDSContainer = new EncryptThreeDsContainer(); threeDSContainer.transTypeReq = "P"; //threeDSContainer.exemption = "SKIP"; As asked by Gestpay Support BuyerDetails buyerDetails = new BuyerDetails(); ThreeDSBillingAddress threeDSBillingAddress = new ThreeDSBillingAddress(); threeDSBillingAddress.line1 = nopBillingAddress?.Address1; threeDSBillingAddress.line2 = nopBillingAddress?.Address2; threeDSBillingAddress.city = nopBillingAddress?.City; threeDSBillingAddress.postCode = nopBillingAddress?.ZipPostalCode; threeDSBillingAddress.state = billingStateProvince?.Name; threeDSBillingAddress.country = billingCountry?.TwoLetterIsoCode; buyerDetails.billingAddress = threeDSBillingAddress; if (nopShippingAddress != null) { ThreeDSShippingAddress threeDSShippingAddress = new ThreeDSShippingAddress(); threeDSShippingAddress.line1 = nopShippingAddress?.Address1; threeDSShippingAddress.line2 = nopShippingAddress?.Address2; threeDSShippingAddress.city = nopShippingAddress?.City; threeDSShippingAddress.postCode = nopShippingAddress?.ZipPostalCode; threeDSShippingAddress.state = shippingStateProvince?.Name; threeDSShippingAddress.country = shippingCountry?.TwoLetterIsoCode; buyerDetails.shippingAddress = threeDSShippingAddress; } buyerDetails.addrMatch = "N"; threeDSContainer.buyerDetails = buyerDetails; threeDSTransDetails.threeDsContainer = threeDSContainer; xmlResponse = objCryptDecrypt.EncryptAsync( _gestPayPaymentSettings.ShopOperatorCode, _gestPayPaymentSettings.CurrencyUiCcode.ToString(), amount.ToString("0.00", CultureInfo.InvariantCulture), shopTransactionId, "", "", "", buyerName, nopBillingAddress.Email, _gestPayPaymentSettings.LanguageCode.ToString(), "", "Order Number = " + postProcessPaymentRequest.Order.CustomOrderNumber, "", "", "", null, null, null, "", null, null, null, null, null, null, "", null, "", "", paymentDetails, _gestPayPaymentSettings.ApiKey, threeDSTransDetails).Result.EncryptResult; XmlDocument xmlReturn = new XmlDocument(); xmlReturn.LoadXml(xmlResponse.OuterXml); string errorCode = xmlReturn.SelectSingleNode("/GestPayCryptDecrypt/ErrorCode")?.InnerText; if (errorCode == "0") { encryptedString = xmlReturn.SelectSingleNode("/GestPayCryptDecrypt/CryptDecryptString")?.InnerText; } else { //Put error handle code HERE errorDescription = xmlReturn.SelectSingleNode("/GestPayCryptDecrypt/ErrorDescription")?.InnerText; } var builder = new StringBuilder(); if (!String.IsNullOrEmpty(encryptedString)) { builder.Append(GetGestPayUrl()); builder.AppendFormat("?a={0}&b={1}", _gestPayPaymentSettings.ShopOperatorCode, encryptedString); } else { //Errore builder.Append(_webHelper.GetStoreLocation(false) + "Plugins/PaymentGestPay/Error"); builder.AppendFormat("?type=0&errc={0}&errd={1}", HttpUtility.UrlEncode(errorCode), HttpUtility.UrlEncode(errorDescription)); } _httpContextAccessor.HttpContext.Response.Redirect(builder.ToString()); }
public static ShippingLine ToEntity(this ShippingLineModel model, ShippingLine destination) { return(AutoMapperConfiguration.Mapper.Map(model, destination)); }
public static ShippingLineModel ToModel(this ShippingLine entity) { return(AutoMapperConfiguration.Mapper.Map <ShippingLine, ShippingLineModel>(entity)); }