Пример #1
0
        /// <summary>
        /// update an instance of payments with different phases of payment flows.
        /// </summary>
        /// <param name="options"> Update Payment parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payment </returns>
        public static PaymentResource Update(UpdatePaymentOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }
Пример #2
0
 private static Request BuildUpdateRequest(UpdatePaymentOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Calls/" + options.PathCallSid + "/Payments/" + options.PathSid + ".json",
                postParams: options.GetParams()
                ));
 }
Пример #3
0
        /// <summary>
        /// update an instance of payments with different phases of payment flows.
        /// </summary>
        /// <param name="pathCallSid"> The SID of the call that will create the resource. </param>
        /// <param name="pathSid"> The SID of Payments session </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 update the resource </param>
        /// <param name="capture"> Specific payment source information to expect. </param>
        /// <param name="status"> Instruction to complete or cancel the transaction. </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> UpdateAsync(string pathCallSid,
                                                                                      string pathSid,
                                                                                      string idempotencyKey,
                                                                                      Uri statusCallback,
                                                                                      string pathAccountSid = null,
                                                                                      PaymentResource.CaptureEnum capture = null,
                                                                                      PaymentResource.StatusEnum status   = null,
                                                                                      ITwilioRestClient client            = null)
        {
            var options = new UpdatePaymentOptions(pathCallSid, pathSid, idempotencyKey, statusCallback)
            {
                PathAccountSid = pathAccountSid, Capture = capture, Status = status
            };

            return(await UpdateAsync(options, client));
        }
Пример #4
0
        /// <summary>
        /// update an instance of payments with different phases of payment flows.
        /// </summary>
        /// <param name="pathCallSid"> The SID of the call that will create the resource. </param>
        /// <param name="pathSid"> The SID of Payments session </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 update the resource </param>
        /// <param name="capture"> Specific payment source information to expect. </param>
        /// <param name="status"> Instruction to complete or cancel the transaction. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payment </returns>
        public static PaymentResource Update(string pathCallSid,
                                             string pathSid,
                                             string idempotencyKey,
                                             Uri statusCallback,
                                             string pathAccountSid = null,
                                             PaymentResource.CaptureEnum capture = null,
                                             PaymentResource.StatusEnum status   = null,
                                             ITwilioRestClient client            = null)
        {
            var options = new UpdatePaymentOptions(pathCallSid, pathSid, idempotencyKey, statusCallback)
            {
                PathAccountSid = pathAccountSid, Capture = capture, Status = status
            };

            return(Update(options, client));
        }
Пример #5
0
        /// <summary>
        /// update an instance of payments with different phases of payment flows.
        /// </summary>
        /// <param name="options"> Update 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> UpdateAsync(UpdatePaymentOptions options,
                                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }