本文整理汇总了C#中Braintree.BraintreeGateway类的典型用法代码示例。如果您正苦于以下问题:C# BraintreeGateway类的具体用法?C# BraintreeGateway怎么用?C# BraintreeGateway使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BraintreeGateway类属于Braintree命名空间,在下文中一共展示了BraintreeGateway类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AndroidPayCard
protected internal AndroidPayCard(NodeWrapper node, BraintreeGateway gateway)
{
CardType = node.GetString("virtual-card-type");
VirtualCardType = node.GetString("virtual-card-type");
SourceCardType = node.GetString("source-card-type");
Last4 = node.GetString("virtual-card-last-4");
SourceCardLast4 = node.GetString("source-card-last-4");
VirtualCardLast4 = node.GetString("virtual-card-last-4");
Bin = node.GetString("bin");
ExpirationMonth = node.GetString("expiration-month");
ExpirationYear = node.GetString("expiration-year");
GoogleTransactionId = node.GetString("google-transaction-id");
Token = node.GetString("token");
IsDefault = node.GetBoolean("default");
ImageUrl = node.GetString("image-url");
CreatedAt = node.GetDateTime("created-at");
UpdatedAt = node.GetDateTime("updated-at");
var subscriptionXmlNodes = node.GetList("subscriptions/subscription");
Subscriptions = new Subscription[subscriptionXmlNodes.Count];
for (int i = 0; i < subscriptionXmlNodes.Count; i++)
{
Subscriptions[i] = new Subscription(subscriptionXmlNodes[i], gateway);
}
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:26,代码来源:AndroidPayCard.cs
示例2: Generate_RaisesExceptionIfFailOnDuplicatePaymentMethodIsIncludedWithoutCustomerId
public void Generate_RaisesExceptionIfFailOnDuplicatePaymentMethodIsIncludedWithoutCustomerId()
{
BraintreeGateway gateway = new BraintreeGateway
{
Environment = Environment.DEVELOPMENT,
MerchantId = "integration_merchant_id",
PublicKey = "integration_public_key",
PrivateKey = "integration_private_key"
};
try {
gateway.ClientToken.generate(
new ClientTokenRequest
{
Options = new ClientTokenOptionsRequest
{
FailOnDuplicatePaymentMethod = true
}
}
);
Assert.Fail("Should raise ArgumentException");
} catch (ArgumentException e) {
Match match = Regex.Match(e.Message, @"FailOnDuplicatePaymentMethod");
Assert.IsTrue(match.Success);
}
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:25,代码来源:ClientTokenTest.cs
示例3: Get
// GET api/<controller>
public IEnumerable<SimpleTransaction> Get(string pub, string priv, string merchant, long from, long to)
{
var gateway = new BraintreeGateway
{
Environment = Braintree.Environment.SANDBOX,
MerchantId = merchant,
PublicKey = pub,
PrivateKey = priv
};
var fromDate = FromUnixTime(from);
var toDate = FromUnixTime(to).AddDays(1);
var request = new TransactionSearchRequest().SubmittedForSettlementAt.Between(fromDate, toDate);
ResourceCollection<Transaction> collection = gateway.Transaction.Search(request);
return (from Transaction transaction in collection
select new SimpleTransaction
{
Id = transaction.Id,
MerchantAccountId = transaction.MerchantAccountId,
Status = transaction.Status.ToString(),
Amount = transaction.Amount,
TaxAmount = transaction.TaxAmount,
CreatedAt = transaction.CreatedAt,
CurrencyIsoCode = transaction.CurrencyIsoCode
}).ToList();
}
开发者ID:OzieGamma,项目名称:BraintreeOffice,代码行数:30,代码来源:BraintreeController.cs
示例4: GenerateDecodedClientToken
public static string GenerateDecodedClientToken(BraintreeGateway gateway, ClientTokenRequest request = null)
{
var encodedClientToken = gateway.ClientToken.generate(request);
var decodedClientToken = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(encodedClientToken));
var unescapedClientToken = System.Text.RegularExpressions.Regex.Unescape(decodedClientToken);
return unescapedClientToken;
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:7,代码来源:TestHelper.cs
示例5: Setup
public void Setup()
{
gateway = new BraintreeGateway(
"client_id$development$integration_client_id",
"client_secret$development$integration_client_secret"
);
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:7,代码来源:MerchantTest.cs
示例6: GetSavedPayMethodInfo
private void GetSavedPayMethodInfo(string paymentNonce, out string customerId, out string token, out string type) {
using(var ctx = new Data.FitathonDataEntities()) {
var user = Common.GetUserFromEmail(ctx, Context.User.Identity.Name);
var sponsor = user.sponsors.SingleOrDefault();
var evt = sponsor.participant.fitevent;
var gateway = new Braintree.BraintreeGateway {
Environment = Braintree.Environment.SANDBOX,
MerchantId = evt.braintreeClientID,
PublicKey = evt.braintreePublicKey,
PrivateKey = evt.braintreePrivateKey
};
//create request with just the payment nonce (empty customer)
var custRequest = new Braintree.CustomerRequest {
PaymentMethodNonce = paymentNonce
};
Braintree.Result<Braintree.Customer> custResult = gateway.Customer.Create(custRequest);
if(custResult.IsSuccess()) {
Braintree.Customer customer = custResult.Target;
customerId = customer.Id;
token = customer.PaymentMethods[0].Token;
type = GetPMType(customer.PaymentMethods[0]);
return;
}
}
customerId = null;
token = null;
type = null;
}
开发者ID:silverBlaze,项目名称:Fitathon.org,代码行数:31,代码来源:PayMethod.aspx.cs
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var gateway = new BraintreeGateway
{
Environment = Braintree.Environment.SANDBOX,
MerchantId = "78c2hsmmg73s6sdg",
PublicKey = "jsyrqbxq2fqv456k",
PrivateKey = "004b6691b796db322c57c71343ecf592"
};
if (!IsPostBack)
{
var clientToken = gateway.ClientToken.generate();
String clientTK = clientToken;
cTK.Value = clientToken;
}
else
{
var nonceFromTheClient = Request.Form["payment_method_nonce"];
var request = new TransactionRequest
{
Amount = 100.00M,
PaymentMethodNonce = nonceFromTheClient
};
Result<Transaction> result = gateway.Transaction.Sale(request);
var id = result.Transaction.Id;
var amount = result.Transaction.Amount;
var date = result.Transaction.UpdatedAt;
var status = result.Transaction.ProcessorResponseCode;
}
}
开发者ID:GentlemenoftheCode,项目名称:Battlehack,代码行数:33,代码来源:Roshin.aspx.cs
示例8: CreditCardVerification
public CreditCardVerification(NodeWrapper node, BraintreeGateway gateway)
{
if (node == null) return;
AvsErrorResponseCode = node.GetString("avs-error-response-code");
AvsPostalCodeResponseCode = node.GetString("avs-postal-code-response-code");
AvsStreetAddressResponseCode = node.GetString("avs-street-address-response-code");
CvvResponseCode = node.GetString("cvv-response-code");
GatewayRejectionReason = (TransactionGatewayRejectionReason)CollectionUtil.Find(
TransactionGatewayRejectionReason.ALL,
node.GetString("gateway-rejection-reason"),
null
);
ProcessorResponseCode = node.GetString("processor-response-code");
ProcessorResponseText = node.GetString("processor-response-text");
MerchantAccountId = node.GetString("merchant-account-id");
Status = (VerificationStatus)CollectionUtil.Find(VerificationStatus.ALL, node.GetString("status"), VerificationStatus.UNRECOGNIZED);
Id = node.GetString("id");
BillingAddress = new Address(node.GetNode("billing"));
CreditCard = new CreditCard(node.GetNode("credit-card"), gateway);
CreatedAt = node.GetDateTime("created-at");
var riskDataNode = node.GetNode("risk-data");
if (riskDataNode != null) {
RiskData = new RiskData(riskDataNode);
}
}
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:27,代码来源:CreditCardVerification.cs
示例9: PaymentMethodNonce
protected internal PaymentMethodNonce(NodeWrapper node, BraintreeGateway gateway)
{
Nonce = node.GetString("nonce");
Type = node.GetString("type");
var threeDSecureInfoNode = node.GetNode("three-d-secure-info");
if (threeDSecureInfoNode != null && !threeDSecureInfoNode.IsEmpty()){
ThreeDSecureInfo = new ThreeDSecureInfo(threeDSecureInfoNode);
}
}
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:10,代码来源:PaymentMethodNonce.cs
示例10: PaymentManager
public PaymentManager()
{
_gateway = new BraintreeGateway
{
Environment = Environment.SANDBOX,
MerchantId = "t5n73yh25jb5sxxf",
PublicKey = "5srydbsj263fpy7d",
PrivateKey = "eab6d68d548b38a7fcf052a755b5cf2e"
};
}
开发者ID:sgh1986915,项目名称:.net-braintree-spa,代码行数:10,代码来源:PaymentManager.cs
示例11: Setup
public void Setup()
{
gateway = new BraintreeGateway
{
Environment = Environment.DEVELOPMENT,
MerchantId = "integration_merchant_id",
PublicKey = "integration_public_key",
PrivateKey = "integration_private_key"
};
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:10,代码来源:PaymentMethodNonceTest.cs
示例12: SetConfigurationEnvironment_WithString
public void SetConfigurationEnvironment_WithString()
{
BraintreeGateway gateway = new BraintreeGateway(
"development",
"integration_merchant_id",
"integration_public_key",
"integration_private_key"
);
Assert.AreEqual(gateway.Environment, Environment.DEVELOPMENT);
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:11,代码来源:BraintreeGatewayTest.cs
示例13: Setup
public void Setup()
{
gateway = new BraintreeGateway
{
Environment = Environment.DEVELOPMENT,
MerchantId = "integration_merchant_id",
PublicKey = "integration_public_key",
PrivateKey = "integration_private_key"
};
XmlDocument attributesXml = CreateAttributesXml();
attributes = new NodeWrapper(attributesXml).GetNode("//disbursement");
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:13,代码来源:DisbursementTest.cs
示例14: PayPalAccount
protected internal PayPalAccount(NodeWrapper node, BraintreeGateway gateway)
{
Email = node.GetString("email");
Token = node.GetString("token");
IsDefault = node.GetBoolean("default");
ImageUrl = node.GetString("image-url");
CreatedAt = node.GetDateTime("created-at");
UpdatedAt = node.GetDateTime("updated-at");
var subscriptionXmlNodes = node.GetList("subscriptions/subscription");
Subscriptions = new Subscription[subscriptionXmlNodes.Count];
for (int i = 0; i < subscriptionXmlNodes.Count; i++)
{
Subscriptions[i] = new Subscription(subscriptionXmlNodes[i], gateway);
}
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:16,代码来源:PayPalAccount.cs
示例15: Disbursement
public Disbursement(NodeWrapper node, BraintreeGateway gateway)
{
Id = node.GetString("id");
Amount = node.GetDecimal("amount");
ExceptionMessage = node.GetString("exception-message");
DisbursementDate = node.GetDateTime("disbursement-date");
FollowUpAction = node.GetString("follow-up-action");
MerchantAccount = new MerchantAccount(node.GetNode("merchant-account"));
TransactionIds = new List<string>();
foreach (var stringNode in node.GetList("transaction-ids/item"))
{
TransactionIds.Add(stringNode.GetString("."));
}
Success = node.GetBoolean("success");
Retry = node.GetBoolean("retry");
this.gateway = gateway;
}
开发者ID:ronin1,项目名称:braintree_dotnet,代码行数:17,代码来源:Disbursement.cs
示例16: WebhookNotification
public WebhookNotification(NodeWrapper node, BraintreeGateway gateway)
{
Timestamp = node.GetDateTime("timestamp");
Kind = (WebhookKind)CollectionUtil.Find(WebhookKind.ALL, node.GetString("kind"), WebhookKind.UNRECOGNIZED);
NodeWrapper WrapperNode = node.GetNode("subject");
if (WrapperNode.GetNode("api-error-response") != null) {
WrapperNode = WrapperNode.GetNode("api-error-response");
}
if (WrapperNode.GetNode("subscription") != null) {
Subscription = new Subscription(WrapperNode.GetNode("subscription"), gateway);
}
if (WrapperNode.GetNode("merchant-account") != null) {
MerchantAccount = new MerchantAccount(WrapperNode.GetNode("merchant-account"));
}
if (WrapperNode.GetNode("dispute") != null) {
Dispute = new Dispute(WrapperNode.GetNode("dispute"));
}
if (WrapperNode.GetNode("transaction") != null) {
Transaction = new Transaction(WrapperNode.GetNode("transaction"), gateway);
}
if (WrapperNode.GetNode("disbursement") != null) {
Disbursement = new Disbursement(WrapperNode.GetNode("disbursement"), gateway);
}
if (WrapperNode.GetNode("partner-merchant") != null) {
PartnerMerchant = new PartnerMerchant(WrapperNode.GetNode("partner-merchant"));
}
if (WrapperNode.GetNode("errors") != null) {
Errors = new ValidationErrors(WrapperNode.GetNode("errors"));
}
if (WrapperNode.GetNode("message") != null) {
Message = WrapperNode.GetString("message");
}
}
开发者ID:richardlawley,项目名称:braintree_dotnet,代码行数:43,代码来源:WebhookNotification.cs
示例17: ApplePayCard
protected internal ApplePayCard(NodeWrapper node, BraintreeGateway gateway)
{
CardType = node.GetString("card-type");
Last4 = node.GetString("last-4");
ExpirationMonth = node.GetString("expiration-month");
ExpirationYear = node.GetString("expiration-year");
Token = node.GetString("token");
PaymentInstrumentName = node.GetString("payment-instrument-name");
IsDefault = node.GetBoolean("default");
ImageUrl = node.GetString("image-url");
CreatedAt = node.GetDateTime("created-at");
UpdatedAt = node.GetDateTime("updated-at");
var subscriptionXmlNodes = node.GetList("subscriptions/subscription");
Subscriptions = new Subscription[subscriptionXmlNodes.Count];
for (int i = 0; i < subscriptionXmlNodes.Count; i++)
{
Subscriptions[i] = new Subscription(subscriptionXmlNodes[i], gateway);
}
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:21,代码来源:ApplePayCard.cs
示例18: VenmoAccount
protected internal VenmoAccount(NodeWrapper node, BraintreeGateway gateway)
{
Token = node.GetString("token");
Username = node.GetString("username");
VenmoUserId = node.GetString("venmo-user-id");
SourceDescription = node.GetString("source-description");
ImageUrl = node.GetString("image-url");
IsDefault = node.GetBoolean("default");
CustomerId = node.GetString("customer-id");
CreatedAt = node.GetDateTime("created-at");
UpdatedAt = node.GetDateTime("updated-at");
var subscriptionXmlNodes = node.GetList("subscriptions/subscription");
Subscriptions = new Subscription[subscriptionXmlNodes.Count];
for (int i = 0; i < subscriptionXmlNodes.Count; i++)
{
Subscriptions[i] = new Subscription(subscriptionXmlNodes[i], gateway);
}
}
开发者ID:richardlawley,项目名称:braintree_dotnet,代码行数:21,代码来源:VenmoAccount.cs
示例19: Page_Load
protected void Page_Load(object sender, EventArgs e) {
//handle form-submission which includes paymethod nonce
if(Request.Form["payment_method_nonce"] != null) {
Submission(Request.Form["payment_method_nonce"]);
return;
}
using(var ctx = new Data.FitathonDataEntities()) {
var user = Common.GetUserFromEmail(ctx, Context.User.Identity.Name);
var sponsor = user.sponsors.SingleOrDefault();
var evt = sponsor.participant.fitevent;
var gateway = new Braintree.BraintreeGateway {
Environment = Braintree.Environment.SANDBOX,
MerchantId = evt.braintreeClientID,
PublicKey = evt.braintreePublicKey,
PrivateKey = evt.braintreePrivateKey
};
var btToken = gateway.ClientToken.generate();
litBTClientToken.Text = string.Format("<script type='text/javascript'>var clientToken = '{0}';</script>", btToken);
}
}
开发者ID:silverBlaze,项目名称:Fitathon.org,代码行数:23,代码来源:PayMethod.aspx.cs
示例20: Setup
public void Setup()
{
gateway = new BraintreeGateway
{
Environment = Environment.DEVELOPMENT,
MerchantId = "integration_merchant_id",
PublicKey = "integration_public_key",
PrivateKey = "integration_private_key"
};
CustomerRequest request = new CustomerRequest
{
CreditCard = new CreditCardRequest
{
CardholderName = "Fred Jones",
Number = "5105105105105100",
ExpirationDate = "05/12"
}
};
customer = gateway.Customer.Create(request).Target;
creditCard = customer.CreditCards[0];
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:23,代码来源:SubscriptionTest.cs
注:本文中的Braintree.BraintreeGateway类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论