Beispiel #1
0
        public virtual async Task <CreditCard> FindAsync(string token)
        {
            if (token == null || token.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            XmlNode creditCardXML = await service.GetAsync(service.MerchantPath() + "/payment_methods/credit_card/" + token).ConfigureAwait(false);

            return(new CreditCard(new NodeWrapper(creditCardXML), gateway));
        }
Beispiel #2
0
        public virtual async Task <Transaction> FindAsync(string id)
        {
            if (id == null || id.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            XmlNode response = await service.GetAsync(service.MerchantPath() + "/transactions/" + id).ConfigureAwait(false);

            return(new Transaction(new NodeWrapper(response), gateway));
        }
Beispiel #3
0
        public virtual async Task <Customer> FindAsync(string Id)
        {
            if (Id == null || Id.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

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

            return(new Customer(new NodeWrapper(customerXML), gateway));
        }
        public virtual async Task <Subscription> FindAsync(string id)
        {
            if (id == null || id.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            XmlNode subscriptionXML = await service.GetAsync(service.MerchantPath() + "/subscriptions/" + id).ConfigureAwait(false);

            return(new Subscription(new NodeWrapper(subscriptionXML), gateway));
        }
        public virtual async Task <MerchantAccount> FindAsync(string id)
        {
            if (id == null || id.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            XmlNode merchantAccountXML = await service.GetAsync(service.MerchantPath() + "/merchant_accounts/" + id).ConfigureAwait(false);

            return(new MerchantAccount(new NodeWrapper(merchantAccountXML)));
        }
        public async Task <PaymentMethod> FindAsync(string token)
        {
            if (token == null || token.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            var response = new NodeWrapper(await service.GetAsync(service.MerchantPath() + "/payment_methods/any/" + token).ConfigureAwait(false));

            return(ExtractPaymentMethodFromResponse(response));
        }
        public virtual async Task <Address> FindAsync(string customerId, string id)
        {
            if (customerId == null || customerId.Trim().Equals("") || id == null || id.Trim().Equals(""))
            {
                throw new NotFoundException();
            }

            XmlNode addressXML = await Service.GetAsync(Service.MerchantPath() + "/customers/" + customerId + "/addresses/" + id).ConfigureAwait(false);

            return(new Address(new NodeWrapper(addressXML)));
        }
        public virtual async Task <List <Plan> > AllAsync()
        {
            var response = new NodeWrapper(await service.GetAsync(service.MerchantPath() + "/plans").ConfigureAwait(false));

            var plans = new List <Plan>();

            foreach (var node in response.GetList("plan"))
            {
                plans.Add(new Plan(node));
            }
            return(plans);
        }
        public virtual async Task <List <Discount> > AllAsync()
        {
            var response = new NodeWrapper(await service.GetAsync(service.MerchantPath() + "/discounts"));

            var discounts = new List <Discount>();

            foreach (var node in response.GetList("discount"))
            {
                discounts.Add(new Discount(node));
            }
            return(discounts);
        }
Beispiel #10
0
        public virtual async Task <List <AddOn> > AllAsync()
        {
            var response = new NodeWrapper(await Service.GetAsync(Service.MerchantPath() + "/add_ons"));

            var addOns = new List <AddOn>();

            foreach (var node in response.GetList("add-on"))
            {
                addOns.Add(new AddOn(node));
            }
            return(addOns);
        }
Beispiel #11
0
        public virtual async Task <Result <Dispute> > FindAsync(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 = await Service.GetAsync(Service.MerchantPath() + "/disputes/" + disputeId).ConfigureAwait(false);

                return(new ResultImpl <Dispute>(new NodeWrapper(disputeXML), Gateway));
            } catch (NotFoundException) {
                throw notFoundException;
            }
        }
Beispiel #12
0
        public virtual async Task <PaymentMethodNonce> FindAsync(string nonce)
        {
            var response = new NodeWrapper(await service.GetAsync(service.MerchantPath() + "/payment_method_nonces/" + nonce));

            return(new PaymentMethodNonce(response, gateway));
        }