/// <summary> /// Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="paymentExecution">PaymentExecution</param> /// <returns>Payment</returns> public Payment Execute(APIContext apiContext, PaymentExecution paymentExecution) { if (apiContext == null) { throw new ArgumentNullException("APIContext cannot be null"); } if (string.IsNullOrEmpty(apiContext.AccessToken)) { throw new ArgumentNullException("AccessToken cannot be null or empty"); } if (apiContext.HTTPHeaders == null) { apiContext.HTTPHeaders = new Dictionary <string, string>(); } apiContext.HTTPHeaders.Add(BaseConstants.ContentTypeHeader, BaseConstants.ContentTypeHeaderJson); apiContext.SdkVersion = new SDKVersionImpl(); if (this.id == null) { throw new ArgumentNullException("Id cannot be null"); } if (paymentExecution == null) { throw new ArgumentNullException("paymentExecution cannot be null"); } object[] parameters = new object[] { this.id }; string pattern = "v1/payments/payment/{0}/execute"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = paymentExecution.ConvertToJson(); return(PayPalResource.ConfigureAndExecute <Payment>(apiContext, HttpMethod.POST, resourcePath, payLoad)); }
/// <summary> /// Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="paymentExecution">PaymentExecution</param> /// <returns>Payment</returns> public Payment Execute(APIContext apiContext, PaymentExecution paymentExecution) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(this.id, "Id"); ArgumentValidator.Validate(paymentExecution, "paymentExecution"); // Configure and send the request object[] parameters = new object[] { this.id }; string pattern = "v1/payments/payment/{0}/execute"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = paymentExecution.ConvertToJson(); return(PayPalResource.ConfigureAndExecute <Payment>(apiContext, HttpMethod.POST, resourcePath, payLoad)); }
/// <summary> /// Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal. /// </summary> public Payment Execute(APIContext apiContext, PaymentExecution paymentExecution) { if (string.IsNullOrEmpty(apiContext.AccessToken)) { throw new ArgumentNullException("AccessToken cannot be null or empty"); } if (this.id == null) { throw new ArgumentNullException("Id cannot be null"); } if (paymentExecution == null) { throw new ArgumentNullException("paymentExecution cannot be null"); } object[] parameters = new object[] { this.id }; string pattern = "v1/payments/payment/{0}/execute"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = paymentExecution.ConvertToJson(); return(PayPalResource.ConfigureAndExecute <Payment>(apiContext, HttpMethod.POST, resourcePath, payLoad)); }
/// <summary> /// Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal. /// </summary> public Payment Execute(APIContext apiContext, PaymentExecution paymentExecution) { if (string.IsNullOrEmpty(apiContext.AccessToken)) { throw new ArgumentNullException("AccessToken cannot be null or empty"); } if (this.id == null) { throw new ArgumentNullException("Id cannot be null"); } if (paymentExecution == null) { throw new ArgumentNullException("paymentExecution cannot be null"); } object[] parameters = new object[] {this.id}; string pattern = "v1/payments/payment/{0}/execute"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = paymentExecution.ConvertToJson(); return PayPalResource.ConfigureAndExecute<Payment>(apiContext, HttpMethod.POST, resourcePath, payLoad); }
/// <summary> /// Executes the payment (after approved by the Payer) associated with this resource when the payment method is PayPal. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="paymentExecution">PaymentExecution</param> /// <returns>Payment</returns> public Payment Execute(APIContext apiContext, PaymentExecution paymentExecution) { if (apiContext == null) { throw new ArgumentNullException("APIContext cannot be null"); } if (string.IsNullOrEmpty(apiContext.AccessToken)) { throw new ArgumentNullException("AccessToken cannot be null or empty"); } if (apiContext.HTTPHeaders == null) { apiContext.HTTPHeaders = new Dictionary<string, string>(); } apiContext.HTTPHeaders.Add(BaseConstants.ContentTypeHeader, BaseConstants.ContentTypeHeaderJson); apiContext.SdkVersion = new SDKVersionImpl(); if (this.id == null) { throw new ArgumentNullException("Id cannot be null"); } if (paymentExecution == null) { throw new ArgumentNullException("paymentExecution cannot be null"); } object[] parameters = new object[] {this.id}; string pattern = "v1/payments/payment/{0}/execute"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = paymentExecution.ConvertToJson(); return PayPalResource.ConfigureAndExecute<Payment>(apiContext, HttpMethod.POST, resourcePath, payLoad); }
/// <summary> /// Execute call for Payment. /// POST /v1/payments/payment/:paymentId/execute /// </summary> /// <param name="apiContext">APIContext used for the API call</param> /// <param name="paymentExecution">PaymentExecution</param> /// <returns>Returns Payment object</returns> public Payment Execute(APIContext apiContext, PaymentExecution paymentExecution) { if (paymentExecution == null) { throw new System.ArgumentNullException("paymentExecution cannot be null"); } if (this.id == null) { throw new System.ArgumentNullException("Id cannot be null"); } string pattern = "v1/payments/payment/{0}/execute"; object[] container = new Object[] { this.id }; string resourcePath = SDKUtil.FormatURIPath(pattern, container); string payLoad = paymentExecution.ConvertToJson(); return PayPalResource.ConfigureAndExecute<Payment>(apiContext, HttpMethod.POST, resourcePath, payLoad); }