Details of the refund made against this invoice.
コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: invoicehandler.ashx.cs プロジェクト: tgtamil/SDKs
        /// <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);
        }
コード例 #3
0
ファイル: PayPalInvoiceModel.cs プロジェクト: tgtamil/SDKs
 /**
  	  * Constructor with arguments
  	  */
 public MarkInvoiceAsRefundedRequest(RequestEnvelope requestEnvelope, string invoiceID, OtherPaymentRefundDetailsType refundDetail)
 {
     this.requestEnvelope = requestEnvelope;
     this.invoiceID = invoiceID;
     this.refundDetail = refundDetail;
 }