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");
     }
 }
Beispiel #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));
        }