The request object for MarkInvoiceAsPaid.
        /// <summary>
        /// 
        /// </summary>
        ///<param name="markInvoiceAsPaidRequest"></param>
        ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
        public MarkInvoiceAsPaidResponse MarkInvoiceAsPaid(MarkInvoiceAsPaidRequest markInvoiceAsPaidRequest, ICredential credential)
        {
            IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, markInvoiceAsPaidRequest.ToNVPString(string.Empty), ServiceName, "MarkInvoiceAsPaid", credential);
               	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
            ((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
            ((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "Invoice";

            NVPUtil util = new NVPUtil();
            return MarkInvoiceAsPaidResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
        }
Exemple #2
0
        /// <summary>
        /// API call example for MarkInvoiceAsPaid
        /// </summary>
        /// <param name="context"></param>
        private void MarkInvoiceAsPaid(HttpContext context)
        {
            // Collect input params
            String invoiceId = context.Request.Params["invoiceId"];
            String note = context.Request.Params["note"];
            String paymentDate = context.Request.Params["paymentDate"];
            String paymentMethod = context.Request.Params["paymentMethod"];

            OtherPaymentDetailsType paymentDetails = new OtherPaymentDetailsType();
            if (note != "")
            {
                paymentDetails.note = note;
            }
            if (paymentDate != "")
            {
                paymentDetails.date = paymentDate;
            }
            if(paymentMethod != "")
            {
                paymentDetails.method =
                    (PaymentMethodsType) Enum.Parse(typeof(PaymentMethodsType), paymentMethod);
            }
            MarkInvoiceAsPaidRequest request =
                new MarkInvoiceAsPaidRequest(new RequestEnvelope(ERROR_LANGUAGE), invoiceId, paymentDetails);

            // Create service object and make the API call

            MarkInvoiceAsPaidResponse response;
            InvoiceService service;
            try
            {
                service = getService(context);
                response = service.MarkInvoiceAsPaid(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, "MarkInvoiceAsPaid", keyResponseParams, service.getLastRequest(),
                service.getLastResponse(), response.error, null);
        }
Exemple #3
0
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsPaidResponse MarkInvoiceAsPaid(MarkInvoiceAsPaidRequest MarkInvoiceAsPaidRequest)
 {
     return MarkInvoiceAsPaid(MarkInvoiceAsPaidRequest, null);
 }
 /// <summary> 
 /// 
 /// </summary>
 ///<param name="markInvoiceAsPaidRequest"></param>
 public MarkInvoiceAsPaidResponse MarkInvoiceAsPaid(MarkInvoiceAsPaidRequest markInvoiceAsPaidRequest)
 {
     return MarkInvoiceAsPaid(markInvoiceAsPaidRequest,(string) null);
 }
Exemple #5
0
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsPaidResponse MarkInvoiceAsPaid(MarkInvoiceAsPaidRequest MarkInvoiceAsPaidRequest, string apiUsername)
 {
     string resp = call("MarkInvoiceAsPaid", MarkInvoiceAsPaidRequest.toNVPString(""), apiUsername);
     NVPUtil util = new NVPUtil();
     return new MarkInvoiceAsPaidResponse(util.parseNVPString(resp), "");
 }
        /// <summary>
        /// API call example for MarkInvoiceAsPaid
        /// </summary>
        /// <param name="context"></param>
        private void MarkInvoiceAsPaid(HttpContext context)
        {
            // Collect input params
            // (Required) ID of the invoice to mark as paid.
            string invoiceId = context.Request.Params["invoiceId"];

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

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

            //(Optional) Method that can be used to mark an invoice as paid when the payer pays offline.
            // It is one of the following values:
            //BankTransfer – Payment is made by a bank transfer.
            //Cash – Payment is made in cash.
            //Check – Payment is made by check.
            //CreditCard – Payment is made by a credit card.
            //DebitCard – Payment is made by a debit card.
            //Other – Payment is made by a method not specified in this list.
            //PayPal – Payment is made by PayPal.
            //WireTransfer – Payment is made by a wire transfer.
            string paymentMethod = context.Request.Params["paymentMethod"];

            InvoiceModelAlias.OtherPaymentDetailsType paymentDetails = new InvoiceModelAlias.OtherPaymentDetailsType();
            if (note != string.Empty)
            {
                paymentDetails.note = note;
            }
            if (paymentDate != string.Empty)
            {
                paymentDetails.date = paymentDate;
            }
            if (paymentMethod != string.Empty)
            {
                paymentDetails.method =
                    (InvoiceModelAlias.PaymentMethodsType)Enum.Parse(typeof(InvoiceModelAlias.PaymentMethodsType), paymentMethod);
            }
            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.MarkInvoiceAsPaidRequest request =
                new InvoiceModelAlias.MarkInvoiceAsPaidRequest(env, invoiceId, paymentDetails);

            // Create service object and make the API call

            InvoiceModelAlias.MarkInvoiceAsPaidResponse response;
            InvoiceAlias.InvoiceService service;
            SignatureCredential cred = SetThirdPartyAuthorization(context);
            try
            {
                service = GetService(context);
                if (cred != null)
                {
                    response = service.MarkInvoiceAsPaid(request, cred);
                }
                else
                {
                    response = service.MarkInvoiceAsPaid(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);

            //  ID of the invoice marked as paid.
            keyResponseParams.Add("invoiceId", response.invoiceID);

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

            // URL location where merchants view the invoice details.
            keyResponseParams.Add("invoiceUrl", response.invoiceURL);
            displayResponse(context, "MarkInvoiceAsPaid", keyResponseParams, service.getLastRequest(),
                service.getLastResponse(), response.error, null);
        }
Exemple #7
0
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsPaidResponse MarkInvoiceAsPaid(MarkInvoiceAsPaidRequest markInvoiceAsPaidRequest, string apiUserName)
 {
     string response = Call("MarkInvoiceAsPaid", markInvoiceAsPaidRequest.ToNVPString(""), apiUserName);
     NVPUtil util = new NVPUtil();
     return MarkInvoiceAsPaidResponse.CreateInstance(util.ParseNVPString(response), "", -1);
 }
Exemple #8
0
        /// <summary>
        /// API call example for MarkInvoiceAsPaid
        /// </summary>
        /// <param name="context"></param>
        private void MarkInvoiceAsPaid(HttpContext context)
        {
            // Collect input params
            String invoiceId = context.Request.Params["invoiceId"];
            String note = context.Request.Params["note"];
            String paymentDate = context.Request.Params["paymentDate"];
            String paymentMethod = context.Request.Params["paymentMethod"];

            OtherPaymentDetailsType paymentDetails = new OtherPaymentDetailsType();
            if (note != "")
            {
                paymentDetails.note = note;
            }
            if (paymentDate != "")
            {
                paymentDetails.date = paymentDate;
            }
            if(paymentMethod != "")
            {
                paymentDetails.method =
                    (PaymentMethodsType) Enum.Parse(typeof(PaymentMethodsType), paymentMethod);
            }
            MarkInvoiceAsPaidRequest request =
                new MarkInvoiceAsPaidRequest(new RequestEnvelope(ERROR_LANGUAGE), invoiceId, paymentDetails);

            // Create service object and make the API call
            InvoiceService service = getService(context);
            MarkInvoiceAsPaidResponse response = service.MarkInvoiceAsPaid(request);

            // Process response
            context.Response.Write("<html><body><textarea rows=30 cols=80>");
            ObjectDumper.Write(response, 5, context.Response.Output);
            context.Response.Write("</textarea></body></html>");
        }
 /**
   *AUTO_GENERATED
  	  */
 public MarkInvoiceAsPaidResponse MarkInvoiceAsPaid(MarkInvoiceAsPaidRequest markInvoiceAsPaidRequest, string apiUserName)
 {
     IAPICallPreHandler apiCallPreHandler = null;
     apiCallPreHandler = new PlatformAPICallPreHandler(markInvoiceAsPaidRequest.ToNVPString(string.Empty), ServiceName, "MarkInvoiceAsPaid", apiUserName, getAccessToken(), getAccessTokenSecret());
        	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
     ((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
     string response = Call(apiCallPreHandler);
     NVPUtil util = new NVPUtil();
     return MarkInvoiceAsPaidResponse.CreateInstance(util.ParseNVPString(response), string.Empty, -1);
 }