示例#1
0
        /// <summary>
        /// Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.
        /// </summary>
        /// <param name="apiContext">APIContext used for the API call.</param>
        /// <param name="agreementStateDescriptor">AgreementStateDescriptor</param>
        /// <returns></returns>
        public void BillBalance(APIContext apiContext, AgreementStateDescriptor agreementStateDescriptor)
        {
            // Validate the arguments to be used in the request
            ArgumentValidator.ValidateAndSetupAPIContext(apiContext);
            ArgumentValidator.Validate(this.id, "Id");
            ArgumentValidator.Validate(agreementStateDescriptor, "agreementStateDescriptor");

            // Configure and send the request
            object[] parameters   = new object[] { this.id };
            string   pattern      = "v1/payments/billing-agreements/{0}/bill-balance";
            string   resourcePath = SDKUtil.FormatURIPath(pattern, parameters);
            string   payLoad      = agreementStateDescriptor.ConvertToJson();

            PayPalResource.ConfigureAndExecute <object>(apiContext, HttpMethod.POST, resourcePath, payLoad);
            return;
        }