The request object for MarkInvoiceAsRefunded.
Beispiel #1
0
        /// <summary>
        /// API call example for MarkInvoiceAsRefunded
        /// </summary>
        /// <param name="context"></param>
        private void MarkInvoiceAsRefunded(HttpContext context)
        {
            // Collect input params
            String invoiceId = context.Request.Params["invoiceId"];
            String refundNote = context.Request.Params["refundNote"];
            String refundDate = context.Request.Params["refundDate"];

            OtherPaymentRefundDetailsType refundDetails = new OtherPaymentRefundDetailsType();
            if (refundNote != "")
                refundDetails.note = refundNote;
            if (refundDate != "")
                refundDetails.date = refundDate;

            MarkInvoiceAsRefundedRequest request =
                new MarkInvoiceAsRefundedRequest(new RequestEnvelope(ERROR_LANGUAGE), invoiceId, refundDetails);

            // Create service object and make the API call
            InvoiceService service;
            MarkInvoiceAsRefundedResponse response;

            try
            {
                service = getService(context);
                response = service.MarkInvoiceAsRefunded(request);
            }
            catch (Exception e)
            {
                context.Response.Write(e.Message);
                return;
            }

            // Display response values.
            Dictionary<string, string> keyResponseParams = new Dictionary<string, string>();
            keyResponseParams.Add("API status", response.responseEnvelope.ack.ToString());
            keyResponseParams.Add("correlationId", response.responseEnvelope.correlationId);
            keyResponseParams.Add("invoiceId", response.invoiceID);
            keyResponseParams.Add("invoiceNumber", response.invoiceNumber);
            keyResponseParams.Add("invoiceUrl", response.invoiceURL);
            displayResponse(context, "MarkInvoiceAsRefunded", keyResponseParams, service.getLastRequest(),
                service.getLastResponse(), response.error, null);
        }
 /// <summary> 
 /// 
 /// </summary>
 ///<param name="markInvoiceAsRefundedRequest"></param>
 public MarkInvoiceAsRefundedResponse MarkInvoiceAsRefunded(MarkInvoiceAsRefundedRequest markInvoiceAsRefundedRequest)
 {
     return MarkInvoiceAsRefunded(markInvoiceAsRefundedRequest,(string) null);
 }
        /// <summary>
        /// 
        /// </summary>
        ///<param name="markInvoiceAsRefundedRequest"></param>
        ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
        public MarkInvoiceAsRefundedResponse MarkInvoiceAsRefunded(MarkInvoiceAsRefundedRequest markInvoiceAsRefundedRequest, ICredential credential)
        {
            IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, markInvoiceAsRefundedRequest.ToNVPString(string.Empty), ServiceName, "MarkInvoiceAsRefunded", credential);
               	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
            ((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
            ((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "Invoice";

            NVPUtil util = new NVPUtil();
            return MarkInvoiceAsRefundedResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
        }
Beispiel #4
0
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsRefundedResponse MarkInvoiceAsRefunded(MarkInvoiceAsRefundedRequest MarkInvoiceAsRefundedRequest)
 {
     return MarkInvoiceAsRefunded(MarkInvoiceAsRefundedRequest, null);
 }
Beispiel #5
0
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsRefundedResponse MarkInvoiceAsRefunded(MarkInvoiceAsRefundedRequest MarkInvoiceAsRefundedRequest, string apiUsername)
 {
     string resp = call("MarkInvoiceAsRefunded", MarkInvoiceAsRefundedRequest.toNVPString(""), apiUsername);
     NVPUtil util = new NVPUtil();
     return new MarkInvoiceAsRefundedResponse(util.parseNVPString(resp), "");
 }
        /// <summary>
        /// API call example for MarkInvoiceAsRefunded
        /// </summary>
        /// <param name="context"></param>
        private void MarkInvoiceAsRefunded(HttpContext context)
        {
            // Collect input params

            // (Required) ID of the invoice to mark as refunded.
            string invoiceId = context.Request.Params["invoiceId"];

            //  Optional note associated with the payment.
            string refundNote = context.Request.Params["refundNote"];

            //(Required) Date when the invoice was paid
            string refundDate = context.Request.Params["refundDate"];

            InvoiceModelAlias.OtherPaymentRefundDetailsType refundDetails = new InvoiceModelAlias.OtherPaymentRefundDetailsType();
            if (refundNote != string.Empty)
                refundDetails.note = refundNote;
            if (refundDate != string.Empty)
                refundDetails.date = refundDate;

            InvoiceModelAlias.RequestEnvelope env = new InvoiceModelAlias.RequestEnvelope();

            // (Required) RFC 3066 language in which error messages are returned;
            // by default it is en_US, which is the only language currently supported.
            env.errorLanguage = ERROR_LANGUAGE;
            InvoiceModelAlias.MarkInvoiceAsRefundedRequest request =
                new InvoiceModelAlias.MarkInvoiceAsRefundedRequest(env, invoiceId, refundDetails);

            // Create service object and make the API call
            InvoiceAlias.InvoiceService service;
            InvoiceModelAlias.MarkInvoiceAsRefundedResponse response;
            SignatureCredential cred = SetThirdPartyAuthorization(context);
            try
            {
                service = GetService(context);
                if (cred != null)
                {
                    response = service.MarkInvoiceAsRefunded(request, cred);
                }
                else
                {
                    response = service.MarkInvoiceAsRefunded(request);
                }
            }
            catch (Exception e)
            {
                context.Response.Write(e.Message);
                return;
            }

            // Display response values.
            Dictionary<string, string> keyResponseParams = new Dictionary<string, string>();

            //Acknowledgement code. It is one of the following values:
            //Success – The operation completed successfully.
            //Failure – The operation failed.
            //SuccessWithWarning – The operation completed successfully; however, there is a warning message.
            //FailureWithWarning – The operation failed with a warning message.
            keyResponseParams.Add("API status", response.responseEnvelope.ack.ToString());

            // Correlation identifier. It is a 13-character,
            // alphanumeric string (for example, db87c705a910e) that is used
            // only by PayPal Merchant Technical Support.
            // Note: You must log and store this data for every response you receive.
            // PayPal Technical Support uses the information to assist with reported issues.
            keyResponseParams.Add("correlationId", response.responseEnvelope.correlationId);

            // (Required) ID of the invoice to mark as refunded.
            keyResponseParams.Add("invoiceId", response.invoiceID);

            //  Number of the invoice marked as refunded.
            keyResponseParams.Add("invoiceNumber", response.invoiceNumber);

            // The URL of the details page of the invoice that was marked as refunded.
            keyResponseParams.Add("invoiceUrl", response.invoiceURL);
            displayResponse(context, "MarkInvoiceAsRefunded", keyResponseParams, service.getLastRequest(),
                service.getLastResponse(), response.error, null);
        }
Beispiel #7
0
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsRefundedResponse MarkInvoiceAsRefunded(MarkInvoiceAsRefundedRequest markInvoiceAsRefundedRequest, string apiUserName)
 {
     string response = Call("MarkInvoiceAsRefunded", markInvoiceAsRefundedRequest.ToNVPString(""), apiUserName);
     NVPUtil util = new NVPUtil();
     return MarkInvoiceAsRefundedResponse.CreateInstance(util.ParseNVPString(response), "", -1);
 }
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsRefundedResponse MarkInvoiceAsRefunded(MarkInvoiceAsRefundedRequest markInvoiceAsRefundedRequest, string apiUserName)
 {
     IAPICallPreHandler apiCallPreHandler = null;
     apiCallPreHandler = new PlatformAPICallPreHandler(markInvoiceAsRefundedRequest.ToNVPString(string.Empty), ServiceName, "MarkInvoiceAsRefunded", apiUserName, getAccessToken(), getAccessTokenSecret());
        	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
     ((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
     string response = Call(apiCallPreHandler);
     NVPUtil util = new NVPUtil();
     return MarkInvoiceAsRefundedResponse.CreateInstance(util.ParseNVPString(response), string.Empty, -1);
 }