Exemplo n.º 1
0
        public virtual List <TransactionLineItem> FindAll(string id)
        {
            if (id == null || id.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            var response = new NodeWrapper(service.Get(service.MerchantPath() + "/transactions/" + id + "/line_items"));

            if (response.GetName() == "line-items")
            {
                var transactionLineItems = new List <TransactionLineItem>();
                foreach (var node in response.GetList("line-item"))
                {
                    transactionLineItems.Add(new TransactionLineItem(node));
                }
                return(transactionLineItems);
            }
            else
            {
                throw new UnexpectedException();
            }
        }
Exemplo n.º 2
0
        public Result <PaymentMethod> Create(PaymentMethodRequest request)
        {
            var response = new NodeWrapper(service.Post(service.MerchantPath() + "/payment_methods", request));

            if (response.GetName() == "paypal-account")
            {
                return(new ResultImpl <PayPalAccount>(response, gateway));
            }
            else if (response.GetName() == "us-bank-account")
            {
                return(new ResultImpl <UsBankAccount>(response, gateway));
            }
            else if (response.GetName() == "credit-card")
            {
                return(new ResultImpl <CreditCard>(response, gateway));
            }
            else if (response.GetName() == "apple-pay-card")
            {
                return(new ResultImpl <ApplePayCard>(response, gateway));
            }
            else if (response.GetName() == "android-pay-card")
            {
                return(new ResultImpl <AndroidPayCard>(response, gateway));
            }
            else if (response.GetName() == "amex-express-checkout-card")
            {
                return(new ResultImpl <AmexExpressCheckoutCard>(response, gateway));
            }
            else if (response.GetName() == "coinbase-account")
            {
                return(new ResultImpl <CoinbaseAccount>(response, gateway));
            }
            else if (response.GetName() == "venmo-account")
            {
                return(new ResultImpl <VenmoAccount>(response, gateway));
            }
            else
            {
                return(new ResultImpl <UnknownPaymentMethod>(response, gateway));
            }
        }
        public PayPalAccount Find(string token)
        {
            XmlNode xml = service.Get(service.MerchantPath() + "/payment_methods/paypal_account/" + token);

            return(new PayPalAccount(new NodeWrapper(xml), gateway));
        }
Exemplo n.º 4
0
        public virtual Result <Address> Create(string customerId, AddressRequest request)
        {
            XmlNode addressXML = Service.Post(Service.MerchantPath() + "/customers/" + customerId + "/addresses", request);

            return(new ResultImpl <Address>(new NodeWrapper(addressXML), Gateway));
        }
        public Result <PaymentMethod> Create(PaymentMethodRequest request)
        {
            var response = new NodeWrapper(service.Post(service.MerchantPath() + "/payment_methods", request));

            return(ExtractResultFromResponse(response));
        }
Exemplo n.º 6
0
 public static void SettlementPending(BraintreeService service, string transactionId)
 {
   NodeWrapper response = new NodeWrapper(service.Put(service.MerchantPath() + "/transactions/" + transactionId + "/settlement_pending"));
   Assert.IsTrue(response.IsSuccess());
 }
Exemplo n.º 7
0
        public virtual Result <CreditCard> Create(CreditCardRequest request)
        {
            XmlNode creditCardXML = service.Post(service.MerchantPath() + "/payment_methods", request);

            return(new ResultImpl <CreditCard>(new NodeWrapper(creditCardXML), gateway));
        }
Exemplo n.º 8
0
        public virtual Customer Find(string Id)
        {
            if (Id == null || Id.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            XmlNode customerXML = service.Get(service.MerchantPath() + "/customers/" + Id);

            return(new Customer(new NodeWrapper(customerXML), gateway));
        }
        public virtual Result <MerchantAccount> Create(MerchantAccountRequest request)
        {
            XmlNode merchantAccountXML = service.Post(service.MerchantPath() + "/merchant_accounts/create_via_api", request);

            return(new ResultImpl <MerchantAccount>(new NodeWrapper(merchantAccountXML), gateway));
        }
Exemplo n.º 10
0
        public virtual Result <Dispute> Accept(string disputeId)
        {
            NotFoundException notFoundException = new NotFoundException(String.Format("dispute with id '{0}' not found", disputeId));

            if (disputeId == null || disputeId.Trim().Equals(""))
            {
                throw notFoundException;
            }

            try {
                XmlNode disputeXML = Service.Put(Service.MerchantPath() + "/disputes/" + disputeId + "/accept");

                return(new ResultImpl <Dispute>(new NodeWrapper(disputeXML), Gateway));
            } catch (NotFoundException) {
                throw notFoundException;
            }
        }
Exemplo n.º 11
0
 public static void Escrow(BraintreeService service, string transactionId)
 {
   NodeWrapper response = new NodeWrapper(service.Put(service.MerchantPath() + "/transactions/" + transactionId + "/escrow"));
   Assert.IsTrue(response.IsSuccess());
 }
Exemplo n.º 12
0
 public static string Create3DSVerification(BraintreeService service, string merchantAccountId, ThreeDSecureRequestForTests request)
 {
   string url = "/three_d_secure/create_verification/" + merchantAccountId;
   NodeWrapper response = new NodeWrapper(service.Post(service.MerchantPath() + url, request));
   Assert.IsTrue(response.IsSuccess());
   return response.GetString("three-d-secure-token");
 }
Exemplo n.º 13
0
 private void MakePastDue(Subscription subscription, int numberOfDays)
 {
     BraintreeService service = new BraintreeService(gateway.Configuration);
     NodeWrapper response = new NodeWrapper(service.Put(service.MerchantPath() + "/subscriptions/" + subscription.Id + "/make_past_due?days_past_due=" + numberOfDays));
     Assert.IsTrue(response.IsSuccess());
 }
Exemplo n.º 14
0
        public IdealPayment Find(string idealPaymentId)
        {
            XmlNode xml = service.Get(service.MerchantPath() + "/ideal_payments/" + idealPaymentId);

            return(new IdealPayment(new NodeWrapper(xml)));
        }
Exemplo n.º 15
0
        public virtual Result <Transaction> AdjustAuthorization(string id, decimal amount)
        {
            var request = new TransactionRequest
            {
                Amount = amount
            };
            XmlNode response = service.Put(service.MerchantPath() + "/transactions/" + id + "/adjust_authorization", request);

            return(new ResultImpl <Transaction>(new NodeWrapper(response), gateway));
        }
        private Result <SettlementBatchSummary> GetSummary(SettlementBatchSummaryRequest request)
        {
            var response = new NodeWrapper(service.Post(service.MerchantPath() + "/settlement_batch_summary", request));

            return(new ResultImpl <SettlementBatchSummary>(response, gateway));
        }
Exemplo n.º 17
0
        public Result <PaymentMethodNonce> Create(string token)
        {
            var response = new NodeWrapper(service.Post(service.MerchantPath() + "/payment_methods/" + token + "/nonces"));

            return(new ResultImpl <PaymentMethodNonce>(response, gateway));
        }
Exemplo n.º 18
0
        public virtual Result <CreditCardVerification> Create(CreditCardVerificationRequest request)
        {
            XmlNode response = service.Post(service.MerchantPath() + "/verifications", request);

            return(new ResultImpl <CreditCardVerification>(new NodeWrapper(response), gateway));
        }
Exemplo n.º 19
0
        public virtual Result <Subscription> Create(SubscriptionRequest request)
        {
            XmlNode subscriptionXML = service.Post(service.MerchantPath() + "/subscriptions", request);

            return(new ResultImpl <Subscription>(new NodeWrapper(subscriptionXML), gateway));
        }
        public virtual Result <UsBankAccountVerification> ConfirmMicroTransferAmounts(string Id, UsBankAccountVerificationConfirmRequest request)
        {
            var response = new NodeWrapper(service.Put(service.MerchantPath() + "/us_bank_account_verifications/" + Id + "/confirm_micro_transfer_amounts", request));

            return(new ResultImpl <UsBankAccountVerification>(response, gateway));
        }
Exemplo n.º 21
0
        public UsBankAccount Find(string token)
        {
            XmlNode xml = service.Get(service.MerchantPath() + "/payment_methods/us_bank_account/" + token);

            return(new UsBankAccount(new NodeWrapper(xml)));
        }
Exemplo n.º 22
0
        public virtual Result <Transaction> CancelRelease(string id)
        {
            var request = new TransactionRequest();

            XmlNode response = service.Put(service.MerchantPath() + "/transactions/" + id + "/cancel_release", request);

            return(new ResultImpl <Transaction>(new NodeWrapper(response), gateway));
        }
Exemplo n.º 23
0
 public static NodeWrapper Settle(BraintreeService service, string transactionId)
 {
   NodeWrapper response = new NodeWrapper(service.Put(service.MerchantPath() + "/transactions/" + transactionId + "/settle"));
   Assert.IsTrue(response.IsSuccess());
   return response;
 }