Exemplo n.º 1
0
		/// <summary>
		/// Mark the status of the invoice as paid.
		/// </summary>
		/// <param name="apiContext">APIContext used for the API call.</param>
		/// <param name="paymentDetail">PaymentDetail</param>
		/// <returns></returns>
		public void RecordPayment(APIContext apiContext, PaymentDetail paymentDetail)
		{
			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 (paymentDetail == null)
			{
				throw new ArgumentNullException("paymentDetail cannot be null");
			}
			object[] parameters = new object[] {this.id};
			string pattern = "v1/invoicing/invoices/{0}/record-payment";
			string resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
			string payLoad = paymentDetail.ConvertToJson();
			PayPalResource.ConfigureAndExecute<object>(apiContext, HttpMethod.POST, resourcePath, payLoad);
			return;
		}
Exemplo n.º 2
0
		/// <summary>
		/// Mark the status of the invoice as paid.
		/// </summary>
		/// <param name="accessToken">Access Token used for the API call.</param>
		/// <param name="paymentDetail">PaymentDetail</param>
		/// <returns></returns>
		public void RecordPayment(string accessToken, PaymentDetail paymentDetail)
		{
			APIContext apiContext = new APIContext(accessToken);
			RecordPayment(apiContext, paymentDetail);
			return;
		}