/** * */ public CreateInvoiceResponse CreateInvoice(CreateInvoiceRequest CreateInvoiceRequest, string apiUsername) { string resp = call("CreateInvoice", CreateInvoiceRequest.toNVPString(""), apiUsername); NVPUtil util = new NVPUtil(); return new CreateInvoiceResponse(util.parseNVPString(resp), ""); }
public void createInvoiceRequestSerialization() { CreateInvoiceRequest cir = new CreateInvoiceRequest(); cir.invoice = this.invoice; cir.requestEnvelope = new RequestEnvelope("en_US"); string expectedNVPString = "requestEnvelope.errorLanguage=en_US&invoice.merchantEmail=jb-us-seller1%40paypal.com&invoice.payerEmail=jbui-us-personal1%40paypal.com&invoice.number=FD-123-5421&" + "invoice.currencyCode=USD&invoice.invoiceDate=2011-10-04T00%3a00%3a00&invoice.dueDate=2011-11-04T00%3a00%3a00&invoice.paymentTerms=Net45&invoice.discountPercent=5&" + "invoice.discountAmount=10.0&invoice.terms=Payment+terms&invoice.note=Note+about+invoice&invoice.merchantMemo=memo&" + "invoice.billingInfo.firstName=Bonzop&invoice.billingInfo.lastName=Zaius&invoice.billingInfo.businessName=Bonzop+Inc&invoice.billingInfo.phone=5126914160&invoice.billingInfo.fax=5126914161&invoice.billingInfo.website=www.bonzop-inc.com&invoice.billingInfo.customValue=Business+mumbo+jumbo+%c2%a9&" + "invoice.shippingAmount=2.1&invoice.shippingTaxName=Bonzop+Inc&invoice.shippingTaxRate=1.2&"; Assert.AreEqual(expectedNVPString, cir.toNVPString("")); cir = new CreateInvoiceRequest(new RequestEnvelope("en_US"), invoice); Assert.AreEqual(expectedNVPString, cir.toNVPString("")); }