示例#1
0
        public virtual async Task <OAuthToken> Create(OAuthTokenCreateOptions createOptions)
        {
            var url = this.ApplyAllParameters(createOptions, Urls.OAuthToken, false);

            var response = await Requestor.Post(url, true);

            return(Mapper <OAuthToken> .MapFromJson(response));
        }
示例#2
0
        public virtual async Task <Charge> Create(ChargeCreateOptions options)
        {
            var url = this.ApplyAllParameters(options, Urls.Charges, false);

            var response = await Requestor.Post(url);

            return(Mapper <Charge> .MapFromJson(response));
        }
示例#3
0
        public virtual async Task <InvoiceLineItem> Create(InvoiceItemCreateOptions options)
        {
            var url = this.ApplyAllParameters(options, Urls.InvoiceItems, false);

            var response = await Requestor.Post(url);

            return(Mapper <InvoiceLineItem> .MapFromJson(response));
        }
        /// <summary>
        /// Lists all customers matching given criteria.  Note this Addresses and Phones properties of returned Customer objects are not filled.
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="taxId"></param>
        /// <param name="passportNumber"></param>
        /// <param name="driversLicenseNumber"></param>
        /// <param name="emailAddress"></param>
        /// <param name="lastName"></param>
        /// <param name="firstName"></param>
        /// <param name="connection"></param>
        /// <returns></returns>
        public virtual List <Customer> Search(int?pageNumber = 0, int?pageSize = 200, Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();

            var rv = Requestor.Post <List <Customer> >(String.Format("customer/search?pageNumber={0}&pageSize={1}", pageNumber, pageSize), connection, this, userDefinedObjectForLogging);

            return(rv);
        }
示例#5
0
        public virtual async Task <Customer> Create(CustomerCreateOptions createOptions)
        {
            var url = this.ApplyAllParameters(createOptions, Urls.Customers, false);

            var response = await Requestor.Post(url);

            return(Mapper <Customer> .MapFromJson(response));
        }
        public virtual async Task <Recipient> Create(RecipientCreateOptions options)
        {
            var url = this.ApplyAllParameters(options, Urls.Recipients, false);

            var response = await Requestor.Post(url);

            return(Mapper <Recipient> .MapFromJson(response));
        }
示例#7
0
		public virtual async Task<Card> Update(string customerOrRecipientId, string cardId, CardUpdateOptions options, bool isRecipient = false)
		{
			var url = this.SetupUrl(customerOrRecipientId, isRecipient, cardId);
			url = this.ApplyAllParameters(options, url, false);

			var response = await Requestor.Post(url);

			return Mapper<Card>.MapFromJson(response);
		}
        /// <summary>
        /// Uses given parameters (or if null, corresponding properties on the current object) to deactivate the external account.  Returns true on success, throws exception otherwise.
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="externalAccountId"></param>
        /// <param name="connection"></param>
        /// <returns></returns>
        public virtual bool Archive(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var body = new { CustomerId = this.CustomerId, ExternalAccountId = this.ExternalAccountId };
            var rv1  = Requestor.Post <ModelBase>("externalaccount/archive", connection, body, userDefinedObjectForLogging);

            this.RequestId = rv1.RequestId;
            return(true);
        }
示例#9
0
        public virtual async Task <Transfer> Cancel(string transferId)
        {
            var url = string.Format("{0}/{1}/cancel", Urls.Transfers, transferId);

            url = this.ApplyAllParameters(null, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Transfer> .MapFromJson(response));
        }
示例#10
0
        public virtual async Task <Recipient> Update(string recipientId, RecipientUpdateOptions options)
        {
            var url = string.Format("{0}/{1}", Urls.Recipients, recipientId);

            url = this.ApplyAllParameters(options, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Recipient> .MapFromJson(response));
        }
示例#11
0
        public virtual async Task <Invoice> Pay(string invoiceId)
        {
            var url = string.Format("{0}/{1}/pay", Urls.Invoices, invoiceId);

            url = this.ApplyAllParameters(null, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Invoice> .MapFromJson(response));
        }
示例#12
0
        public virtual async Task <Refund> Update(string chargeId, string refundId, RefundUpdateOptions options)
        {
            var url = string.Format("{0}/{1}/refunds/{2}", Urls.Charges, chargeId, refundId);

            url = this.ApplyAllParameters(options, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Refund> .MapFromJson(response));
        }
示例#13
0
        public virtual async Task <Plan> Update(string planId, PlanUpdateOptions updateOptions)
        {
            var url = string.Format("{0}/{1}", Urls.Plans, planId);

            url = this.ApplyAllParameters(updateOptions, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Plan> .MapFromJson(response));
        }
示例#14
0
        public virtual async Task <Subscription> Update(string customerId, string subscriptionId, SubscriptionUpdateOptions updateOptions)
        {
            var url = string.Format(Urls.Subscriptions + "/{1}", customerId, subscriptionId);

            url = this.ApplyAllParameters(updateOptions, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Subscription> .MapFromJson(response));
        }
示例#15
0
        public virtual async Task <Customer> Update(string customerId, CustomerUpdateOptions updateOptions)
        {
            var url = string.Format("{0}/{1}", Urls.Customers, customerId);

            url = this.ApplyAllParameters(updateOptions, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Customer> .MapFromJson(response));
        }
示例#16
0
        public virtual async Task <InvoiceLineItem> Update(string invoiceItemId, InvoiceItemUpdateOptions options)
        {
            var url = string.Format("{0}/{1}", Urls.InvoiceItems, invoiceItemId);

            url = this.ApplyAllParameters(options, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <InvoiceLineItem> .MapFromJson(response));
        }
        public virtual bool Update(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <Account>("account/update", connection, this, userDefinedObjectForLogging);

            if (rv != null)
            {
                this.RequestId = rv.RequestId;
            }
            return(true);
        }
        /// <summary>
        /// Finishes the customer creation process started by Customer.Initiate().  Requires the answers to the questions as well as the verificationId and question types supplied from the Customer.Initiate() call.  When this call has returned successfully, the customer is active.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="connection"></param>
        /// <returns></returns>
        public CustomerResponse Verify(CustomerVerifyRequest request, Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <CustomerResponse>("customer/verify", connection, request, userDefinedObjectForLogging);

            if (rv != null)
            {
                request.RequestId = rv.RequestId;
            }
            return(rv);
        }
示例#19
0
        public virtual async Task <Subscription> Create(string customerId, string planId, SubscriptionCreateOptions createOptions = null)
        {
            var url = string.Format(Urls.Subscriptions, customerId);

            url = this.ApplyAllParameters(createOptions, url, false);
            url = ParameterBuilder.ApplyParameterToUrl(url, "plan", planId);

            var response = await Requestor.Post(url);

            return(Mapper <Subscription> .MapFromJson(response));
        }
示例#20
0
        public virtual async Task <Account> Update(string id, AccountUpdateOptions updateOptions)
        {
            var postData = this.ApplyAllParameters(updateOptions, string.Empty, false);

            //remove the ?
            postData = RemoveQuestionMark(postData);

            var response = await Requestor.Post(string.Format(Urls.SpecificAccount, id), data : postData);

            return(Mapper <Account> .MapFromJson(response));
        }
示例#21
0
        public virtual async Task <Account> Create(AccountCreateOptions createOptions)
        {
            var postData = this.ApplyAllParameters(createOptions, string.Empty, false);

            //remove the ?
            postData = RemoveQuestionMark(postData);

            var response = await Requestor.Post(Urls.Accounts, data : postData);

            return(Mapper <Account> .MapFromJson(response));
        }
示例#22
0
        public virtual async Task <Invoice> Create(string customerId, InvoiceCreateOptions options = null)
        {
            var url = Urls.Invoices;

            url = ParameterBuilder.ApplyParameterToUrl(url, "customer", customerId);
            url = this.ApplyAllParameters(options, url, false);

            var response = await Requestor.Post(url);

            return(Mapper <Invoice> .MapFromJson(response));
        }
        public virtual Authorization Request(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <Authorization>("iso8583/authorization/request", connection, this, userDefinedObjectForLogging);

            if (rv != null)
            {
                this.RequestId = rv.RequestId;
            }
            return(rv);
        }
        /// <summary>
        /// Edits a customer.
        /// </summary>
        /// <param name="connection"></param>
        /// <returns></returns>
        public virtual CustomerIdOnly Update(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <CustomerIdOnly>("customer/update", connection, this, userDefinedObjectForLogging);

            if (rv != null)
            {
                this.RequestId = rv.RequestId;
            }
            return(rv);
        }
        public virtual Chargeback Request(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <Chargeback>("iso8583/chargeback/request", connection, this, userDefinedObjectForLogging);

            if (rv != null)
            {
                this.RequestId = rv.RequestId;
            }
            return(rv);
        }
        public virtual Reversal Advice(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <Reversal>("iso8583/reversal/advice", connection, this, userDefinedObjectForLogging);

            if (rv != null)
            {
                this.RequestId = rv.RequestId;
            }
            return(rv);
        }
        /// <summary>
        /// Creates a customer beneficiary using properties from the current object.
        /// </summary>
        /// <param name="connection"></param>
        /// <returns></returns>
        public virtual CustomerBeneficiary Update(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv1 = Requestor.Post <CustomerBeneficiary>("customerBeneficiary/update", connection, this, userDefinedObjectForLogging);

            this.RequestId = rv1.RequestId;
            var rv = CustomerBeneficiary.Get(this.CustomerId, (int)this.CustomerBeneficiaryId, connection, userDefinedObjectForLogging);

            rv.RequestId = rv1.RequestId;
            return(rv);
        }
        public virtual List <Transfer> Create(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <List <Transfer> >("transfer/create", connection, this, userDefinedObjectForLogging);

            if (rv != null && rv.Count > 0)
            {
                this.RequestId = rv[0].RequestId;
            }
            return(rv);
        }
        public virtual int Create(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var rv = Requestor.Post <Account>("account/create", connection, this, userDefinedObjectForLogging);

            if (rv != null)
            {
                this.AccountId = (int)rv.AccountId;
                this.RequestId = rv.RequestId;
            }
            return((int)this.AccountId);
        }
        /// <summary>
        /// Creates a customer with no identity verification performed.
        /// </summary>
        /// <param name="connection"></param>
        /// <returns></returns>
        public virtual Customer Create(Connection connection = null, object userDefinedObjectForLogging = null)
        {
            connection = connection ?? Connection.CreateFromConfig();
            var newCustomer = Requestor.Post <Customer>("customer/create", connection, this, userDefinedObjectForLogging);
            var rv          = Customer.Get((int)newCustomer.CustomerId, connection, userDefinedObjectForLogging);

            if (rv != null)
            {
                this.RequestId = rv.RequestId;
            }
            return(rv);
        }