Ejemplo n.º 1
0
        protected internal AndroidPayCard(NodeWrapper node, BraintreeService service)
        {
            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], service);
            }
        }
Ejemplo n.º 2
0
 public static Boolean IsValidTrQueryString(String queryString, BraintreeService service)
 {
     string[] delimeters = new string[1];
     delimeters[0] = "&hash=";
     String[] dataSections = queryString.TrimStart('?').Split(delimeters, StringSplitOptions.None);
     return dataSections[1] == new Crypto().HmacHash(service.PrivateKey, dataSections[0]).ToLower();
 }
Ejemplo n.º 3
0
    public static string QueryStringForTR(Request trParams, Request req, string postURL, BraintreeService service)
    {
      string trData = TrUtil.BuildTrData(trParams, "http://example.com", service);
      string postData = "tr_data=" + HttpUtility.UrlEncode(trData, Encoding.UTF8) + "&";
      postData += req.ToQueryString();

      var request = WebRequest.Create(postURL) as HttpWebRequest;

      request.Method = "POST";
      request.KeepAlive = false;
      request.AllowAutoRedirect = false;

      byte[] buffer = Encoding.UTF8.GetBytes(postData);
      request.ContentType = "application/x-www-form-urlencoded";
      request.ContentLength = buffer.Length;
      Stream requestStream = request.GetRequestStream();
      requestStream.Write(buffer, 0, buffer.Length);
      requestStream.Close();

      var response = request.GetResponse() as HttpWebResponse;
      string query = new Uri(response.GetResponseHeader("Location")).Query;

      response.Close();

      return query;
    }
Ejemplo n.º 4
0
 public static bool IsValidTrQueryString(string queryString, BraintreeService service)
 {
     var delimiters = new string[1];
     delimiters[0] = "&hash=";
     string[] dataSections = queryString.TrimStart('?').Split(delimiters, StringSplitOptions.None);
     return dataSections[1] == new Sha1Hasher().HmacHash(service.PrivateKey, dataSections[0]).ToLower();
 }
Ejemplo n.º 5
0
        internal Customer(NodeWrapper node, BraintreeService service)
        {
            if (node == null) return;

            Id = node.GetString("id");
            FirstName = node.GetString("first-name");
            LastName = node.GetString("last-name");
            Company = node.GetString("company");
            Email = node.GetString("email");
            Phone = node.GetString("phone");
            Fax = node.GetString("fax");
            Website = node.GetString("website");
            CreatedAt = node.GetDateTime("created-at");
            UpdatedAt = node.GetDateTime("updated-at");

            var creditCardXmlNodes = node.GetList("credit-cards/credit-card");
            CreditCards = new CreditCard[creditCardXmlNodes.Count];
            for (int i = 0; i < creditCardXmlNodes.Count; i++)
            {
                CreditCards[i] = new CreditCard(creditCardXmlNodes[i], service);
            }

            var addressXmlNodes = node.GetList("addresses/address");
            Addresses = new Address[addressXmlNodes.Count];
            for (int i = 0; i < addressXmlNodes.Count; i++)
            {
                Addresses[i] = new Address(addressXmlNodes[i]);
            }

            CustomFields = node.GetDictionary("custom-fields");
        }
Ejemplo n.º 6
0
        public static string BuildTrData(Request request, string redirectURL, BraintreeService service)
        {
            var dateString = DateTime.Now.ToUniversalTime().ToString("yyyyMMddHHmmss");

            var trContent = new QueryString().
                Append("api_version", service.ApiVersion).
                Append("public_key", service.PublicKey).
                Append("redirect_url", redirectURL).
                Append("time", dateString).
                Append("kind", request.Kind()).
                ToString();

            string requestQueryString = request.ToQueryString();

            if (requestQueryString.Length > 0)
            {
                trContent += "&" + requestQueryString;
            }

            var signatureService = new SignatureService {
              Key = service.PrivateKey,
              Hasher = new Sha1Hasher()
            };
            return signatureService.Sign(trContent);
        }
        public TransparentRedirectRequest(string queryString, BraintreeService service)
        {
            queryString = queryString.TrimStart('?');

            var paramMap = new Dictionary<string, string>();
            string[] queryParams = queryString.Split('&');

            foreach (var queryParam in queryParams)
            {
                var items = queryParam.Split('=');
                paramMap[items[0]] = items[1];
            }

            string message = null;
            if (paramMap.ContainsKey("bt_message"))
            {
                message = HttpUtility.UrlDecode(paramMap["bt_message"]);
            }

            BraintreeService.ThrowExceptionIfErrorStatusCode((HttpStatusCode)int.Parse(paramMap["http_status"]), message);

            if (!TrUtil.IsValidTrQueryString(queryString, service))
            {
                throw new ForgedQueryStringException();
            }

            Id = paramMap["id"];
        }
Ejemplo n.º 8
0
        public static Boolean IsTrDataValid(String trData, BraintreeService service)
        {
            String[] dataSections = trData.Split('|');
            String trHash = dataSections[0];
            String trContent = dataSections[1];

            return trHash  == new Crypto().HmacHash(service.PrivateKey, trContent);
        }
Ejemplo n.º 9
0
        public static bool IsTrDataValid(string trData, BraintreeService service)
        {
            string[] dataSections = trData.Split('|');
            var trHash = dataSections[0];
            var trContent = dataSections[1];

            return trHash  == new Sha1Hasher().HmacHash(service.PrivateKey, trContent);
        }
Ejemplo n.º 10
0
 public void Setup()
 {
     service = new BraintreeService(new Configuration(
         Environment.DEVELOPMENT,
         "integration_merchant_id",
         "integration_public_key",
         "integration_private_key"
     ));
 }
Ejemplo n.º 11
0
 public void Setup()
 {
     gateway = new BraintreeGateway
     {
         Environment = Environment.DEVELOPMENT,
         MerchantId = "integration_merchant_id",
         PublicKey = "integration_public_key",
         PrivateKey = "integration_private_key"
     };
     service = new BraintreeService(gateway.Configuration); }
Ejemplo n.º 12
0
        protected internal PaymentMethodNonce(NodeWrapper node, BraintreeService service)
        {
            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);
            }
        }
Ejemplo n.º 13
0
        public void GetAuthorizationHeader_ReturnsBase64EncodePublicAndPrivateKeys()
        {
            BraintreeService service = new BraintreeService(new Configuration(
                Environment.DEVELOPMENT,
                "integration_merchant_id",
                "integration_public_key",
                "integration_private_key"
            ));
            Assert.AreEqual("Basic aW50ZWdyYXRpb25fcHVibGljX2tleTppbnRlZ3JhdGlvbl9wcml2YXRlX2tleQ==", service.GetAuthorizationHeader());

        }
Ejemplo n.º 14
0
        public void BaseMerchantURL_ReturnsProductionURL()
        {
            BraintreeService service = new BraintreeService(new Configuration(
                Environment.PRODUCTION,
                "integration_merchant_id",
                "integration_public_key",
                "integration_private_key"
            ));

            Assert.AreEqual("https://www.braintreegateway.com:443/merchants/integration_merchant_id", service.BaseMerchantURL());
        }
Ejemplo n.º 15
0
        public void BaseMerchantURL_ReturnsSandboxURL()
        {
            BraintreeService service = new BraintreeService(new Configuration(
                Environment.SANDBOX,
                "integration_merchant_id",
                "integration_public_key",
                "integration_private_key"
            ));

            Assert.AreEqual("https://sandbox.braintreegateway.com:443/merchants/integration_merchant_id", service.BaseMerchantURL());
        }
Ejemplo n.º 16
0
        private T newInstanceFromResponse(NodeWrapper node, BraintreeService service)
        {
            if (typeof(T) == typeof(Address))
            {
                return(new Address(node) as T);
            }
            else if (typeof(T) == typeof(ApplePayCard))
            {
                return(new ApplePayCard(node, service) as T);
            }
            else if (typeof(T) == typeof(CreditCard))
            {
                return(new CreditCard(node, service) as T);
            }
            else if (typeof(T) == typeof(CoinbaseAccount))
            {
                return(new CoinbaseAccount(node, service) as T);
            }
            else if (typeof(T) == typeof(Customer))
            {
                return(new Customer(node, service) as T);
            }
            else if (typeof(T) == typeof(Transaction))
            {
                return(new Transaction(node, service) as T);
            }
            else if (typeof(T) == typeof(Subscription))
            {
                return(new Subscription(node, service) as T);
            }
            else if (typeof(T) == typeof(SettlementBatchSummary))
            {
                return(new SettlementBatchSummary(node) as T);
            }
            else if (typeof(T) == typeof(MerchantAccount))
            {
                return(new MerchantAccount(node) as T);
            }
            else if (typeof(T) == typeof(PayPalAccount))
            {
                return(new PayPalAccount(node, service) as T);
            }
            else if (typeof(T) == typeof(UnknownPaymentMethod))
            {
                return(new UnknownPaymentMethod(node) as T);
            }
            else if (typeof(T) == typeof(PaymentMethodNonce))
            {
                return(new PaymentMethodNonce(node, service) as T);
            }

            throw new Exception("Unknown T: " + typeof(T).ToString());
        }
Ejemplo n.º 17
0
        protected internal PaymentMethodNonce(NodeWrapper node, BraintreeService service)
        {
            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);
            }
        }
Ejemplo n.º 18
0
        public WebhookNotification(NodeWrapper node, BraintreeService service)
        {
            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"), service);
            }

            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"), service);
            }

            if (WrapperNode.GetNode("disbursement") != null)
            {
                Disbursement = new Disbursement(WrapperNode.GetNode("disbursement"), service);
            }

            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");
            }
        }
Ejemplo n.º 19
0
        public void BaseMerchantURL_ReturnsDevelopmentURL()
        {
            BraintreeService service = new BraintreeService(new Configuration(
                Environment.DEVELOPMENT,
                "integration_merchant_id",
                "integration_public_key",
                "integration_private_key"
            ));

            var host = System.Environment.GetEnvironmentVariable("GATEWAY_HOST") ?? "localhost";
            var port = System.Environment.GetEnvironmentVariable("GATEWAY_PORT") ?? "3000";
            var expected = String.Format("http://{0}:{1}/merchants/integration_merchant_id", host, port);

            Assert.AreEqual(expected, service.BaseMerchantURL());
        }
Ejemplo n.º 20
0
        public void Setup()
        {
            gateway = new BraintreeGateway
            {
                Environment = Environment.DEVELOPMENT,
                MerchantId = "integration_merchant_id",
                PublicKey = "integration_public_key",
                PrivateKey = "integration_private_key"
            };

            service = new BraintreeService(gateway.Configuration);

            XmlDocument attributesXml = CreateAttributesXml();
            attributes = new NodeWrapper(attributesXml).GetNode("//disbursement");
        }
        public void ConfigurationWithStringEnvironment_Initializes()
        {
            Configuration config = new Configuration(
                "development",
                "integration_merchant_id",
                "integration_public_key",
                "integration_private_key"
            );
            BraintreeService service = new BraintreeService(config);

            var host = System.Environment.GetEnvironmentVariable("GATEWAY_HOST") ?? "localhost";
            var port = System.Environment.GetEnvironmentVariable("GATEWAY_PORT") ?? "3000";
            var expected = string.Format("http://{0}:{1}/merchants/integration_merchant_id", host, port);

            Assert.AreEqual(expected, service.BaseMerchantURL());
        }
Ejemplo n.º 22
0
        protected internal PayPalAccount(NodeWrapper node, BraintreeService service)
        {
            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], service);
            }
        }
Ejemplo n.º 23
0
 public Disbursement(NodeWrapper node, BraintreeService braintreeService)
 {
     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 (NodeWrapper stringNode in node.GetList("transaction-ids/item"))
     {
         TransactionIds.Add(stringNode.GetString("."));
     }
     Success = node.GetBoolean("success");
     Retry   = node.GetBoolean("retry");
     service = braintreeService;
 }
Ejemplo n.º 24
0
 public Disbursement(NodeWrapper node, BraintreeService braintreeService)
 {
     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 (NodeWrapper stringNode in node.GetList("transaction-ids/item")) 
     {
         TransactionIds.Add(stringNode.GetString("."));
     }
     Success = node.GetBoolean("success");
     Retry = node.GetBoolean("retry");
     service = braintreeService;
 }
Ejemplo n.º 25
0
        protected internal PayPalAccount(NodeWrapper node, BraintreeService service)
        {
            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], service);
            }
        }
Ejemplo n.º 26
0
        protected internal CreditCard(NodeWrapper node, BraintreeService service)
        {
            if (node == null)
            {
                return;
            }

            Bin                    = node.GetString("bin");
            CardholderName         = node.GetString("cardholder-name");
            CardType               = (CreditCardCardType)CollectionUtil.Find(CreditCardCardType.ALL, node.GetString("card-type"), CreditCardCardType.UNRECOGNIZED);
            CustomerId             = node.GetString("customer-id");
            IsDefault              = node.GetBoolean("default");
            IsVenmoSdk             = node.GetBoolean("venmo-sdk");
            ExpirationMonth        = node.GetString("expiration-month");
            ExpirationYear         = node.GetString("expiration-year");
            IsExpired              = node.GetBoolean("expired");
            CustomerLocation       = (CreditCardCustomerLocation)CollectionUtil.Find(CreditCardCustomerLocation.ALL, node.GetString("customer-location"), CreditCardCustomerLocation.UNRECOGNIZED);
            LastFour               = node.GetString("last-4");
            UniqueNumberIdentifier = node.GetString("unique-number-identifier");
            Token                  = node.GetString("token");
            CreatedAt              = node.GetDateTime("created-at");
            UpdatedAt              = node.GetDateTime("updated-at");
            BillingAddress         = new Address(node.GetNode("billing-address"));
            Prepaid                = (CreditCardPrepaid)CollectionUtil.Find(CreditCardPrepaid.ALL, node.GetString("prepaid"), CreditCardPrepaid.UNKNOWN);
            Payroll                = (CreditCardPayroll)CollectionUtil.Find(CreditCardPayroll.ALL, node.GetString("payroll"), CreditCardPayroll.UNKNOWN);
            DurbinRegulated        = (CreditCardDurbinRegulated)CollectionUtil.Find(CreditCardDurbinRegulated.ALL, node.GetString("durbin-regulated"), CreditCardDurbinRegulated.UNKNOWN);
            Debit                  = (CreditCardDebit)CollectionUtil.Find(CreditCardDebit.ALL, node.GetString("debit"), CreditCardDebit.UNKNOWN);
            Commercial             = (CreditCardCommercial)CollectionUtil.Find(CreditCardCommercial.ALL, node.GetString("commercial"), CreditCardCommercial.UNKNOWN);
            Healthcare             = (CreditCardHealthcare)CollectionUtil.Find(CreditCardHealthcare.ALL, node.GetString("healthcare"), CreditCardHealthcare.UNKNOWN);
            _CountryOfIssuance     = node.GetString("country-of-issuance");
            _IssuingBank           = node.GetString("issuing-bank");
            ImageUrl               = node.GetString("image-url");

            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], service);
            }

            var verificationNodes = node.GetList("verifications/verification");

            Verification = FindLatestVerification(verificationNodes, service);
        }
Ejemplo n.º 27
0
        protected internal ApplePayCard(NodeWrapper node, BraintreeService service)
        {
            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], service);
            }
        }
Ejemplo n.º 28
0
        protected internal ApplePayCard(NodeWrapper node, BraintreeService service)
        {
            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], service);
            }
        }
Ejemplo n.º 29
0
        public static String BuildTrData(Request request, String redirectURL, BraintreeService service)
        {
            String dateString = DateTime.Now.ToUniversalTime().ToString("yyyyMMddHHmmss");

            String trContent = new QueryString().
                Append("api_version", service.ApiVersion).
                Append("public_key", service.PublicKey).
                Append("redirect_url", redirectURL).
                Append("time", dateString).
                Append("kind", request.Kind()).
                ToString();

            String requestQueryString = request.ToQueryString();

            if (requestQueryString.Length > 0)
            {
                trContent += "&" + requestQueryString;
            }

            String trHash = new Crypto().HmacHash(service.PrivateKey, trContent);
            return trHash + "|" + trContent;
        }
        public CreditCardVerification(NodeWrapper node, BraintreeService service)
        {
            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"), service);
            CreatedAt = node.GetDateTime("created-at");
        }
 public ThreeDSecureGateway(BraintreeGateway gateway)
 {
     this.gateway = gateway;
     service      = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 32
0
 public OAuthGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasClientCredentials();
     this.gateway = gateway;
     service = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 33
0
 protected internal AddressGateway(IBraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     Gateway = gateway;
     Service = new BraintreeService(gateway.Configuration);
 }
 protected internal CreditCardVerificationGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 35
0
 protected internal TransactionGateway(IBraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 36
0
        protected internal Customer(NodeWrapper node, BraintreeService service)
        {
            if (node == null)
            {
                return;
            }

            Id        = node.GetString("id");
            FirstName = node.GetString("first-name");
            LastName  = node.GetString("last-name");
            Company   = node.GetString("company");
            Email     = node.GetString("email");
            Phone     = node.GetString("phone");
            Fax       = node.GetString("fax");
            Website   = node.GetString("website");
            CreatedAt = node.GetDateTime("created-at");
            UpdatedAt = node.GetDateTime("updated-at");

            var creditCardXmlNodes = node.GetList("credit-cards/credit-card");

            CreditCards = new CreditCard[creditCardXmlNodes.Count];
            for (int i = 0; i < creditCardXmlNodes.Count; i++)
            {
                CreditCards[i] = new CreditCard(creditCardXmlNodes[i], service);
            }

            var paypalXmlNodes = node.GetList("paypal-accounts/paypal-account");

            PayPalAccounts = new PayPalAccount[paypalXmlNodes.Count];
            for (int i = 0; i < paypalXmlNodes.Count; i++)
            {
                PayPalAccounts[i] = new PayPalAccount(paypalXmlNodes[i], service);
            }

            var applePayXmlNodes = node.GetList("apple-pay-cards/apple-pay-card");

            ApplePayCards = new ApplePayCard[applePayXmlNodes.Count];
            for (int i = 0; i < applePayXmlNodes.Count; i++)
            {
                ApplePayCards[i] = new ApplePayCard(applePayXmlNodes[i], service);
            }

            var coinbaseXmlNodes = node.GetList("coinbase-accounts/coinbase-account");

            CoinbaseAccounts = new CoinbaseAccount[coinbaseXmlNodes.Count];
            for (int i = 0; i < coinbaseXmlNodes.Count; i++)
            {
                CoinbaseAccounts[i] = new CoinbaseAccount(coinbaseXmlNodes[i], service);
            }

            PaymentMethods = new PaymentMethod[CreditCards.Length + PayPalAccounts.Length + ApplePayCards.Length + CoinbaseAccounts.Length];
            CreditCards.CopyTo(PaymentMethods, 0);
            PayPalAccounts.CopyTo(PaymentMethods, CreditCards.Length);
            ApplePayCards.CopyTo(PaymentMethods, CreditCards.Length + PayPalAccounts.Length);
            CoinbaseAccounts.CopyTo(PaymentMethods, CreditCards.Length + PayPalAccounts.Length + ApplePayCards.Length);

            var addressXmlNodes = node.GetList("addresses/address");

            Addresses = new Address[addressXmlNodes.Count];
            for (int i = 0; i < addressXmlNodes.Count; i++)
            {
                Addresses[i] = new Address(addressXmlNodes[i]);
            }

            CustomFields = node.GetDictionary("custom-fields");
        }
Ejemplo n.º 37
0
 internal CustomerGateway(BraintreeService service)
 {
     Service = service;
 }
Ejemplo n.º 38
0
 public DiscountGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     service = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 39
0
 public UsBankAccountGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = gateway.Service;
 }
 protected internal SettlementBatchSummaryGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 41
0
 protected internal ClientTokenGateway(BraintreeService service)
 {
     Service = service;
 }
 protected internal DocumentUploadGateway(IBraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     Gateway = gateway;
     Service = gateway.Service;
 }
Ejemplo n.º 43
0
 public PlanGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     service = gateway.Service;
 }
 public PayPalAccountGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 45
0
 protected internal TransactionLineItemGateway(IBraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = gateway.Service;
 }
Ejemplo n.º 46
0
 public AddOnGateway(IBraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     Service = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 47
0
 public DiscountGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     service = new BraintreeService(gateway.Configuration);
 }
 protected internal UsBankAccountVerificationGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = gateway.Service;
 }
Ejemplo n.º 49
0
 public DiscountGateway(BraintreeService service)
 {
     Service = service;
 }
 protected internal MerchantAccountGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 51
0
 protected internal CreditCardGateway(IBraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = gateway.Service;
 }
 protected internal WebhookNotificationGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     this.service = gateway.Service;
 }
Ejemplo n.º 53
0
 protected internal CreditCardGateway(BraintreeService service)
 {
     Service = service;
 }
Ejemplo n.º 54
0
 public OAuthGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasClientCredentials();
     this.gateway = gateway;
     service      = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 55
0
 public PaymentMethodGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     this.service = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 56
0
 protected internal CreditCardVerificationGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     service      = new BraintreeService(gateway.Configuration);
 }
 internal SettlementBatchSummaryGateway(BraintreeService service)
 {
     Service = service;
 }
 protected internal WebhookTestingGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     service = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 59
0
 protected internal ClientTokenGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     Service = new BraintreeService(gateway.Configuration);
 }
Ejemplo n.º 60
0
 public PaymentMethodGateway(BraintreeGateway gateway)
 {
     gateway.Configuration.AssertHasAccessTokenOrKeys();
     this.gateway = gateway;
     this.service = new BraintreeService(gateway.Configuration);
 }