本文整理汇总了C#中CreditCard类的典型用法代码示例。如果您正苦于以下问题:C# CreditCard类的具体用法?C# CreditCard怎么用?C# CreditCard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CreditCard类属于命名空间,在下文中一共展示了CreditCard类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Charge
public static bool Charge(Customer customer, CreditCard creditcard, decimal amount)
{
var myCharge = new StripeChargeCreateOptions();
// always set these properties
myCharge.Amount = (int)amount*100;
myCharge.Currency = "usd";
// setting up the card
myCharge.Source = new StripeSourceOptions()
{
Object = "card",
Number = creditcard.creditCardNumber,
ExpirationMonth = creditcard.expiryDateMonth,
ExpirationYear = creditcard.expiryDateYear,
Cvc = creditcard.securityCode // optional
};
var chargeService = new StripeChargeService(StripeApiKey);
StripeCharge apiResponse = chargeService.Create(myCharge);
if(apiResponse.Paid == false)
{
throw new Exception(apiResponse.FailureMessage);
}
return apiResponse.Paid;
}
开发者ID:IrisCaffin,项目名称:12-PaymentKiosk,代码行数:33,代码来源:MoneyService.cs
示例2: Insert
///<summary>Inserts one CreditCard into the database. Returns the new priKey.</summary>
internal static long Insert(CreditCard creditCard)
{
if(DataConnection.DBtype==DatabaseType.Oracle) {
creditCard.CreditCardNum=DbHelper.GetNextOracleKey("creditcard","CreditCardNum");
int loopcount=0;
while(loopcount<100){
try {
return Insert(creditCard,true);
}
catch(Oracle.DataAccess.Client.OracleException ex){
if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
creditCard.CreditCardNum++;
loopcount++;
}
else{
throw ex;
}
}
}
throw new ApplicationException("Insert failed. Could not generate primary key.");
}
else {
return Insert(creditCard,false);
}
}
开发者ID:nampn,项目名称:ODental,代码行数:26,代码来源:CreditCardCrud.cs
示例3: Orders
public Orders()
{
_creditCard = new CreditCard();
_orderDetails = new OrderDetails();
_endUser = new EndUser();
_shippingAddress = new Address();
}
开发者ID:simonbegg,项目名称:LiveFreeRange,代码行数:7,代码来源:Orders.cs
示例4: InsertContactTest
public void InsertContactTest()
{
var dl = new DriversLicense
{
LicenseNumber = "12345678",
DateOfBirth = DateTime.Today,
Expiry = DateTime.Today
};
var cc = new CreditCard
{
CardNumber = "123123131312",
NameOnCard = "J Bloggs",
ExpiryDate = "02/12",
CreditCardType = CreditCardType.Visa
};
var contact = new Contact
{
Name = "Joe Bloggs",
Email = "[email protected]",
DriversLicense = dl,
CreditCard = cc,
};
contactRepository.InsertContact(contact);
Assert.IsNotNull(contact.Id);
}
开发者ID:robgray,项目名称:Tucana,代码行数:28,代码来源:ContactRepositoryTests.cs
示例5: Charge
public static bool Charge(Customer cus, CreditCard cc, decimal amount) //PRD)
{
var chargeDetails = new StripeChargeCreateOptions();
chargeDetails.Amount = (int)amount * 100;
chargeDetails.Currency = "usd";
chargeDetails.Source = new StripeSourceOptions
{
Object = "card",
Number = cc.CardNum,
ExpirationMonth = cc.Expiration.Substring(0, 2),
ExpirationYear = cc.Expiration.Substring(3, 2),
Cvc = cc.CVC
};
var chargeService = new StripeChargeService(APIKey);
var response = chargeService.Create(chargeDetails);
if (response.Paid == false)
{
throw new Exception(response.FailureMessage);
}
return response.Paid;
}
开发者ID:cduflo,项目名称:12-PaymentKiosk,代码行数:26,代码来源:MoneyService.cs
示例6: lbBasicAuth_Click
protected void lbBasicAuth_Click(object sender, EventArgs e)
{
string merchantId = ConfigurationManager.AppSettings["MerchantID"];
string account = ConfigurationManager.AppSettings["Account"];
string sharedSecret = ConfigurationManager.AppSettings["SharedSecret"];
Merchant merchant = new Merchant(merchantId, account, sharedSecret);
Order order = new Order("GBP", 999);
//working
CreditCard card = new CreditCard("MC", "5425232820001308", "0118", "Phil McCracken", "123", 1);
//invalid
//CreditCard card = new CreditCard("MC", "1234123412341234", "0118", "Phil McCracken", "123", 1);
Address address = new Address("", "", "", "", "", "", "", "");
PhoneNumbers numbers = new PhoneNumbers("", "", "", "");
Payer payer = new Payer("Business", "test", "", "Phil", "McCracken", "", address, numbers, "", new ArrayList());
string timestamp = Common.GenerateTimestamp();
string autoSettle = "1";
RealAuthTransactionResponse resp = RealAuthorisation.Auth(merchant, order, card, autoSettle, timestamp);
lblErrorCode.Text = resp.ResultCode.ToString();
lblResult.Text = resp.ResultMessage;
}
开发者ID:ryanmcg1,项目名称:RealexWrapper,代码行数:25,代码来源:default.aspx.cs
示例7: TransactionRequest
/// <summary>
/// Construtor da classe <see cref="TransactionRequest"/>.
/// </summary>
/// <param name="sellerMail">E-mail da loja cadastrada no Pagamento Digital.</param>
/// <param name="ipSeller">Endereço de IP da loja.</param>
/// <param name="orderId">Código do pedido atribuído pela loja.</param>
/// <param name="buyer">Objeto <see cref="Customer"/>.</param>
/// <param name="free">Campo de Livre Digitação. Pode ser utilizado para algum parâmetro adicional de identificação da venda.</param>
/// <param name="freight">Valor do frete.</param>
/// <param name="freightType">Tipo do frete.</param>
/// <param name="discount">Valor total do desconto atribuído pela loja.</param>
/// <param name="addition">Valor total do acréscimo feito pela loja.</param>
/// <param name="paymentMethod">Objeto <see cref="PaymentMethod"/>.</param>
/// <param name="urlReturn">URL que direciona o usuário para a loja.</param>
/// <param name="urlWarning">URL que a loja irá receber as informações de alteração de status da transação.</param>
/// <param name="products">Lista de produtos.</param>
/// <param name="installments">Quantidade de Parcelas em que a compra será processada.</param>
/// <param name="creditCard">Objeto <see cref="CreditCard"/>.</param>
/// <param name="currency">Moeda utilizada para a transação.</param>
/// <param name="acceptedContract">Loja informa se o comprador aceitou os termos do contrato.</param>
/// <param name="viewedContract">Loja informa se o comprador visualizou os termos do contrato.</param>
/// <param name="campaignId">Identificador da campanha da loja no Pagamento Digital.</param>
/// <param name="dependentTransactions">Lista de transações dependentes.</param>
public TransactionRequest(string sellerMail, string ipSeller, string orderId, Customer buyer, string free,
decimal freight, string freightType, decimal discount, decimal addition,
PaymentMethod paymentMethod, string urlReturn, string urlWarning, List<Product> products,
int installments, CreditCard creditCard, string currency, bool acceptedContract,
bool viewedContract, int campaignId, List<DependentTransaction> dependentTransactions)
{
this.SellerMail = sellerMail;
this.IpSeller = ipSeller;
this.OrderId = orderId;
this.Buyer = buyer;
this.Free = free;
this.Freight = freight;
this.FreightType = freightType;
this.Discount = discount;
this.Addition = addition;
this.PaymentMethod = paymentMethod;
this.UrlReturn = urlReturn;
this.UrlNotification = urlWarning;
this.Products = products;
this.Installments = installments;
this.CreditCard = creditCard;
this.Currency = currency;
this.AcceptedContract = acceptedContract;
this.ViewedContract = viewedContract;
this.CampaignId = campaignId;
this.DependentTransactions = dependentTransactions;
}
开发者ID:payu-br,项目名称:bcash-dotnet-sdk,代码行数:50,代码来源:TransactionRequest.cs
示例8: Charge
public static bool Charge(Customer customer, CreditCard creditCard, decimal amount)
{
var chargeDetails = new StripeChargeCreateOptions();
chargeDetails.Amount = (int)(amount * 100);
chargeDetails.Currency = "usd";
chargeDetails.Source = new StripeSourceOptions
{
Object = "card",
Number = creditCard.CardNumber,
ExpirationMonth = creditCard.ExpirationDate.Month.ToString(),
ExpirationYear = creditCard.ExpirationDate.Year.ToString(),
Cvc = creditCard.Cvc
};
var chargeService = new StripeChargeService(StripeApiKey);
var response = chargeService.Create(chargeDetails);
if (response.Paid == false)
{
throw new Exception(response.FailureMessage);
}
return response.Paid;
}
开发者ID:mike-evlantev,项目名称:12-PaymentKiosk,代码行数:26,代码来源:MoneyService.cs
示例9: GetStripeSubscriptionIdForNewCustomer
/// <summary>
/// Subscribes the user to a Stripe plan. If the user doesn't exist in Stripe, is created
/// </summary>
/// <param name="user">Application User</param>
/// <param name="planId">Plan Id to subscribe the user to</param>
/// <param name="taxPercent">The tax percent.</param>
/// <param name="creditCard">The credit card.</param>
/// <returns>
/// Subscription
/// </returns>
public async Task<Subscription> SubscribeUserAsync
(SaasEcomUser user, string planId, decimal taxPercent = 0, CreditCard creditCard = null)
{
Subscription subscription;
// If the user isn't created in Stripe
if (string.IsNullOrEmpty(user.StripeCustomerId))
{
// Save the subscription in the DB
subscription = await _subscriptionDataService.SubscribeUserAsync(user, planId, trialPeriodInDays: null, taxPercent: taxPercent);
// Create a new customer in Stripe and subscribe him to the plan
var cardToken = creditCard == null ? null : creditCard.StripeToken;
var stripeUser = (StripeCustomer) await _customerProvider.CreateCustomerAsync(user, planId, null, cardToken);
user.StripeCustomerId = stripeUser.Id; // Add stripe user Id to the user
// Save Stripe Subscription Id in the DB
subscription.StripeId = GetStripeSubscriptionIdForNewCustomer(stripeUser);
await _subscriptionDataService.UpdateSubscriptionAsync(subscription);
}
else // Create new subscription in Stripe and DB
{
subscription = await this.SubscribeUserAsync(user, planId, creditCard, 0, taxPercent: taxPercent);
}
// Update tax percent on stripe
if (taxPercent > 0)
{
await this.UpdateSubscriptionTax(user, subscription.StripeId, taxPercent);
}
return subscription;
}
开发者ID:hagenson,项目名称:saas-ecom,代码行数:43,代码来源:SubscriptionsFacade.cs
示例10: PaymentMethod
public PaymentMethod(CreditCard creditCard,
PurchaseType purchaseType,
int installments = 1)
{
CreditCard = creditCard;
PurchaseType = purchaseType;
Installments = installments;
}
开发者ID:andrelmp,项目名称:Cielo,代码行数:8,代码来源:PaymentMethod.cs
示例11: Insert
public void Insert(CreditCard model)
{
using (_db = new MyCoolDbEntities())
{
_db.CreditCards.AddObject(model);
_db.SaveChanges();
}
}
开发者ID:kahanu,项目名称:webgoat.mvc,代码行数:9,代码来源:CreditCardRepository.cs
示例12: Delete
public void Delete(CreditCard model)
{
using (_db = new MyCoolDbEntities())
{
var entity = _db.CreditCards.Where(c => c.Id == model.Id).SingleOrDefault();
_db.CreditCards.DeleteObject(entity);
_db.SaveChanges();
}
}
开发者ID:kahanu,项目名称:webgoat.mvc,代码行数:9,代码来源:CreditCardRepository.cs
示例13: CardTokenTests
public CardTokenTests()
{
_card = new CreditCard {
Number = "4111111111111111",
ExpMonth = 3,
ExpYear = 2015
};
_client = new StripeClient(Constants.ApiKey);
}
开发者ID:rbwestmoreland,项目名称:stripe-dotnet,代码行数:10,代码来源:CardTokenTests.cs
示例14: CustomerTests
public CustomerTests()
{
_card = new CreditCard {
Number = "4242424242424242",
ExpMonth = 3,
ExpYear = 2015
};
_client = new StripeClient(Constants.ApiKey);
}
开发者ID:JamesReate,项目名称:stripe-dotnet,代码行数:10,代码来源:CustomerTests.cs
示例15: Setup
public void Setup()
{
_card = new CreditCard {
Number = "4111111111111111",
ExpMonth = 3,
ExpYear = 2015
};
_client = new StripeClient(Constants.ApiKey);
}
开发者ID:toddlucas,项目名称:stripe-dotnet,代码行数:10,代码来源:CustomerTests.cs
示例16: Update
public void Update(CreditCard entity)
{
using (_db = new MyCoolDbEntities())
{
_db.CreditCards.Attach(entity);
_db.ObjectStateManager.ChangeObjectState(entity, System.Data.EntityState.Modified);
_db.CreditCards.ApplyCurrentValues(entity);
_db.SaveChanges();
}
}
开发者ID:kahanu,项目名称:webgoat.mvc,代码行数:10,代码来源:CreditCardRepository.cs
示例17: AddAsync
/// <summary>
/// Adds the credit card asynchronous.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="card">The card.</param>
/// <returns></returns>
public async Task AddAsync(SaasEcomUser user, CreditCard card)
{
// Save to Stripe
var stripeCustomerId = user.StripeCustomerId;
AddCardToStripe(card, stripeCustomerId);
// Save to storage
card.SaasEcomUserId = user.Id;
await _cardDataService.AddAsync(card);
}
开发者ID:hagenson,项目名称:saas-ecom,代码行数:16,代码来源:CardProvider.cs
示例18: ChargeTests
public ChargeTests()
{
_card = new CreditCard {
Number = "4242 4242 4242 4242",
ExpMonth = DateTime.Now.Month,
ExpYear = DateTime.Now.AddYears(1).Year
};
_client = new StripeClient(Constants.ApiKey);
_customer = _client.CreateCustomer(_card);
}
开发者ID:ChadBurggraf,项目名称:stripe-dotnet,代码行数:11,代码来源:ChargeTests.cs
示例19: CardTokenTests
public CardTokenTests()
{
_card = new CreditCard
{
Number = "4242424242424242",
ExpMonth = 3,
ExpYear = (DateTime.Now.Year + 2)
};
_client = new StripeClient(Constants.ApiKey);
}
开发者ID:NearbyNow,项目名称:stripe-dotnet,代码行数:11,代码来源:CardTokenTests.cs
示例20: ChargeTests
public ChargeTests()
{
_card = new CreditCard {
Number = "4242 4242 4242 4242",
ExpMonth = 3,
ExpYear = 2015
};
_client = new StripeClient(Constants.ApiKey);
_customer = _client.CreateCustomer(_card);
}
开发者ID:srasch,项目名称:stripe-dotnet,代码行数:11,代码来源:ChargeTests.cs
注:本文中的CreditCard类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论