Exemple #1
0
        internal static BraintreeClientConfiguration GetClientConfiguration(this IClientTokenGateway clientTokenGateway, string merchantAccountId)
        {
            var clientToken = clientTokenGateway.Generate(new ClientTokenRequest()
            {
                MerchantAccountId = merchantAccountId
            });

            return(DecodeClientToken(clientToken));
        }
Exemple #2
0
 public BraintreeLocalPaymentService(IClientTokenGateway clientTokenGateway, HttpClient httpClient, IWebClient webClient)
 {
     this.clientTokenGateway = clientTokenGateway;
     this.httpClient         = httpClient;
     this.webClient          = webClient;
 }
Exemple #3
0
        internal static async Task <BraintreeClientConfiguration> GetClientConfigurationAsync(this IClientTokenGateway clientTokenGateway, string merchantAccountId)
        {
            var clientToken = await clientTokenGateway.GenerateAsync(new ClientTokenRequest()
            {
                MerchantAccountId = merchantAccountId
            });

            return(DecodeClientToken(clientToken));
        }
        /// <summary>
        /// Creates a local payment transaction using the Braintree payment gateway.
        /// </summary>
        /// <param name="clientTokenGateway">The Braintree clinet token gateway.</param>
        /// <param name="merchantAccountId">The merchant account to use for the paymnt.</param>
        /// <param name="localPayment">Descriptor of the payment to be created on the brain tree server.</param>
        /// <returns>A payment resource that describes the newly created payment</returns>
        public static PaymentResource CreateLocalPayment(this IClientTokenGateway clientTokenGateway, string merchantAccountId, LocalPayment localPayment)
        {
            var service = new BraintreeLocalPaymentService(clientTokenGateway, httpClient, webClient);

            return(service.CreateLocalPayment(merchantAccountId, localPayment));
        }