public static Payment TowebModel(this VirtoCommerceCartModuleWebModelPayment payment, Currency currency) { var webModel = new Payment(currency); webModel.InjectFrom(payment); webModel.Amount = new Money(payment.Amount ?? 0, currency); if (payment.BillingAddress != null) { webModel.BillingAddress = payment.BillingAddress.ToWebModel(); } webModel.Currency = currency; return webModel; }
public static Payment TowebModel(this VirtoCommerceCartModuleWebModelPayment payment) { var webModel = new Payment(); var currency = new Currency(EnumUtility.SafeParse(payment.Currency, CurrencyCodes.USD)); webModel.InjectFrom(payment); webModel.Amount = new Money(payment.Amount ?? 0, currency.Code); if (payment.BillingAddress != null) { webModel.BillingAddress = payment.BillingAddress.ToWebModel(); } webModel.Currency = currency; return webModel; }