public IPaymentSystemClient GetClient(IPaymentSource source) { var client = m_locator.InstantiateNow<IPaymentSystemClient>(source.ClientClass); client.Entity = source; return client; }
public BillingSource(IPaymentSource source) { if (source is BankAccount bankAccount) { Type = PaymentMethodType.BankAccount; Description = $"{bankAccount.BankName}, *{bankAccount.Last4} - " + (bankAccount.Status == "verified" ? "verified" : bankAccount.Status == "errored" ? "invalid" : bankAccount.Status == "verification_failed" ? "verification failed" : "unverified"); NeedsVerification = bankAccount.Status == "new" || bankAccount.Status == "validated"; } else if (source is Card card) { Type = PaymentMethodType.Card; Description = $"{card.Brand}, *{card.Last4}, " + string.Format("{0}/{1}", string.Concat(card.ExpMonth < 10 ? "0" : string.Empty, card.ExpMonth), card.ExpYear); CardBrand = card.Brand; } else if (source is Source src && src.Card != null) { Type = PaymentMethodType.Card; Description = $"{src.Card.Brand}, *{src.Card.Last4}, " + string.Format("{0}/{1}", string.Concat(src.Card.ExpMonth < 10 ? "0" : string.Empty, src.Card.ExpMonth), src.Card.ExpYear); CardBrand = src.Card.Brand; } }
internal static PaymentInfo GetValidPaymentInfo(IPaymentSource source = null) { return(new PaymentInfo { Amount = 3500, Currency = "SAR", Description = "Chinese Noodles Meal", Source = source ?? GetValidCcSource(), CallbackUrl = "http://mysite.test/payment_callback", Metadata = new Dictionary <string, string> { { "order_id", "1232141" }, { "store_note", "okay" } } }); }