本文整理汇总了C#中Braintree.TransactionRequest类的典型用法代码示例。如果您正苦于以下问题:C# TransactionRequest类的具体用法?C# TransactionRequest怎么用?C# TransactionRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionRequest类属于Braintree命名空间,在下文中一共展示了TransactionRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MakePaymentPaypal
public BraintreeResponse MakePaymentPaypal(string nonce)
{
BraintreeGateway braintreeGateway = GetGateway();
TransactionRequest request = new TransactionRequest
{
Amount = _cartModel.TotalToPay,
PaymentMethodNonce = nonce,
BillingAddress = GetBillingAddress(),
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
}
};
Result<Transaction> result = braintreeGateway.Transaction.Sale(request);
if (result.IsSuccess())
{
Order order = _orderPlacementService.PlaceOrder(_cartModel,
o =>
{
o.PaymentStatus = PaymentStatus.Paid;
o.CaptureTransactionId = result.Target.Id;
});
return new BraintreeResponse { Success = true, Order = order };
}
return new BraintreeResponse
{
Success = false,
Errors = new List<string> { result.Message }
};
}
开发者ID:neozhu,项目名称:Ecommerce,代码行数:32,代码来源:BraintreePaymentService.cs
示例2: Credit
public virtual Result<Transaction> Credit(TransactionRequest request)
{
request.Type = TransactionType.CREDIT;
XmlNode response = service.Post(service.MerchantPath() + "/transactions", request);
return new ResultImpl<Transaction>(new NodeWrapper(response), gateway);
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionGateway.cs
示例3: 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
示例4: Sale
public virtual Result<Transaction> Sale(TransactionRequest request)
{
request.Type = TransactionType.SALE;
XmlNode response = Service.Post("/transactions", request);
return new Result<Transaction>(new NodeWrapper(response), Service);
}
开发者ID:toantran,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionGateway.cs
示例5: ToXml_InludesPaymentMethodNonce
public void ToXml_InludesPaymentMethodNonce()
{
TransactionRequest request = new TransactionRequest();
request.PaymentMethodNonce = "1232131232";
Assert.IsTrue(request.ToXml().Contains("1232131232"));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionRequestTest.cs
示例6: ToXml_Includes_DeviceSessionId
public void ToXml_Includes_DeviceSessionId()
{
TransactionRequest request = new TransactionRequest();
request.DeviceSessionId = "my_dsid";
Assert.IsTrue(request.ToXml().Contains("my_dsid"));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionRequestTest.cs
示例7: ToXml_Includes_FraudMerchantId
public void ToXml_Includes_FraudMerchantId()
{
TransactionRequest request = new TransactionRequest();
request.FraudMerchantId = "my_fmid";
Assert.IsTrue(request.ToXml().Contains("my_fmid"));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionRequestTest.cs
示例8: CreateTransaction
public ActionResult CreateTransaction(FormCollection collection)
{
TransactionRequest request = new TransactionRequest
{
Amount = 1000.0M,
CreditCard = new TransactionCreditCardRequest
{
Number = collection["number"],
CVV = collection["cvv"],
ExpirationMonth = collection["month"],
ExpirationYear = collection["year"]
},
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
}
};
Result<Transaction> result = Constants.Gateway.Transaction.Sale(request);
if (result.IsSuccess())
{
Transaction transaction = result.Target;
ViewData["TransactionId"] = transaction.Id;
}
else
{
ViewData["Message"] = result.Message;
}
return View();
}
开发者ID:bnitti,项目名称:braintree_dotnet_guide,代码行数:32,代码来源:HomeController.cs
示例9: ProcessPayment
public PaymentResult ProcessPayment(ViewModels.CheckoutViewModel model)
{
var request = new TransactionRequest()
{
Amount = model.Total,
CreditCard = new TransactionCreditCardRequest()
{
Number = model.CardNumber,
CVV = model.Cvv,
ExpirationMonth = model.Month,
ExpirationYear = model.Year
},
Options = new TransactionOptionsRequest()
{
SubmitForSettlement = true
}
};
var result = _gateway.Transaction.Sale(request);
if (result.IsSuccess())
{
return new PaymentResult(result.Target.Id, true, null);
}
return new PaymentResult(null, false, result.Message);
}
开发者ID:marley-cs,项目名称:build-a-store-with-a-payment-gateway-in-aspnet,代码行数:27,代码来源:PaymentGateway.cs
示例10: Generate_ReturnsTransactionsSettledOnAGivenDay
public void Generate_ReturnsTransactionsSettledOnAGivenDay()
{
TransactionRequest request = new TransactionRequest
{
Amount = 1000M,
CreditCard = new TransactionCreditCardRequest
{
Number = "4111111111111111",
ExpirationDate = "05/2012",
CardholderName = "Tom Smith",
},
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
},
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
Transaction settlementResult = gateway.TestTransaction.Settle(transaction.Id);
var settlementDate = settlementResult.SettlementBatchId.Substring(0,10);
transaction = gateway.Transaction.Find(transaction.Id);
var result = gateway.SettlementBatchSummary.Generate(System.DateTime.Parse(settlementDate));
var visas = new List<IDictionary<string,string>>();
foreach (var row in result.Target.Records)
{
if (Braintree.CreditCardCardType.VISA.ToString().Equals(row["card_type"]))
{
visas.Add(row);
}
}
Assert.AreEqual(1, visas.Count);
}
开发者ID:Jammyhammy,项目名称:braintree_dotnet,代码行数:34,代码来源:SettlementBatchSummaryTest.cs
示例11: CancelRelease
public virtual Result<Transaction> CancelRelease(string id)
{
var request = new TransactionRequest();
XmlNode response = service.Put(service.MerchantPath() + "/transactions/" + id + "/cancel_release", request);
return new ResultImpl<Transaction>(new NodeWrapper(response), gateway);
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:8,代码来源:TransactionGateway.cs
示例12: HoldInEscrow
public virtual Result<Transaction> HoldInEscrow(string id)
{
var request = new TransactionRequest();
XmlNode response = service.Put(service.MerchantPath() + "/transactions/" + id + "/hold_in_escrow", request);
return new ResultImpl<Transaction>(new NodeWrapper(response), gateway);
}
开发者ID:kevlut,项目名称:braintree_dotnet,代码行数:8,代码来源:TransactionGateway.cs
示例13: ToXML_EscapesGeneratedXMLForString
public void ToXML_EscapesGeneratedXMLForString()
{
TransactionRequest request = new TransactionRequest
{
OrderId = "<>&\"'"
};
TestHelper.AssertIncludes("<order-id><>&"'</order-id>", request.ToXml());
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:9,代码来源:RequestTest.cs
示例14: Refund
public virtual Result<Transaction> Refund(String id, Decimal amount)
{
TransactionRequest request = new TransactionRequest
{
Amount = amount
};
XmlNode response = Service.Post("/transactions/" + id + "/refund", request);
return new Result<Transaction>(new NodeWrapper(response), Service);
}
开发者ID:toantran,项目名称:braintree_dotnet,代码行数:9,代码来源:TransactionGateway.cs
示例15: ToXml_Includes_DeviceData
public void ToXml_Includes_DeviceData()
{
TransactionRequest request = new TransactionRequest();
request.DeviceData = "{\"device_session_id\":\"my_dsid\", \"fraud_merchant_id\":\"my_fmid\"}";
Assert.IsTrue(request.ToXml().Contains("device-data"));
Assert.IsTrue(request.ToXml().Contains("device_session_id"));
Assert.IsTrue(request.ToXml().Contains("my_dsid"));
Assert.IsTrue(request.ToXml().Contains("fraud_merchant_id"));
Assert.IsTrue(request.ToXml().Contains("my_fmid"));
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:11,代码来源:TransactionRequestTest.cs
示例16: Sale
public Result<Transaction> Sale(string token, TransactionRequest transactionRequest)
{
if (transactionRequest.Options == null) {
transactionRequest.Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
};
}
transactionRequest.PaymentMethodToken = token;
return gateway.Transaction.Sale(transactionRequest);
}
开发者ID:braintree,项目名称:braintree_dotnet,代码行数:12,代码来源:UsBankAccountGateway.cs
示例17: ToXML_EscapesGeneratedXMLForNestedSearchCriteria
public void ToXML_EscapesGeneratedXMLForNestedSearchCriteria()
{
TransactionRequest request = new TransactionRequest
{
Customer = new CustomerRequest
{
FirstName = "<John>"
}
};
TestHelper.AssertIncludes("<first-name><John></first-name>", request.ToXml());
}
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:12,代码来源:RequestTest.cs
示例18: Create
public ActionResult Create(decimal amount, string payment_method_nonce, bool savePaymentMethod = false)
{
if (amount > 0)
{
TempData["info"] = payment_method_nonce;
var request = new TransactionRequest
{
Amount = amount,
PaymentMethodNonce = payment_method_nonce
};
if (savePaymentMethod)
{
// grab this data from the user object normally
request.Customer = new CustomerRequest
{
Id = "3rfybedfwny4su9f",
FirstName = "Fred",
LastName = "Mbogo",
Email = "[email protected]"
};
request.CustomFields.Add("listing_type", "Directory Profile");
request.CustomFields.Add("listing_id", "142484");
request.Options = new TransactionOptionsRequest
{
StoreInVaultOnSuccess = true
};
}
var result = Common.GetGateway().Transaction.Sale(request);
if (result.IsSuccess())
{
TempData["success"] = "Sale completed";
}
else
{
TempData["error"] = result.Message;
}
return RedirectToAction("Index");
}
return View(amount);
}
开发者ID:malevolence,项目名称:PaymentsTesting,代码行数:47,代码来源:PaymentsController.cs
示例19: SettlementPending
public void SettlementPending()
{
var request = new TransactionRequest
{
Amount = 100M,
PaymentMethodNonce = Nonce.Transactable,
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
}
};
var transactionResult = gateway.Transaction.Sale(request);
Transaction transaction = gateway.TestTransaction.SettlementPending(transactionResult.Target.Id);
Assert.AreEqual(TransactionStatus.SETTLEMENT_PENDING, transaction.Status);
}
开发者ID:qswinson,项目名称:braintree_dotnet,代码行数:17,代码来源:TestTransactionTest.cs
示例20: PostTransaction
public bool PostTransaction(string nonce_data, decimal amount, string transactionData)
{
var request = new TransactionRequest
{
Amount = amount,
MerchantAccountId="TTP",
PaymentMethodNonce = nonce_data,
CustomerId = "36428238",
ServiceFeeAmount= 1.0M,
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true,
StoreInVault = true
}
};
Result<Transaction> result = gateway.Transaction.Sale(request);
return result.IsSuccess();
}
开发者ID:carlosdanna,项目名称:Wcfserver,代码行数:21,代码来源:SelfHostedService.cs
注:本文中的Braintree.TransactionRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论