本文整理汇总了C#中IPaymentMethod类的典型用法代码示例。如果您正苦于以下问题:C# IPaymentMethod类的具体用法?C# IPaymentMethod怎么用?C# IPaymentMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPaymentMethod类属于命名空间,在下文中一共展示了IPaymentMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BraintreePaymentGatewayMethodBase
/// <summary>
/// Initializes a new instance of the <see cref="BraintreePaymentGatewayMethodBase"/> class.
/// </summary>
/// <param name="gatewayProviderService">
/// The gateway provider service.
/// </param>
/// <param name="paymentMethod">
/// The payment method.
/// </param>
/// <param name="braintreeApiService">
/// The braintree api service.
/// </param>
protected BraintreePaymentGatewayMethodBase(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod, IBraintreeApiService braintreeApiService)
: base(gatewayProviderService, paymentMethod)
{
Mandate.ParameterNotNull(braintreeApiService, "braintreeApiService");
_braintreeApiService = braintreeApiService;
}
开发者ID:cmgrey83,项目名称:Merchello.Plugin.Payment.Braintree,代码行数:19,代码来源:BraintreePaymentGatewayMethodBase.cs
示例2: PerformProcessPayment
protected override IPaymentResult PerformProcessPayment(SalePreparationBase preparation, IPaymentMethod paymentMethod)
{
// We have to use the CheckoutConfirmationModel in this implementation. If this were to be used
// outside of a demo, you could consider writing your own base controller that inherits directly from
// Merchello.Web.Mvc.PaymentMethodUiController<TModel> and complete the transaction there in which case the
// BazaarPaymentMethodFormControllerBase would be a good example.
var form = UmbracoContext.HttpContext.Request.Form;
var DebitOrderNumber = form.Get("DebitOrderNumber");
if (string.IsNullOrEmpty(DebitOrderNumber))
{
var invalidData = new InvalidDataException("The Purchase Order Number cannot be an empty string");
return new PaymentResult(Attempt<IPayment>.Fail(invalidData), null, false);
}
// You need a ProcessorArgumentCollection for this transaction to store the payment method nonce
// The braintree package includes an extension method off of the ProcessorArgumentCollection - SetPaymentMethodNonce([nonce]);
var args = new ProcessorArgumentCollection();
args.SetDebitOrderNumber(DebitOrderNumber);
// We will want this to be an Authorize(paymentMethod.Key, args);
// -- Also in a real world situation you would want to validate the PO number somehow.
return preparation.AuthorizePayment(paymentMethod.Key, args);
}
示例3: BraintreeSubscriptionRecordPaymentMethod
/// <summary>
/// Initializes a new instance of the <see cref="BraintreeSubscriptionRecordPaymentMethod"/> class.
/// </summary>
/// <param name="gatewayProviderService">
/// The gateway provider service.
/// </param>
/// <param name="paymentMethod">
/// The payment method.
/// </param>
/// <param name="braintreeApiService">The <see cref="IBraintreeApiService"/></param>
public BraintreeSubscriptionRecordPaymentMethod(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod, IBraintreeApiService braintreeApiService)
: base(gatewayProviderService, paymentMethod)
{
Mandate.ParameterNotNull(braintreeApiService, "braintreeApiService");
_braintreeApiService = braintreeApiService;
}
开发者ID:cmgrey83,项目名称:Merchello.Plugin.Payment.Braintree,代码行数:17,代码来源:BraintreeSubscriptionRecordPaymentMethod.cs
示例4: PaymentGatewayMethodBase
protected PaymentGatewayMethodBase(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod)
{
Mandate.ParameterNotNull(gatewayProviderService, "gatewayProviderService");
Mandate.ParameterNotNull(paymentMethod, "paymentMethod");
_gatewayProviderService = gatewayProviderService;
_paymentMethod = paymentMethod;
}
示例5: MakePayment
public void MakePayment(decimal amount, IPaymentMethod paymentMethod=null)
{
if (paymentMethod != null)
{
PaymentMethod = paymentMethod;
}
Console.WriteLine("{0} will paid with {1}", Name, PaymentMethod.Name);
PaymentMethod.Pay(amount);
}
示例6: ProcessPayment
// AuthorizeCapturePayment will save the invoice with an Invoice Number.
private IPaymentResult ProcessPayment(SalePreparationBase preparation, IPaymentMethod paymentMethod, string paymentMethodNonce)
{
// You need a ProcessorArgumentCollection for this transaction to store the payment method nonce
// The braintree package includes an extension method off of the ProcessorArgumentCollection - SetPaymentMethodNonce([nonce]);
var args = new ProcessorArgumentCollection();
args.SetPaymentMethodNonce(paymentMethodNonce);
// We will want this to be an AuthorizeCapture(paymentMethod.Key, args);
return preparation.AuthorizeCapturePayment(paymentMethod.Key, args);
}
开发者ID:cmgrey83,项目名称:Merchello.Plugin.Payment.Braintree,代码行数:11,代码来源:BraintreeStandardTransactionController.cs
示例7: GetAutoOrderPaymentType
public static AutoOrderPaymentType GetAutoOrderPaymentType(IPaymentMethod paymentMethod)
{
if (!(paymentMethod is IAutoOrderPaymentMethod)) throw new Exception("The provided payment method does not implement IAutoOrderPaymentMethod.");
if (paymentMethod is CreditCard) return ((CreditCard)paymentMethod).AutoOrderPaymentType;
if (paymentMethod is BankAccount) return ((BankAccount)paymentMethod).AutoOrderPaymentType;
if (paymentMethod is Ideal) return ((Ideal)paymentMethod).AutoOrderPaymentType;
return AutoOrderPaymentType.WillSendPayment;
}
示例8: PerformProcessPayment
/// <summary>
/// Responsible for actually processing the payment with the PaymentProvider
/// </summary>
/// <param name="preparation">
/// The preparation.
/// </param>
/// <param name="paymentMethod">
/// The payment method.
/// </param>
/// <returns>
/// The <see cref="IPaymentResult"/>.
/// </returns>
protected override IPaymentResult PerformProcessPayment(SalePreparationBase preparation, IPaymentMethod paymentMethod)
{
// ----------------------------------------------------------------------------
// WE NEED TO GET THE PAYMENT METHOD "NONCE" FOR BRAINTREE
var form = UmbracoContext.HttpContext.Request.Form;
var paymentMethodNonce = form.Get("payment_method_nonce");
// ----------------------------------------------------------------------------
return this.ProcessPayment(preparation, paymentMethod, paymentMethodNonce);
}
开发者ID:cmgrey83,项目名称:Merchello.Plugin.Payment.Braintree,代码行数:24,代码来源:BraintreeStandardTransactionController.cs
示例9: Get
public IPaymentProcessor Get(IPaymentMethod paymentMethod)
{
#region Preconditions
if (paymentMethod == null) throw new ArgumentNullException("paymentMethod");
#endregion
var processor = processors.FirstOrDefault(p => p.Accepts(paymentMethod));
if (processor == null)
{
throw new Exception("No registered processors accept '{0}'.".FormatWith(paymentMethod.GetType().ToString()));
}
return processor;
}
示例10: HomeController
public HomeController(IDbContext context, IAuthenticationService authenticationService, IWorkContext workContext, ICustomerService customerService,
IQuestionAnswerEntityData questionAnswerEntityDataService, HttpContextBase httpContext,
IPaymentMethod paymentMethod, IOrderService orderService, IWebHelper webHelper,
IWorkflowMessageService workflowMessageService, IZipCodeService zipCodeService,
IDbContext dbContext)
{
this._context = context;
this._authenticationService = authenticationService;
this._customerService = customerService;
this._workContext = workContext;
this._questionAnswerEntityDataService = questionAnswerEntityDataService;
this._httpContext = httpContext;
this._paymentMethod = paymentMethod;
this._orderService = orderService;
this._webHelper = webHelper;
this._workflowMessageService = workflowMessageService;
this._zipCodeService = zipCodeService;
this._dbContext = dbContext;
}
示例11: Checkout
/// <summary>
/// Check out a shopping cart
/// </summary>
/// <param name="purchaseItemList"></param>
/// <param name="customer"></param>
/// <param name="payment"></param>
/// <param name="shippingMethod"></param>
public static CustomerOrder Checkout(IPurchaseItemList purchaseItemList, CustomerBase customer, IPaymentMethod payment, IShippingMethod shippingMethod)
{
var customerOrder = new CustomerOrder();
customerOrder.OrderDateTime = DateTime.Now;
purchaseItemList.Items.ForEach(i => customerOrder.Items.Add(i.Clone()));
customerOrder.Customer = customer;
customerOrder.Status = EOrderStatus.Processing;
customerOrder.ShippingMethod = shippingMethod.MethodName();
customerOrder.PaymentMethod = payment.PaymentName();
customerOrder.ProductCost = purchaseItemList.GetTotalPrice();
customerOrder.ShippingCost = GetShippingCost(customer, shippingMethod);
customerOrder.TotalCost = customerOrder.ProductCost + customerOrder.ShippingCost;
payment.Charge(customerOrder.TotalCost);
//todo : persist order
return customerOrder;
}
示例12: IsValidPaymentForm
private bool IsValidPaymentForm(IPaymentMethod paymentMethod, FormCollection form)
{
var paymentControllerType = paymentMethod.GetControllerType();
var paymentController = DependencyResolver.Current.GetService(paymentControllerType) as PaymentControllerBase;
var warnings = paymentController.ValidatePaymentForm(form);
foreach (var warning in warnings)
{
ModelState.AddModelError("", warning);
}
if (ModelState.IsValid)
{
var paymentInfo = paymentController.GetPaymentInfo(form);
_httpContext.Session["OrderPaymentInfo"] = paymentInfo;
_httpContext.GetCheckoutState().PaymentSummary = paymentController.GetPaymentSummary(form);
return true;
}
return false;
}
示例13: UsePaymentMethod
public ActionResult UsePaymentMethod(IPaymentMethod paymentMethod, int PaymentTypeID = 0)
{
try
{
// Check for redirect payment type : 999 = Ideal
if (PaymentTypeID == 999)
{
var ideal = paymentMethod.As<Ideal>();
PropertyBag.PaymentMethod = ideal;
PropertyBag.PaymentTypeID = 999;
PropertyBag.IsRedirectPayment = true;
Exigo.PropertyBags.Update(PropertyBag);
}
else
{
var message = "";
if (paymentMethod.CanBeParsedAs<CreditCard>())
{
var creditCard = paymentMethod.As<CreditCard>();
PropertyBag.PaymentMethod = creditCard;
PropertyBag.IsRedirectPayment = false;
Exigo.PropertyBags.Update(PropertyBag);
if (creditCard.IsExpired)
{
message = "Please enter a card that is not expired before proceeding.";
return new JsonNetResult(new
{
success = false,
message = message
});
}
if (!creditCard.IsComplete)
{
message = "Please enter a card that is complete before proceeding.";
return new JsonNetResult(new
{
success = false,
message = message
});
}
//if (paymentMethod.IsValid)
//{
// PropertyBag.PaymentMethod = paymentMethod;
// Exigo.PropertyBags.Update(PropertyBag);
//}
}
}
return new JsonNetResult(new
{
success = true
});
}
catch (Exception ex)
{
return new JsonNetResult(new
{
success = false,
message = ex.Message
});
}
}
示例14: PreparePaymentInfoModel
protected CheckoutPaymentInfoModel PreparePaymentInfoModel(IPaymentMethod paymentMethod)
{
var model = new CheckoutPaymentInfoModel();
string actionName;
string controllerName;
RouteValueDictionary routeValues;
paymentMethod.GetPaymentInfoRoute(out actionName, out controllerName, out routeValues);
model.PaymentInfoActionName = actionName;
model.PaymentInfoControllerName = controllerName;
model.PaymentInfoRouteValues = routeValues;
model.DisplayOrderTotals = _orderSettings.OnePageCheckoutDisplayOrderTotalsOnPaymentInfoTab;
return model;
}
示例15: RedirectPaymentMethodBase
/// <summary>
/// Initializes a new instance of the <see cref="RedirectPaymentMethodBase"/> class.
/// </summary>
/// <param name="gatewayProviderService">
/// The gateway provider service.
/// </param>
/// <param name="paymentMethod">
/// The payment method.
/// </param>
protected RedirectPaymentMethodBase(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod)
: base(gatewayProviderService, paymentMethod)
{
}