예제 #1
0
        /// <summary>
        /// create an instance of payments. This will start a new payments session
        /// </summary>
        /// <param name="pathCallSid"> The SID of the call that will create the resource. </param>
        /// <param name="idempotencyKey"> A unique token for each payment session that should be provided to maintain
        ///                      idempotency of the session. </param>
        /// <param name="statusCallback"> The URL we should call to send status of payment session. </param>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="bankAccountType"> If Payment source is ACH, type of bank account. </param>
        /// <param name="chargeAmount"> If this field is present and greater than `0.0` payment source will be charged. </param>
        /// <param name="currency"> Currency `charge_amount` is in. </param>
        /// <param name="description"> Decription of the charge. </param>
        /// <param name="input"> Kind of medium customer would enter payment source information in. </param>
        /// <param name="minPostalCodeLength"> If postal code is expected, minimum length of the postal code. </param>
        /// <param name="parameter"> Additonal data to be sent over to payment provider. </param>
        /// <param name="paymentConnector"> Payment connector that you would like Twilio to use for processing payments.
        ///                        </param>
        /// <param name="paymentMethod"> Payment source type. </param>
        /// <param name="postalCode"> Whether to expect postal code during payment source data gathering. </param>
        /// <param name="securityCode"> Whether to expect security code during payment source data gathering. </param>
        /// <param name="timeout"> The number of seconds that we should allow customer to enter payment information </param>
        /// <param name="tokenType"> If tokenization of payment source is desired, this represents type of token. </param>
        /// <param name="validCardTypes"> List of card types accepted with each card types separated by space. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Payment </returns>
        public static async System.Threading.Tasks.Task <PaymentResource> CreateAsync(string pathCallSid,
                                                                                      string idempotencyKey,
                                                                                      Uri statusCallback,
                                                                                      string pathAccountSid = null,
                                                                                      PaymentResource.BankAccountTypeEnum bankAccountType = null,
                                                                                      decimal?chargeAmount    = null,
                                                                                      string currency         = null,
                                                                                      string description      = null,
                                                                                      string input            = null,
                                                                                      int?minPostalCodeLength = null,
                                                                                      object parameter        = null,
                                                                                      string paymentConnector = null,
                                                                                      PaymentResource.PaymentMethodEnum paymentMethod = null,
                                                                                      bool?postalCode   = null,
                                                                                      bool?securityCode = null,
                                                                                      int?timeout       = null,
                                                                                      PaymentResource.TokenTypeEnum tokenType = null,
                                                                                      string validCardTypes    = null,
                                                                                      ITwilioRestClient client = null)
        {
            var options = new CreatePaymentOptions(pathCallSid, idempotencyKey, statusCallback)
            {
                PathAccountSid = pathAccountSid, BankAccountType = bankAccountType, ChargeAmount = chargeAmount, Currency = currency, Description = description, Input = input, MinPostalCodeLength = minPostalCodeLength, Parameter = parameter, PaymentConnector = paymentConnector, PaymentMethod = paymentMethod, PostalCode = postalCode, SecurityCode = securityCode, Timeout = timeout, TokenType = tokenType, ValidCardTypes = validCardTypes
            };

            return(await CreateAsync(options, client));
        }
예제 #2
0
        /// <summary>
        /// create an instance of payments. This will start a new payments session
        /// </summary>
        /// <param name="options"> Create Payment parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payment </returns>
        public static PaymentResource Create(CreatePaymentOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
예제 #3
0
 private static Request BuildCreateRequest(CreatePaymentOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Calls/" + options.PathCallSid + "/Payments.json",
                postParams: options.GetParams()
                ));
 }
예제 #4
0
        /// <summary>
        /// create an instance of payments. This will start a new payments session
        /// </summary>
        /// <param name="options"> Create Payment parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Payment </returns>
        public static async System.Threading.Tasks.Task <PaymentResource> CreateAsync(CreatePaymentOptions options,
                                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }