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); } }
public static bool IncludesSubscription(ResourceCollection<Subscription> collection, Subscription subscription) { foreach (Subscription item in collection) { if (item.Id.Equals(subscription.Id)) { return true; } } return false; }
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); } }
public WebhookNotification(NodeWrapper node, BraintreeGateway gateway) { 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"), gateway); } 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"), gateway); } if (WrapperNode.GetNode("disbursement") != null) { Disbursement = new Disbursement(WrapperNode.GetNode("disbursement"), gateway); } 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"); } }
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 ApplePayCard(NodeWrapper node, BraintreeGateway 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"); 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 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); } }
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); }
private void MakePastDue(Subscription subscription, int numberOfDays) { BraintreeService service = new BraintreeService(gateway.Configuration); NodeWrapper response = new NodeWrapper(service.Put("/subscriptions/" + subscription.Id + "/make_past_due?days_past_due=" + numberOfDays)); Assert.IsTrue(response.IsSuccess()); }
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)); } }
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); } }
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 WebhookNotification(NodeWrapper node, BraintreeService service) { Timestamp = node.GetDateTime("timestamp"); Kind = (WebhookKind)CollectionUtil.Find(WebhookKind.ALL, node.GetString("kind"), WebhookKind.UNRECOGNIZED); Subscription = new Subscription(node.GetNode("subject/subscription"), service); }