本文整理汇总了C#中PaymentMethod类的典型用法代码示例。如果您正苦于以下问题:C# PaymentMethod类的具体用法?C# PaymentMethod怎么用?C# PaymentMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PaymentMethod类属于命名空间,在下文中一共展示了PaymentMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPaymentMethods
public void AddPaymentMethods(PaymentMethod method, SelectList list)
{
if (PaymentMethodsList == null)
InitPaymentMethodsList(null);
PaymentMethodsList.ItemsList.Add(method, list);
}
示例2: GivenTheFollowingTransaction
public void GivenTheFollowingTransaction(string category, string paymentMethod, Table data)
{
_paymentMethodService = new PaymentMethodService(new PaymentMethodRepository(context));
switch (_transactionType)
{
case TransactionTypes.Income:
_transaction = data.CreateInstance<Income>();
_transactionService = new IncomeService(new IncomeRepository(context));
_categoryService = new IncomeCategoryService(new IncomeCategoryRepository(context));
break;
case TransactionTypes.Expense:
_transaction = data.CreateInstance<Expense>();
_transactionService = new ExpenseService(new ExpenseRepository(context));
_categoryService = new ExpenseCategoryService(new ExpenseCategoryRepository(context));
break;
}
if (!string.IsNullOrWhiteSpace(paymentMethod))
{
_paymentMethod = new PaymentMethod(0, paymentMethod);
_transaction.Method = _paymentMethod;
}
if (!string.IsNullOrWhiteSpace(category))
{
_category = new DataClasses.Category(0, category);
_transaction.Category = _category;
}
if (_transaction.Date.Equals(default(DateTime)))
{
_transaction.Date = DateTime.Today;
}
}
示例3: PaymentRecord
public static ImportNotificationTransaction PaymentRecord(Guid notificationId,
DateTime date,
decimal amount,
PaymentMethod paymentMethod,
string receiptNumber,
string comments)
{
if (paymentMethod == Core.Shared.PaymentMethod.Cheque)
{
Guard.ArgumentNotNullOrEmpty(() => receiptNumber, receiptNumber);
}
else
{
receiptNumber = "NA";
}
return new ImportNotificationTransaction
{
PaymentMethod = paymentMethod,
NotificationId = notificationId,
Date = date,
ReceiptNumber = receiptNumber,
Comments = comments,
Credit = amount
};
}
示例4: CreatePayment
public Payment CreatePayment(string email, PaymentMethod payMethod, string orderAmount, string orderDescription)
{
Payment pay = null;
Amount amount = new Amount();
amount.currency = "USD";
amount.total = orderAmount;
Transaction transaction = new Transaction();
transaction.amount = amount;
transaction.description = orderDescription;
List<Transaction> transactions = new List<Transaction>();
transactions.Add(transaction);
FundingInstrument fundingInstrument = new FundingInstrument();
CreditCardToken creditCardToken = new CreditCardToken();
creditCardToken.credit_card_id = GetSignedInUserCreditCardId(email);
fundingInstrument.credit_card_token = creditCardToken;
List<FundingInstrument> fundingInstrumentList = new List<FundingInstrument>();
fundingInstrumentList.Add(fundingInstrument);
Payer payr = new Payer();
payr.funding_instruments = fundingInstrumentList;
payr.payment_method = payMethod.ToString();
Payment paymnt = new Payment();
paymnt.intent = "sale";
paymnt.payer = payr;
paymnt.transactions = transactions;
pay = paymnt.Create(Api);
return pay;
}
示例5: GivenTheFollowingTransaction
public void GivenTheFollowingTransaction(string category, string paymentMethod, Table data)
{
_paymentMethodService = new PaymentMethodService(new PaymentMethodRepository(context));
switch (_transactionType)
{
case TransactionTypes.Income:
_transaction = data.CreateInstance<Income>();
_transactionService = new IncomeService(new IncomeRepository(context));
_categoryService = new IncomeCategoryService(new IncomeCategoryRepository(context));
break;
case TransactionTypes.Expense:
_transaction = data.CreateInstance<Expense>();
_transactionService = new ExpenseService(new ExpenseRepository(context));
_categoryService = new ExpenseCategoryService(new ExpenseCategoryRepository(context));
break;
}
_paymentMethod = _paymentMethodService.Create(paymentMethod);
_transaction.Method = _paymentMethod;
_transaction.PaymentMethodId = _paymentMethod.Id;
_category = _categoryService.Create(category);
_transaction.Category = _category;
_transaction.CategoryId = _category.Id;
_transaction.Date = DateTime.Today;
_transaction.Id = 1;
_transactionService.Create(_transaction);
}
示例6: Configure
public ActionResult Configure([Bind(Prefix = "Form")]PaymentConfigureForm form, string module)
{
var model = new PaymentConfigureViewModel();
SetupConfigureViewModel(model, module);
if (ModelState.IsValid)
{
var paymentModule = _paymentModuleManager.CreateModule(module);
//// TODO: setup paymentModule from form values
var method = new PaymentMethod
{
Name = paymentModule.Name
};
_paymentModuleManager.SaveModuleToMethod(paymentModule, method);
using (var transaction = _session.BeginTransaction())
{
_session.Save(method);
transaction.Commit();
}
TempData["SuccessMessage"] = "Payment method has been activated";
return RedirectToAction("Index");
}
return View(model);
}
示例7: Order
public Order(Customer customer, string shippingRegion, PaymentMethod paymentMethod, DateTime placed)
{
Customer = customer;
ShippingRegion = shippingRegion;
PaymentMethod = paymentMethod;
Placed = placed;
}
示例8: Order
public Order(string id, int value, State state, decimal total, PaymentMethod paymentMethod) {
Id = id;
Value = value;
State = state;
Total = total;
PaymentMethod = paymentMethod;
}
示例9: Pay
public void Pay(Guid orderId, PaymentMethod methodOfPayment, decimal amount)
{
if (paid.Contains(orderId))
{
Console.WriteLine("Free money awesome");
}
if (methodOfPayment == PaymentMethod.Check)
{
throw new InvalidOperationException("[Thread {0}] We don't take checks");
}
if (methodOfPayment == PaymentMethod.CreditCard)
{
Console.WriteLine("[Thread {0}] Please enter your pin", Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(5000);
Console.WriteLine("[Thread {0}] Hit OK", Thread.CurrentThread.ManagedThreadId);
}
Console.WriteLine("[Thread {0}] Thank you!", Thread.CurrentThread.ManagedThreadId);
paid.Add(orderId);
bus.Publish(new PaymentReceived
{
OrderId = orderId,
Amount = amount
});
}
示例10: Equals_Name_Differs
public void Equals_Name_Differs()
{
var first = new PaymentMethod(0, "name");
var second = new PaymentMethod(0, "other name");
Assert.AreNotSame(first, second);
Assert.IsFalse(first.Equals(second));
Assert.IsFalse(second.Equals(first));
}
示例11: Equals_All_Fields_Same
public void Equals_All_Fields_Same()
{
var first = new PaymentMethod(0, "name");
var second = new PaymentMethod(0, "name");
Assert.AreNotSame(first, second);
Assert.IsTrue(first.Equals(second));
Assert.IsTrue(second.Equals(first));
}
示例12: AuthorizeCvvResponsesShouldReturnProcessorCvvResultCodeM
public void AuthorizeCvvResponsesShouldReturnProcessorCvvResultCodeM()
{
defaultPaymentMethod = PaymentMethod.Create(defaultPayload.Merge(new PaymentMethodPayload() { Cvv = "111" }));
var transaction = Processor.TheProcessor.Authorize(defaultPaymentMethod.PaymentMethodToken,
"1.00", new TransactionPayload() { BillingReference = rand });
Assert.IsTrue( transaction.Success() );
Assert.AreEqual( "M", transaction.ProcessorResponse.CvvResultCode );
}
示例13: ToWebModel
public static PaymentMethod ToWebModel(this VirtoCommerceCartModuleWebModelPaymentMethod paymentMethod)
{
var paymentMethodWebModel = new PaymentMethod();
paymentMethodWebModel.InjectFrom(paymentMethod);
return paymentMethodWebModel;
}
示例14: BtnCreate_Click
protected void BtnCreate_Click( object sender, EventArgs e )
{
if ( Page.IsValid ) {
PaymentMethod paymentMethod = new PaymentMethod( StoreId, TxtName.Text );
paymentMethod.Save();
base.Redirect( WebUtils.GetPageUrl( Constants.Pages.EditPaymentMethod ) + "?id=" + paymentMethod.Id + "&storeId=" + paymentMethod.StoreId );
}
}
示例15: Update
public void Update(PaymentMethod paymentMethod)
{
paymentMethod = Validate(paymentMethod);
_paymentMethods.Attach(paymentMethod);
_repository.Entry(paymentMethod).State = EntityState.Modified;
_repository.SaveChanges();
}