示例#1
0
        /// <summary>
        /// Mark the status of the invoice as refunded.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="refundDetail">RefundDetail</param>
        /// <returns></returns>
        public void RecordRefund(APIContext apiContext, RefundDetail refundDetail)
        {
            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 (refundDetail == null)
            {
                throw new ArgumentNullException("refundDetail cannot be null");
            }
            object[] parameters   = new object[] { this.id };
            string   pattern      = "v1/invoicing/invoices/{0}/record-refund";
            string   resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
            string   payLoad      = refundDetail.ConvertToJson();

            PayPalResource.ConfigureAndExecute <object>(apiContext, HttpMethod.POST, resourcePath, payLoad);
            return;
        }
示例#2
0
        /// <summary>
        /// Mark the status of the invoice as refunded.
        /// </summary>
        /// <param name="accessToken">Access Token used for the API call.</param>
        /// <param name="refundDetail">RefundDetail</param>
        /// <returns></returns>
        public void RecordRefund(string accessToken, RefundDetail refundDetail)
        {
            APIContext apiContext = new APIContext(accessToken);

            RecordRefund(apiContext, refundDetail);
            return;
        }
示例#3
0
        /// <summary>
        /// Mark the status of the invoice as refunded.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="refundDetail">RefundDetail</param>
        /// <returns></returns>
        public void RecordRefund(APIContext apiContext, RefundDetail refundDetail)
        {
            // Validate the arguments to be used in the request
            ArgumentValidator.ValidateAndSetupAPIContext(apiContext);
            ArgumentValidator.Validate(this.id, "Id");
            ArgumentValidator.Validate(refundDetail, "refundDetail");

            // Configure and send the request
            object[] parameters   = new object[] { this.id };
            string   pattern      = "v1/invoicing/invoices/{0}/record-refund";
            string   resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
            string   payLoad      = refundDetail.ConvertToJson();

            PayPalResource.ConfigureAndExecute <object>(apiContext, HttpMethod.POST, resourcePath, payLoad);
            return;
        }
示例#4
0
		/// <summary>
		/// Mark the status of the invoice as refunded.
		/// </summary>
		/// <param name="apiContext">APIContext used for the API call.</param>
		/// <param name="refundDetail">RefundDetail</param>
		/// <returns></returns>
		public void RecordRefund(APIContext apiContext, RefundDetail refundDetail)
		{
			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 (refundDetail == null)
			{
				throw new ArgumentNullException("refundDetail cannot be null");
			}
			object[] parameters = new object[] {this.id};
			string pattern = "v1/invoicing/invoices/{0}/record-refund";
			string resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
			string payLoad = refundDetail.ConvertToJson();
			PayPalResource.ConfigureAndExecute<object>(apiContext, HttpMethod.POST, resourcePath, payLoad);
			return;
		}
示例#5
0
		/// <summary>
		/// Mark the status of the invoice as refunded.
		/// </summary>
		/// <param name="accessToken">Access Token used for the API call.</param>
		/// <param name="refundDetail">RefundDetail</param>
		/// <returns></returns>
		public void RecordRefund(string accessToken, RefundDetail refundDetail)
		{
			APIContext apiContext = new APIContext(accessToken);
			RecordRefund(apiContext, refundDetail);
			return;
		}