Пример #1
0
 public PaymentRenderDto(PaymentCreateDto payment, string environment, string token, string nonceUrl)
 {
     Payment     = payment;
     NonceUrl    = nonceUrl;
     Environment = environment;
     if (Environment == "production")
     {
         ProductionToken = token;
     }
     else if (Environment == "sandbox")
     {
         SandboxToken = token;
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(environment), "Environment should be production or sandbox");
     }
 }
Пример #2
0
        public async Task <PaymentRenderDto> CreatePaymentAsync(PaymentCreateDto data)
        {
            var token = await _braintreeGateway.ClientToken.GenerateAsync();

            return(new PaymentRenderDto(data, _options.Environment, token, _options.PathPrefix + PurchaseMiddleware.Path));
        }