/// <summary> /// Cancels an invoice. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="cancelNotification">CancelNotification</param> /// <returns></returns> public void Cancel(APIContext apiContext, CancelNotification cancelNotification) { 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 (cancelNotification == null) { throw new ArgumentNullException("cancelNotification cannot be null"); } object[] parameters = new object[] { this.id }; string pattern = "v1/invoicing/invoices/{0}/cancel"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = cancelNotification.ConvertToJson(); PayPalResource.ConfigureAndExecute <object>(apiContext, HttpMethod.POST, resourcePath, payLoad); return; }
/// <summary> /// Cancels an invoice. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="cancelNotification">CancelNotification</param> /// <returns></returns> public void Cancel(APIContext apiContext, CancelNotification cancelNotification) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(this.id, "Id"); ArgumentValidator.Validate(cancelNotification, "cancelNotification"); // Configure and send the request object[] parameters = new object[] { this.id }; string pattern = "v1/invoicing/invoices/{0}/cancel"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = cancelNotification.ConvertToJson(); PayPalResource.ConfigureAndExecute <object>(apiContext, HttpMethod.POST, resourcePath, payLoad); return; }
/// <summary> /// Cancels an invoice. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="cancelNotification">CancelNotification</param> /// <returns></returns> public void Cancel(APIContext apiContext, CancelNotification cancelNotification) { 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 (cancelNotification == null) { throw new ArgumentNullException("cancelNotification cannot be null"); } object[] parameters = new object[] {this.id}; string pattern = "v1/invoicing/invoices/{0}/cancel"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = cancelNotification.ConvertToJson(); PayPalResource.ConfigureAndExecute<object>(apiContext, HttpMethod.POST, resourcePath, payLoad); return; }