本文整理汇总了C#中IPaymentMethod类的典型用法代码示例。如果您正苦于以下问题:C# IPaymentMethod类的具体用法?C# IPaymentMethod怎么用?C# IPaymentMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPaymentMethod类属于命名空间,在下文中一共展示了IPaymentMethod类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:qz2rg4,项目名称:Merchello-Debit-Order-Payment-Provider,代码行数:25,代码来源:DebitOrderController.cs
示例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;
}
开发者ID:naepalm,项目名称:Merchello,代码行数:8,代码来源:PaymentGatewayMethodBase.cs
示例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);
}
开发者ID:mydesignbuddy,项目名称:DesignPatterns,代码行数:9,代码来源:Customer.cs
示例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;
}
开发者ID:winmissupport,项目名称:FeatureUpate,代码行数:10,代码来源:AutoOrders.cs
示例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;
}
开发者ID:carbon,项目名称:Commerce,代码行数:17,代码来源:PaymentProcessorFactory.cs
示例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;
}
开发者ID:careerengine,项目名称:EGSW-Project,代码行数:19,代码来源:HomeController.cs
示例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;
}
开发者ID:neolee11,项目名称:aurora,代码行数:26,代码来源:CustomerOrderService.cs
示例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;
}
开发者ID:mandocaesar,项目名称:MesinkuNew,代码行数:23,代码来源:CheckoutController.cs
示例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
});
}
}
开发者ID:winmissupport,项目名称:FeatureUpate,代码行数:70,代码来源:EnrollmentController.cs
示例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;
}
开发者ID:Niitn,项目名称:nopCommerce,代码行数:13,代码来源:CheckoutController.cs
示例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)
{
}
开发者ID:jlarc,项目名称:Merchello,代码行数:13,代码来源:RedirectPaymentMethodBase.cs
示例16: CashPaymentGatewayMethod
public CashPaymentGatewayMethod(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod)
: base(gatewayProviderService, paymentMethod)
{
}
开发者ID:naepalm,项目名称:Merchello,代码行数:4,代码来源:CashPaymentGatewayMethod.cs
示例17: Delete
/// <summary>
/// Deletes a single <see cref="IPaymentMethod"/>
/// </summary>
/// <param name="paymentMethod">The <see cref="IPaymentMethod"/> to be deleted</param>
public void Delete(IPaymentMethod paymentMethod)
{
_paymentMethodService.Delete(paymentMethod);
}
开发者ID:koswesley,项目名称:Merchello-1,代码行数:8,代码来源:GatewayProviderService.cs
示例18: SagePayFormPaymentGatewayMethod
/// <summary>
/// Initializes a new instance of the <see cref="SagePayFormPaymentGatewayMethod"/> class.
/// </summary>
/// <param name="gatewayProviderService">
/// The <see cref="GatewayProviderService"/>.
/// </param>
/// <param name="paymentMethod">
/// The <see cref="IPaymentMethod"/>.
/// </param>
/// <param name="extendedData">
/// The SagePay providers <see cref="ExtendedDataCollection"/>
/// </param>
public SagePayFormPaymentGatewayMethod(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod, ExtendedDataCollection extendedData)
: base(gatewayProviderService, paymentMethod, extendedData)
{
// New instance of the SagePay payment processor
_processor = new SagePayFormPaymentProcessor(extendedData.GetProcessorSettings());
}
开发者ID:chrisdaaaaay,项目名称:Merchello.Plugins.SagePay,代码行数:18,代码来源:SagePayFormPaymentGatewayMethod.cs
示例19: ToPaymentMethod
internal static IPaymentMethod ToPaymentMethod(this PaymentMethodDisplay paymentMethodDisplay, IPaymentMethod destination)
{
if (paymentMethodDisplay.Key != Guid.Empty) destination.Key = paymentMethodDisplay.Key;
destination.Name = paymentMethodDisplay.Name;
destination.PaymentCode = paymentMethodDisplay.PaymentCode;
destination.Description = paymentMethodDisplay.Description;
return destination;
}
开发者ID:ProNotion,项目名称:Merchello,代码行数:10,代码来源:FullfillmentMappingExtensions.cs
示例20: PayPalExpressCheckoutPaymentGatewayMethod
/// <summary>
/// Initializes a new instance of the <see cref="PayPalExpressCheckoutPaymentGatewayMethod"/> class.
/// </summary>
/// <param name="gatewayProviderService">
/// The gateway provider service.
/// </param>
/// <param name="paymentMethod">
/// The payment method.
/// </param>
/// <param name="paypalApiService">
/// The <see cref="IPayPalApiService"/>.
/// </param>
public PayPalExpressCheckoutPaymentGatewayMethod(IGatewayProviderService gatewayProviderService, IPaymentMethod paymentMethod, IPayPalApiService paypalApiService)
: base(gatewayProviderService, paymentMethod)
{
Ensure.ParameterNotNull(paypalApiService, "payPalApiService");
this._paypalApiService = paypalApiService;
}
开发者ID:rustyswayne,项目名称:Merchello,代码行数:18,代码来源:PayPalExpressCheckoutPaymentGatewayMethod.cs
注:本文中的IPaymentMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论