Beispiel #1
0
        protected internal UsBankAccount(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            RoutingNumber     = node.GetString("routing-number");
            Last4             = node.GetString("last-4");
            AccountType       = node.GetString("account-type");
            AccountHolderName = node.GetString("account-holder-name");
            Token             = node.GetString("token");
            ImageUrl          = node.GetString("image-url");
            BankName          = node.GetString("bank-name");
            CustomerId        = node.GetString("customer-id");
            AchMandate        = new AchMandate(node.GetNode("ach-mandate"));
            IsDefault         = node.GetBoolean("default");
            IsVerified        = node.GetBoolean("verified");

            Verifications = new List <UsBankAccountVerification>();
            if (node.GetNode("verifications") != null)
            {
                foreach (var n in node.GetNode("verifications").GetList("us-bank-account-verification"))
                {
                    Verifications.Add(new UsBankAccountVerification(n));
                }
            }
        }
        public ThreeDSecureInfo(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            AcsTransactionId                = node.GetString("acs-transaction-id");
            Cavv                            = node.GetString("cavv");
            DsTransactionId                 = node.GetString("ds-transaction-id");
            EciFlag                         = node.GetString("eci-flag");
            Enrolled                        = node.GetString("enrolled");
            LiabilityShiftPossible          = node.GetBoolean("liability-shift-possible");
            LiabilityShifted                = node.GetBoolean("liability-shifted");
            ParesStatus                     = node.GetString("pares-status");
            Status                          = node.GetString("status");
            ThreeDSecureAuthenticationId    = node.GetString("three-d-secure-authentication-id");
            ThreeDSecureServerTransactionId = node.GetString("three-d-secure-server-transaction-id");
            ThreeDSecureVersion             = node.GetString("three-d-secure-version");
            Xid = node.GetString("xid");

            var AuthenticationNode = node.GetNode("authentication");

            if (AuthenticationNode != null)
            {
                Authentication = new ThreeDSecureAuthenticationInfo(AuthenticationNode);
            }

            var LookupNode = node.GetNode("lookup");

            if (LookupNode != null)
            {
                Lookup = new ThreeDSecureLookupInfo(LookupNode);
            }
        }
        protected internal ApplePayCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            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");
            SourceDescription     = node.GetString("source-description");
            IsDefault             = node.GetBoolean("default");
            IsExpired             = node.GetBoolean("expired");
            ImageUrl              = node.GetString("image-url");
            CustomerId            = node.GetString("customer-id");

            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], gateway);
            }
        }
        protected internal AndroidPayCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            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");
            SourceDescription = node.GetString("source-description");
            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");
            CustomerId          = node.GetString("customer-id");
            CreatedAt           = node.GetDateTime("created-at");
            UpdatedAt           = node.GetDateTime("updated-at");
            IsNetworkTokenized  = node.GetBoolean("is-network-tokenized");

            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], gateway);
            }
        }
        public Subscription(NodeWrapper node, IBraintreeGateway gateway)
        {
            Balance                = node.GetDecimal("balance");
            BillingDayOfMonth      = node.GetInteger("billing-day-of-month");
            BillingPeriodEndDate   = node.GetDateTime("billing-period-end-date");
            BillingPeriodStartDate = node.GetDateTime("billing-period-start-date");
            CurrentBillingCycle    = node.GetInteger("current-billing-cycle");
            DaysPastDue            = node.GetInteger("days-past-due");
            Descriptor             = new Descriptor(node.GetNode("descriptor"));
            Description            = node.GetString("description");
            FailureCount           = node.GetInteger("failure-count");
            FirstBillingDate       = node.GetDateTime("first-billing-date");
            CreatedAt              = node.GetDateTime("created-at");
            UpdatedAt              = node.GetDateTime("updated-at");
            Id                      = node.GetString("id");
            NextBillAmount          = node.GetDecimal("next-bill-amount");
            NextBillingDate         = node.GetDateTime("next-billing-date");
            NextBillingPeriodAmount = node.GetDecimal("next-billing-period-amount");
            NeverExpires            = node.GetBoolean("never-expires");
            NumberOfBillingCycles   = node.GetInteger("number-of-billing-cycles");
            PaymentMethodToken      = node.GetString("payment-method-token");
            PaidThroughDate         = node.GetDateTime("paid-through-date");
            PlanId                  = node.GetString("plan-id");
            Price                   = node.GetDecimal("price");
            Status                  = (SubscriptionStatus)CollectionUtil.Find(SubscriptionStatus.STATUSES, node.GetString("status"), SubscriptionStatus.UNRECOGNIZED);
            List <NodeWrapper> statusNodes = node.GetList("status-history/status-event");

            StatusHistory = new SubscriptionStatusEvent[statusNodes.Count];
            for (int i = 0; i < statusNodes.Count; i++)
            {
                StatusHistory[i] = new SubscriptionStatusEvent(statusNodes[i]);
            }
            HasTrialPeriod = node.GetBoolean("trial-period");
            TrialDuration  = node.GetInteger("trial-duration");
            var trialDurationUnitStr = node.GetString("trial-duration-unit");

            if (trialDurationUnitStr != null)
            {
                TrialDurationUnit = (SubscriptionDurationUnit)CollectionUtil.Find(SubscriptionDurationUnit.ALL, trialDurationUnitStr, SubscriptionDurationUnit.UNRECOGNIZED);
            }
            MerchantAccountId = node.GetString("merchant-account-id");

            AddOns = new List <AddOn> ();
            foreach (var addOnResponse in node.GetList("add-ons/add-on"))
            {
                AddOns.Add(new AddOn(addOnResponse));
            }
            Discounts = new List <Discount> ();
            foreach (var discountResponse in node.GetList("discounts/discount"))
            {
                Discounts.Add(new Discount(discountResponse));
            }
            Transactions = new List <Transaction> ();
            foreach (var transactionResponse in node.GetList("transactions/transaction"))
            {
                Transactions.Add(new Transaction(transactionResponse, gateway));
            }
        }
Beispiel #6
0
 protected internal DisbursementDetails(NodeWrapper node)
 {
     SettlementAmount               = node.GetDecimal("settlement-amount");
     SettlementCurrencyIsoCode      = node.GetString("settlement-currency-iso-code");
     SettlementCurrencyExchangeRate = node.GetString("settlement-currency-exchange-rate");
     FundsHeld        = node.GetBoolean("funds-held");
     Success          = node.GetBoolean("success");
     DisbursementDate = node.GetDateTime("disbursement-date");
 }
        public ThreeDSecureInfo(NodeWrapper node)
        {
            if (node == null) return;

            Enrolled = node.GetString("enrolled");
            Status = node.GetString("status");
            LiabilityShifted = node.GetBoolean("liability-shifted");
            LiabilityShiftPossible = node.GetBoolean("liability-shift-possible");
        }
 protected internal DisbursementDetails(NodeWrapper node)
 {
     SettlementAmount = node.GetDecimal("settlement-amount");
     SettlementCurrencyIsoCode = node.GetString("settlement-currency-iso-code");
     SettlementCurrencyExchangeRate = node.GetString("settlement-currency-exchange-rate");
     FundsHeld = node.GetBoolean("funds-held");
     Success = node.GetBoolean("success");
     DisbursementDate = node.GetDateTime("disbursement-date");
 }
Beispiel #9
0
        public ThreeDSecureInfo(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            Enrolled               = node.GetString("enrolled");
            Status                 = node.GetString("status");
            LiabilityShifted       = node.GetBoolean("liability-shifted");
            LiabilityShiftPossible = node.GetBoolean("liability-shift-possible");
        }
Beispiel #10
0
        protected internal CreditCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            if (node == null)
            {
                return;
            }

            Bin                    = node.GetString("bin");
            CardholderName         = node.GetString("cardholder-name");
            CardType               = node.GetEnum("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");
            IsNetworkTokenized     = node.GetBoolean("is-network-tokenized");
            CustomerLocation       = node.GetEnum("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                = node.GetEnum("prepaid", CreditCardPrepaid.UNKNOWN);
            Payroll                = node.GetEnum("payroll", CreditCardPayroll.UNKNOWN);
            DurbinRegulated        = node.GetEnum("durbin-regulated", CreditCardDurbinRegulated.UNKNOWN);
            Debit                  = node.GetEnum("debit", CreditCardDebit.UNKNOWN);
            Commercial             = node.GetEnum("commercial", CreditCardCommercial.UNKNOWN);
            Healthcare             = node.GetEnum("healthcare", CreditCardHealthcare.UNKNOWN);
            AccountType            = node.GetString("account-type");
            _CountryOfIssuance     = node.GetString("country-of-issuance");
            _IssuingBank           = node.GetString("issuing-bank");
            _ProductId             = node.GetString("product-id");
            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], gateway);
            }

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

            Verification = FindLatestVerification(verificationNodes, gateway);
        }
        protected internal AndroidPayCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            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");
            SourceDescription = node.GetString("source-description");
            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");
            CustomerId = node.GetString("customer-id");

            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], gateway);
            }
        }
Beispiel #12
0
        public Plan(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }
            BillingDayOfMonth = node.GetInteger("billing-day-of-month");
            BillingFrequency  = node.GetInteger("billing-frequency");
            CurrencyIsoCode   = node.GetString("currency-iso-code");
            Description       = node.GetString("description");
            Id   = node.GetString("id");
            Name = node.GetString("name");
            NumberOfBillingCycles = node.GetInteger("number-of-billing-cycles");
            Price         = node.GetDecimal("price");
            TrialPeriod   = node.GetBoolean("trial-period");
            TrialDuration = node.GetInteger("trial-duration");
            String trialDurationUnitStr = node.GetString("trial-duration-unit");

            if (trialDurationUnitStr != null)
            {
                TrialDurationUnit = (PlanDurationUnit)CollectionUtil.Find(PlanDurationUnit.ALL, trialDurationUnitStr, PlanDurationUnit.UNRECOGNIZED);
            }
            AddOns = new List <AddOn> ();
            foreach (NodeWrapper addOnResponse in node.GetList("add-ons/add-on"))
            {
                AddOns.Add(new AddOn(addOnResponse));
            }
            Discounts = new List <Discount> ();
            foreach (NodeWrapper discountResponse in node.GetList("discounts/discount"))
            {
                Discounts.Add(new Discount(discountResponse));
            }
        }
        protected internal VisaCheckoutCardDetails(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            Bin                    = node.GetString("bin");
            CallId                 = node.GetString("call-id");
            CardholderName         = node.GetString("cardholder-name");
            CardType               = node.GetEnum("card-type", CreditCardCardType.UNRECOGNIZED);
            ExpirationMonth        = node.GetString("expiration-month");
            ExpirationYear         = node.GetString("expiration-year");
            IsExpired              = node.GetBoolean("expired");
            CustomerLocation       = node.GetEnum("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                = node.GetEnum("prepaid", CreditCardPrepaid.UNKNOWN);
            Payroll                = node.GetEnum("payroll", CreditCardPayroll.UNKNOWN);
            DurbinRegulated        = node.GetEnum("durbin-regulated", CreditCardDurbinRegulated.UNKNOWN);
            Debit                  = node.GetEnum("debit", CreditCardDebit.UNKNOWN);
            Commercial             = node.GetEnum("commercial", CreditCardCommercial.UNKNOWN);
            Healthcare             = node.GetEnum("healthcare", CreditCardHealthcare.UNKNOWN);
            _CountryOfIssuance     = node.GetString("country-of-issuance");
            _IssuingBank           = node.GetString("issuing-bank");
            _ProductId             = node.GetString("product-id");
            ImageUrl               = node.GetString("image-url");
        }
        protected internal PaymentMethodNonce(NodeWrapper node, IBraintreeGateway gateway)
        {
            IsDefault = node.GetBoolean("default");
            Nonce     = node.GetString("nonce");
            Type      = node.GetString("type");

            var detailsNode = node.GetNode("details");

            if (detailsNode != null && !detailsNode.IsEmpty())
            {
                Details = new PaymentMethodNonceDetails(detailsNode);
            }

            var threeDSecureInfoNode = node.GetNode("three-d-secure-info");

            if (threeDSecureInfoNode != null && !threeDSecureInfoNode.IsEmpty())
            {
                ThreeDSecureInfo = new ThreeDSecureInfo(threeDSecureInfoNode);
            }

            var binData = node.GetNode("bin-data");

            if (binData != null && !binData.IsEmpty())
            {
                BinData = new BinData(binData);
            }
        }
 public UnknownPaymentMethod(NodeWrapper node)
 {
     Token      = node.GetString("token");
     IsDefault  = node.GetBoolean("default");
     ImageUrl   = "https://assets.braintreegateway.com/payment_method_logo/unknown.png";
     CustomerId = node.GetString("customer-id");
 }
 protected internal AndroidPayDetails(NodeWrapper node)
 {
     Bin                 = node.GetString("bin");
     ExpirationMonth     = node.GetString("expiration-month");
     ExpirationYear      = node.GetString("expiration-year");
     GoogleTransactionId = node.GetString("google-transaction-id");
     ImageUrl            = node.GetString("image-url");
     SourceCardType      = node.GetString("source-card-type");
     SourceCardLast4     = node.GetString("source-card-last-4");
     SourceDescription   = node.GetString("source-description");
     VirtualCardLast4    = node.GetString("virtual-card-last-4");
     VirtualCardType     = node.GetString("virtual-card-type");
     CardType            = node.GetString("virtual-card-type");
     Last4               = node.GetString("virtual-card-last-4");
     Token               = node.GetString("token");
     Prepaid             = node.GetString("prepaid");
     Healthcare          = node.GetString("healthcare");
     Debit               = node.GetString("debit");
     DurbinRegulated     = node.GetString("durbin-regulated");
     Commercial          = node.GetString("commercial");
     Payroll             = node.GetString("payroll");
     IssuingBank         = node.GetString("issuing-bank");
     CountryOfIssuance   = node.GetString("country-of-issuance");
     ProductId           = node.GetString("product-id");
     GlobalId            = node.GetString("global-id");
     IsNetworkTokenized  = node.GetBoolean("is-network-tokenized");
 }
        protected internal SamsungPayCardDetails(NodeWrapper node)
        {
            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);
            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");
            SourceCardLastFour     = node.GetString("source-card-last-4");
            UniqueNumberIdentifier = node.GetString("unique-number-identifier");
            Token                  = node.GetString("token");
            CreatedAt              = node.GetDateTime("created-at");
            UpdatedAt              = node.GetDateTime("updated-at");
            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");
            _ProductId             = node.GetString("product-id");
            ImageUrl               = node.GetString("image-url");
        }
 public UnknownPaymentMethod(NodeWrapper node)
 {
     Token = node.GetString("token");
     IsDefault = node.GetBoolean("default");
     ImageUrl = "https://assets.braintreegateway.com/payment_method_logo/unknown.png";
     CustomerId = node.GetString("customer-id");
 }
Beispiel #19
0
        protected internal AmexExpressCheckoutCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            Token                = node.GetString("token");
            CardType             = node.GetString("card-type");
            Bin                  = node.GetString("bin");
            ExpirationMonth      = node.GetString("expiration-month");
            ExpirationYear       = node.GetString("expiration-year");
            CardMemberNumber     = node.GetString("card-member-number");
            CardMemberExpiryDate = node.GetString("card-member-expiry-date");
            SourceDescription    = node.GetString("source-description");
            IsDefault            = node.GetBoolean("default");
            ImageUrl             = node.GetString("image-url");
            CustomerId           = node.GetString("customer-id");

            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], gateway);
            }
        }
Beispiel #20
0
 public Plan(NodeWrapper node)
 {
     if (node == null) return;
     BillingDayOfMonth = node.GetInteger("billing-day-of-month");
     BillingFrequency = node.GetInteger("billing-frequency");
     CurrencyIsoCode = node.GetString("currency-iso-code");
     Description = node.GetString("description");
     Id = node.GetString("id");
     Name = node.GetString("name");
     NumberOfBillingCycles = node.GetInteger("number-of-billing-cycles");
     Price = node.GetDecimal("price");
     TrialPeriod = node.GetBoolean("trial-period");
     TrialDuration = node.GetInteger("trial-duration");
     string trialDurationUnitStr = node.GetString("trial-duration-unit");
     if (trialDurationUnitStr != null) {
         TrialDurationUnit = (PlanDurationUnit) CollectionUtil.Find(PlanDurationUnit.ALL, trialDurationUnitStr, PlanDurationUnit.UNRECOGNIZED);
     }
     AddOns = new List<AddOn> ();
     foreach (var addOnResponse in node.GetList("add-ons/add-on")) {
         AddOns.Add(new AddOn(addOnResponse));
     }
     Discounts = new List<Discount> ();
     foreach (var discountResponse in node.GetList("discounts/discount")) {
         Discounts.Add(new Discount(discountResponse));
     }
 }
Beispiel #21
0
 public Disbursement(NodeWrapper node, BraintreeGateway gateway)
 {
     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 (var stringNode in node.GetList("transaction-ids/item")) 
     {
         TransactionIds.Add(stringNode.GetString("."));
     }
     Success = node.GetBoolean("success");
     Retry = node.GetBoolean("retry");
     this.gateway = gateway;
 }
 internal Modification(NodeWrapper node)
 {
     Amount = node.GetDecimal("amount");
     Id = node.GetString("id");
     NeverExpires = node.GetBoolean("never-expires");
     NumberOfBillingCycles = node.GetInteger("number-of-billing-cycles");
     Quantity = node.GetInteger("quantity");
 }
Beispiel #23
0
 public Disbursement(NodeWrapper node, IBraintreeGateway gateway)
 {
     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 (var stringNode in node.GetList("transaction-ids/item"))
     {
         TransactionIds.Add(stringNode.GetString("."));
     }
     Success      = node.GetBoolean("success");
     Retry        = node.GetBoolean("retry");
     this.gateway = gateway;
 }
Beispiel #24
0
        public ThreeDSecureInfo(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            Enrolled               = node.GetString("enrolled");
            Status                 = node.GetString("status");
            LiabilityShifted       = node.GetBoolean("liability-shifted");
            LiabilityShiftPossible = node.GetBoolean("liability-shift-possible");
            Cavv                = node.GetString("cavv");
            Xid                 = node.GetString("xid");
            DsTransactionId     = node.GetString("ds-transaction-id");
            EciFlag             = node.GetString("eci-flag");
            ThreeDSecureVersion = node.GetString("three-d-secure-version");
        }
Beispiel #25
0
        public OAuthResult(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            Result = node.GetBoolean("success");
        }
Beispiel #26
0
        protected internal MerchantAccount(NodeWrapper node)
        {
            NodeWrapper merchantAccountNode = node.GetNode("merchant-account");

            if (merchantAccountNode != null)
            {
                node = merchantAccountNode;
            }

            Id = node.GetString("id");
            CurrencyIsoCode = node.GetString("currency-iso-code");
            Status          = node.GetEnum <MerchantAccountStatus>("status");
            IsDefault       = node.GetBoolean("default");

            NodeWrapper masterNode = node.GetNode("master-merchant-account");

            if (masterNode != null)
            {
                MasterMerchantAccount = new MerchantAccount(masterNode);
            }
            else
            {
                MasterMerchantAccount = null;
            }
            NodeWrapper individualNode = node.GetNode("individual");

            if (individualNode != null)
            {
                IndividualDetails = new MerchantAccountIndividualDetails(individualNode);
            }
            else
            {
                IndividualDetails = null;
            }
            NodeWrapper businessNode = node.GetNode("business");

            if (businessNode != null)
            {
                BusinessDetails = new MerchantAccountBusinessDetails(businessNode);
            }
            else
            {
                BusinessDetails = null;
            }
            NodeWrapper fundingNode = node.GetNode("funding");

            if (fundingNode != null)
            {
                FundingDetails = new MerchantAccountFundingDetails(fundingNode);
            }
            else
            {
                FundingDetails = null;
            }
        }
        protected internal SamsungPayCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            if (node == null)
            {
                return;
            }

            Bin                    = node.GetString("bin");
            CardType               = (CreditCardCardType)CollectionUtil.Find(CreditCardCardType.ALL, node.GetString("card-type"), CreditCardCardType.UNRECOGNIZED);
            CustomerId             = node.GetString("customer-id");
            IsDefault              = node.GetBoolean("default");
            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");
            SourceCardLastFour     = node.GetString("source-card-last-4");
            UniqueNumberIdentifier = node.GetString("unique-number-identifier");
            Token                  = node.GetString("token");
            CreatedAt              = node.GetDateTime("created-at");
            UpdatedAt              = node.GetDateTime("updated-at");
            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");
            _ProductId             = node.GetString("product-id");
            ImageUrl               = node.GetString("image-url");
            BillingAddress         = new Address(node.GetNode("billing-address"));
            CardholderName         = node.GetString("cardholder-name");

            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], gateway);
            }
        }
Beispiel #28
0
        public AuthorizationAdjustment(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            Amount    = node.GetDecimal("amount");
            Success   = node.GetBoolean("success");
            Timestamp = node.GetDateTime("timestamp");
        }
Beispiel #29
0
        public RiskData(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            id                 = node.GetString("id");
            decision           = node.GetString("decision");
            deviceDataCaptured = node.GetBoolean("device-data-captured");
        }
Beispiel #30
0
        public RiskData(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            id                   = node.GetString("id");
            decision             = node.GetString("decision");
            fraudServiceProvider = node.GetString("fraud-service-provider");
            deviceDataCaptured   = node.GetBoolean("device-data-captured");
        }
 protected internal UsBankAccount(NodeWrapper node)
 {
     RoutingNumber      = node.GetString("routing-number");
     Last4              = node.GetString("last-4");
     AccountType        = node.GetString("account-type");
     AccountDescription = node.GetString("account-description");
     AccountHolderName  = node.GetString("account-holder-name");
     Token              = node.GetString("token");
     ImageUrl           = node.GetString("image-url");
     BankName           = node.GetString("bank-name");
     CustomerId         = node.GetString("customer-id");
     IsDefault          = node.GetBoolean("default");
 }
 protected internal UsBankAccount(NodeWrapper node)
 {
     RoutingNumber = node.GetString("routing-number");
     Last4 = node.GetString("last-4");
     AccountType = node.GetString("account-type");
     AccountDescription = node.GetString("account-description");
     AccountHolderName = node.GetString("account-holder-name");
     Token = node.GetString("token");
     ImageUrl = node.GetString("image-url");
     BankName = node.GetString("bank-name");
     CustomerId = node.GetString("customer-id");
     IsDefault = node.GetBoolean("default");
 }
Beispiel #33
0
        public AuthorizationAdjustment(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            Amount                = node.GetDecimal("amount");
            Success               = node.GetBoolean("success");
            Timestamp             = node.GetDateTime("timestamp");
            ProcessorResponseCode = node.GetString("processor-response-code");
            ProcessorResponseText = node.GetString("processor-response-text");
        }
        public AuthorizationAdjustment(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            Amount                = node.GetDecimal("amount");
            Success               = node.GetBoolean("success");
            Timestamp             = node.GetDateTime("timestamp");
            ProcessorResponseCode = node.GetString("processor-response-code");
            ProcessorResponseText = node.GetString("processor-response-text");
            ProcessorResponseType = (ProcessorResponseType)CollectionUtil.Find(ProcessorResponseType.ALL, node.GetString("processor-response-type"), ProcessorResponseType.UNRECOGNIZED);
        }
        protected internal ApplePayCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            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");
            SourceDescription = node.GetString("source-description");
            IsDefault = node.GetBoolean("default");
            IsExpired = node.GetBoolean("expired");
            ImageUrl = node.GetString("image-url");
            CustomerId = node.GetString("customer-id");
            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], gateway);
            }
        }
 protected Modification(NodeWrapper node)
 {
     Amount = node.GetDecimal("amount");
     CreatedAt = node.GetDateTime("created-at");
     Description = node.GetString("description");
     Id = node.GetString("id");
     Kind = node.GetString("kind");
     MerchantId = node.GetString("merchant-id");
     Name = node.GetString("name");
     NeverExpires = node.GetBoolean("never-expires");
     NumberOfBillingCycles = node.GetInteger("number-of-billing-cycles");
     Quantity = node.GetInteger("quantity");
     UpdatedAt = node.GetDateTime("updated-at");
 }
Beispiel #37
0
 protected Modification(NodeWrapper node)
 {
     Amount              = node.GetDecimal("amount");
     CreatedAt           = node.GetDateTime("created-at");
     CurrentBillingCycle = node.GetInteger("current-billing-cycle");
     Description         = node.GetString("description");
     Id                    = node.GetString("id");
     Kind                  = node.GetString("kind");
     MerchantId            = node.GetString("merchant-id");
     Name                  = node.GetString("name");
     NeverExpires          = node.GetBoolean("never-expires");
     NumberOfBillingCycles = node.GetInteger("number-of-billing-cycles");
     Quantity              = node.GetInteger("quantity");
     UpdatedAt             = node.GetDateTime("updated-at");
 }
        protected internal PayPalAccount(NodeWrapper node, BraintreeGateway gateway)
        {
            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], gateway);
            }
        }
        protected internal PayPalAccount(NodeWrapper node, BraintreeGateway gateway)
        {
            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], gateway);
            }
        }
Beispiel #40
0
        public RiskData(NodeWrapper node)
        {
            if (node == null)
            {
                return;
            }

            id                   = node.GetString("id");
            decision             = node.GetString("decision");
            fraudServiceProvider = node.GetString("fraud-service-provider");
            deviceDataCaptured   = node.GetBoolean("device-data-captured");
            TransactionRiskScore = node.GetString("transaction-risk-score");
            DecisionReasons      = new List <string>();
            foreach (var stringNode in node.GetList("decision-reasons/item"))
            {
                DecisionReasons.Add(stringNode.GetString("."));
            }
        }
        protected internal PaymentMethodNonceDetails(NodeWrapper node)
        {
            IsNetworkTokenized = node.GetBoolean("is-network-tokenized");
            Bin             = node.GetString("bin");
            CardType        = node.GetString("card-type");
            ExpirationMonth = node.GetString("expiration-month");
            ExpirationYear  = node.GetString("expiration-year");
            LastFour        = node.GetString("last-four");
            LastTwo         = node.GetString("last-two");
            Username        = node.GetString("username");
            VenmoUserId     = node.GetString("venmo-user-id");

            var payerInfoNode = node.GetNode("payer-info");

            if (payerInfoNode != null)
            {
                PayerInfo = new PaymentMethodNonceDetailsPayerInfo(payerInfoNode);
            }
        }
        protected internal CoinbaseAccount(NodeWrapper node, BraintreeService service)
        {
            UserId = node.GetString("user-id");
            UserEmail = node.GetString("user-email");
            UserName = node.GetString("user-name");

            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);
            }
        }
        protected internal VenmoAccount(NodeWrapper node, IBraintreeGateway gateway)
        {
            Token = node.GetString("token");
            Username = node.GetString("username");
            VenmoUserId = node.GetString("venmo-user-id");
            SourceDescription = node.GetString("source-description");
            ImageUrl = node.GetString("image-url");

            IsDefault = node.GetBoolean("default");
            CustomerId = node.GetString("customer-id");

            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], gateway);
            }
        }
        protected internal AmexExpressCheckoutCard(NodeWrapper node, BraintreeGateway gateway)
        {
            Token = node.GetString("token");
            CardType = node.GetString("card-type");
            Bin = node.GetString("bin");
            ExpirationMonth = node.GetString("expiration-month");
            ExpirationYear = node.GetString("expiration-year");
            CardMemberNumber = node.GetString("card-member-number");
            CardMemberExpiryDate = node.GetString("card-member-expiry-date");
            SourceDescription = node.GetString("source-description");
            IsDefault = node.GetBoolean("default");
            ImageUrl = node.GetString("image-url");
            CustomerId = node.GetString("customer-id");

            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], gateway);
            }
        }
Beispiel #45
0
        protected internal Transaction(NodeWrapper node, BraintreeGateway gateway)
        {
            Gateway = gateway;

            if (node == null) return;

            Id = node.GetString("id");
            Amount = node.GetDecimal("amount");
            AvsErrorResponseCode = node.GetString("avs-error-response-code");
            AvsPostalCodeResponseCode = node.GetString("avs-postal-code-response-code");
            AvsStreetAddressResponseCode = node.GetString("avs-street-address-response-code");
            GatewayRejectionReason = (TransactionGatewayRejectionReason)CollectionUtil.Find(
                TransactionGatewayRejectionReason.ALL,
                node.GetString("gateway-rejection-reason"),
                TransactionGatewayRejectionReason.UNRECOGNIZED
            );
            PaymentInstrumentType = (PaymentInstrumentType)CollectionUtil.Find(
                PaymentInstrumentType.ALL,
                node.GetString("payment-instrument-type"),
                PaymentInstrumentType.UNKNOWN
            );
            Channel = node.GetString("channel");
            OrderId = node.GetString("order-id");
            Status = (TransactionStatus)CollectionUtil.Find(TransactionStatus.ALL, node.GetString("status"), TransactionStatus.UNRECOGNIZED);
            EscrowStatus = (TransactionEscrowStatus)CollectionUtil.Find(
                    TransactionEscrowStatus.ALL,
                    node.GetString("escrow-status"),
                    TransactionEscrowStatus.UNRECOGNIZED
            );

            List<NodeWrapper> statusNodes = node.GetList("status-history/status-event");
            StatusHistory = new StatusEvent[statusNodes.Count];
            for (int i = 0; i < statusNodes.Count; i++)
            {
                StatusHistory[i] = new StatusEvent(statusNodes[i]);
            }

            Type = (TransactionType)CollectionUtil.Find(TransactionType.ALL, node.GetString("type"), TransactionType.UNRECOGNIZED);
            MerchantAccountId = node.GetString("merchant-account-id");
            ProcessorAuthorizationCode = node.GetString("processor-authorization-code");
            ProcessorResponseCode = node.GetString("processor-response-code");
            ProcessorResponseText = node.GetString("processor-response-text");
            ProcessorSettlementResponseCode = node.GetString("processor-settlement-response-code");
            ProcessorSettlementResponseText = node.GetString("processor-settlement-response-text");
            AdditionalProcessorResponse = node.GetString("additional-processor-response");
            VoiceReferralNumber = node.GetString("voice-referral-number");
            PurchaseOrderNumber = node.GetString("purchase-order-number");
            Recurring = node.GetBoolean("recurring");
            RefundedTransactionId = node.GetString("refunded-transaction-id");

            #pragma warning disable 0618
            RefundId = node.GetString("refund-id");
            #pragma warning restore 0618

            RefundIds = node.GetStrings("refund-ids/*");
            PartialSettlementTransactionIds = node.GetStrings("partial-settlement-transaction-ids/*");
            AuthorizedTransactionId = node.GetString("authorized-transaction-id");
            SettlementBatchId = node.GetString("settlement-batch-id");
            PlanId = node.GetString("plan-id");
            SubscriptionId = node.GetString("subscription-id");
            TaxAmount = node.GetDecimal("tax-amount");
            TaxExempt = node.GetBoolean("tax-exempt");
            CustomFields = node.GetDictionary("custom-fields");
            CreditCard = new CreditCard(node.GetNode("credit-card"), gateway);
            Subscription = new Subscription(node.GetNode("subscription"), gateway);
            Customer = new Customer(node.GetNode("customer"), gateway);
            CurrencyIsoCode = node.GetString("currency-iso-code");
            CvvResponseCode = node.GetString("cvv-response-code");
            Descriptor = new Descriptor(node.GetNode("descriptor"));
            ServiceFeeAmount = node.GetDecimal("service-fee-amount");
            DisbursementDetails = new DisbursementDetails(node.GetNode("disbursement-details"));
            var paypalNode = node.GetNode("paypal");
            if (paypalNode != null)
            {
                PayPalDetails = new PayPalDetails(paypalNode);
            }
            var coinbaseNode = node.GetNode("coinbase-account");
            if (coinbaseNode != null)
            {
                CoinbaseDetails = new CoinbaseDetails(coinbaseNode);
            }
            var applePayNode = node.GetNode("apple-pay");
            if (applePayNode != null)
            {
                ApplePayDetails = new ApplePayDetails(applePayNode);
            }
            var androidPayNode = node.GetNode("android-pay-card");
            if (androidPayNode != null)
            {
                AndroidPayDetails = new AndroidPayDetails(androidPayNode);
            }

            BillingAddress = new Address(node.GetNode("billing"));
            ShippingAddress = new Address(node.GetNode("shipping"));

            CreatedAt = node.GetDateTime("created-at");
            UpdatedAt = node.GetDateTime("updated-at");

            AddOns = new List<AddOn>();
            foreach (var addOnResponse in node.GetList("add-ons/add-on")) {
                AddOns.Add(new AddOn(addOnResponse));
            }
            Discounts = new List<Discount>();
            foreach (var discountResponse in node.GetList("discounts/discount")) {
                Discounts.Add(new Discount(discountResponse));
            }

            Disputes = new List<Dispute>();
            foreach (var dispute in node.GetList("disputes/dispute")) {
                Disputes.Add(new Dispute(dispute));
            }

            var riskDataNode = node.GetNode("risk-data");
            if (riskDataNode != null){
                RiskData = new RiskData(riskDataNode);
            }

            var threeDSecureInfoNode = node.GetNode("three-d-secure-info");
            if (threeDSecureInfoNode != null && !threeDSecureInfoNode.IsEmpty()){
                ThreeDSecureInfo = new ThreeDSecureInfo(threeDSecureInfoNode);
            }
        }
        protected internal CreditCard(NodeWrapper node, IBraintreeGateway gateway)
        {
            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], gateway);
            }

            var verificationNodes = node.GetList("verifications/verification");
            Verification = FindLatestVerification(verificationNodes, gateway);
        }
Beispiel #47
0
        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");
            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");
            Token = node.GetString("token");
            CreatedAt = node.GetDateTime("created-at");
            UpdatedAt = node.GetDateTime("updated-at");
            BillingAddress = new Address(node.GetNode("billing-address"));

            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);
            }
        }
        public Subscription(NodeWrapper node, BraintreeService service)
        {
            Balance = node.GetDecimal("balance");
            BillingDayOfMonth = node.GetInteger("billing-day-of-month");
            BillingPeriodEndDate = node.GetDateTime("billing-period-end-date");
            BillingPeriodStartDate = node.GetDateTime("billing-period-start-date");
            CurrentBillingCycle = node.GetInteger("current-billing-cycle");
            DaysPastDue = node.GetInteger("days-past-due");
            Descriptor = new Descriptor(node.GetNode("descriptor"));
            FailureCount = node.GetInteger("failure-count");
            FirstBillingDate = node.GetDateTime("first-billing-date");
            Id = node.GetString("id");
            NextBillAmount = node.GetDecimal("next-bill-amount");
            NextBillingDate = node.GetDateTime("next-billing-date");
            NextBillingPeriodAmount = node.GetDecimal("next-billing-period-amount");
            NeverExpires = node.GetBoolean("never-expires");
            NumberOfBillingCycles = node.GetInteger("number-of-billing-cycles");
            PaymentMethodToken = node.GetString("payment-method-token");
            PaidThroughDate = node.GetDateTime("paid-through-date");
            PlanId = node.GetString("plan-id");
            Price = node.GetDecimal("price");
            Status = (SubscriptionStatus)CollectionUtil.Find(SubscriptionStatus.STATUSES, node.GetString("status"), SubscriptionStatus.UNRECOGNIZED);
            HasTrialPeriod = node.GetBoolean("trial-period");
            TrialDuration = node.GetInteger("trial-duration");
            String trialDurationUnitStr = node.GetString("trial-duration-unit");
            if (trialDurationUnitStr != null) {
                TrialDurationUnit = (SubscriptionDurationUnit)CollectionUtil.Find(SubscriptionDurationUnit.ALL, trialDurationUnitStr, SubscriptionDurationUnit.UNRECOGNIZED);
            }
            MerchantAccountId = node.GetString("merchant-account-id");

            AddOns = new List<AddOn> ();
            foreach (NodeWrapper addOnResponse in node.GetList("add-ons/add-on")) {
                AddOns.Add(new AddOn(addOnResponse));
            }
            Discounts = new List<Discount> ();
            foreach (NodeWrapper discountResponse in node.GetList("discounts/discount")) {
                Discounts.Add(new Discount(discountResponse));
            }
            Transactions = new List<Transaction> ();
            foreach (NodeWrapper transactionResponse in node.GetList("transactions/transaction")) {
                Transactions.Add(new Transaction(transactionResponse, service));
            }
        }
Beispiel #49
0
        internal Transaction(NodeWrapper node, BraintreeService service)
        {
            Service = service;

            if (node == null) return;

            Id = node.GetString("id");
            Amount = node.GetDecimal("amount");
            AvsErrorResponseCode = node.GetString("avs-error-response-code");
            AvsPostalCodeResponseCode = node.GetString("avs-postal-code-response-code");
            AvsStreetAddressResponseCode = node.GetString("avs-street-address-response-code");
            GatewayRejectionReason = (TransactionGatewayRejectionReason)CollectionUtil.Find(
                TransactionGatewayRejectionReason.ALL,
                node.GetString("gateway-rejection-reason"),
                null
            );
            OrderId = node.GetString("order-id");
            Status = (TransactionStatus)CollectionUtil.Find(TransactionStatus.ALL, node.GetString("status"), TransactionStatus.UNRECOGNIZED);

            List<NodeWrapper> statusNodes = node.GetList("status-history/status-event");
            StatusHistory = new StatusEvent[statusNodes.Count];
            for (int i = 0; i < statusNodes.Count; i++)
            {
                StatusHistory[i] = new StatusEvent(statusNodes[i]);
            }

            Type = (TransactionType)CollectionUtil.Find(TransactionType.ALL, node.GetString("type"), TransactionType.UNRECOGNIZED);
            MerchantAccountId = node.GetString("merchant-account-id");
            ProcessorAuthorizationCode = node.GetString("processor-authorization-code");
            ProcessorResponseCode = node.GetString("processor-response-code");
            ProcessorResponseText = node.GetString("processor-response-text");
            PurchaseOrderNumber = node.GetString("purchase-order-number");
            RefundedTransactionId = node.GetString("refunded-transaction-id");

            #pragma warning disable 0618
            RefundId = node.GetString("refund-id");
            #pragma warning restore 0618

            RefundIds = node.GetStrings("refund-ids/*");
            SettlementBatchId = node.GetString("settlement-batch-id");
            SubscriptionId = node.GetString("subscription-id");
            TaxAmount = node.GetDecimal("tax-amount");
            TaxExempt = node.GetBoolean("tax-exempt");
            CustomFields = node.GetDictionary("custom-fields");
            CreditCard = new CreditCard(node.GetNode("credit-card"), service);
            Subscription = new Subscription(node.GetNode("subscription"), service);
            Customer = new Customer(node.GetNode("customer"), service);
            CurrencyIsoCode = node.GetString("currency-iso-code");
            CvvResponseCode = node.GetString("cvv-response-code");
            Descriptor = new Descriptor(node.GetNode("descriptor"));

            BillingAddress = new Address(node.GetNode("billing"));
            ShippingAddress = new Address(node.GetNode("shipping"));

            CreatedAt = node.GetDateTime("created-at");
            UpdatedAt = node.GetDateTime("updated-at");

            AddOns = new List<AddOn>();
            foreach (NodeWrapper addOnResponse in node.GetList("add-ons/add-on")) {
                AddOns.Add(new AddOn(addOnResponse));
            }
            Discounts = new List<Discount>();
            foreach (NodeWrapper discountResponse in node.GetList("discounts/discount")) {
                Discounts.Add(new Discount(discountResponse));
            }
        }