-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #363 from ej2/0.9.10
0.9.10
- Loading branch information
Showing
12 changed files
with
286 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,15 +252,23 @@ One example is `include=allowduplicatedocnum` on the Purchase object. You can ad | |
|
||
purchase.save(qb=self.qb_client, params={'include': 'allowduplicatedocnum'}) | ||
|
||
Other operations | ||
Sharable Invoice Link | ||
---------------- | ||
Add Sharable link for an invoice sent to external customers (minorversion must be set to 36 or greater): | ||
To add a sharable link for an invoice, make sure the AllowOnlineCreditCardPayment is set to True and BillEmail is set to a invalid email address: | ||
|
||
invoice.invoice_link = true | ||
invoice.AllowOnlineCreditCardPayment = True | ||
invoice.BillEmail = EmailAddress() | ||
invoice.BillEmail.Address = '[email protected]' | ||
|
||
When you query the invoice include the following params (minorversion must be set to 36 or greater): | ||
|
||
Void an invoice: | ||
invoice = Invoice.get(id, qb=self.qb_client, params={'include': 'invoiceLink'}) | ||
|
||
|
||
Void an invoice | ||
---------------- | ||
Call `void` on any invoice with an Id: | ||
|
||
invoice = Invoice() | ||
invoice.Id = 7 | ||
invoice.void(qb=client) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
intuit-oauth==1.2.4 | ||
intuit-oauth==1.2.6 | ||
requests_oauthlib>=1.3.1 | ||
requests>=2.31.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
from datetime import datetime | ||
|
||
from quickbooks.objects.base import CustomerMemo | ||
from quickbooks.objects.customer import Customer | ||
from quickbooks.objects.detailline import SalesItemLine, SalesItemLineDetail | ||
from quickbooks.objects.invoice import Invoice | ||
from quickbooks.objects.item import Item | ||
from quickbooks.objects.base import EmailAddress | ||
from tests.integration.test_base import QuickbooksTestCase | ||
import uuid | ||
|
||
class InvoiceTest(QuickbooksTestCase): | ||
def create_invoice(self, customer, request_id=None): | ||
invoice = Invoice() | ||
|
||
class InvoiceTest(QuickbooksTestCase): | ||
def create_invoice_line(self): | ||
line = SalesItemLine() | ||
line.LineNum = 1 | ||
line.Description = "description" | ||
|
@@ -18,7 +20,11 @@ def create_invoice(self, customer, request_id=None): | |
item = Item.all(max_results=1, qb=self.qb_client)[0] | ||
|
||
line.SalesItemLineDetail.ItemRef = item.to_ref() | ||
invoice.Line.append(line) | ||
return line | ||
|
||
def create_invoice(self, customer, request_id=None): | ||
invoice = Invoice() | ||
invoice.Line.append(self.create_invoice_line()) | ||
|
||
invoice.CustomerRef = customer.to_ref() | ||
|
||
|
@@ -86,3 +92,34 @@ def test_void(self): | |
self.assertEqual(query_invoice.Balance, 0.0) | ||
self.assertEqual(query_invoice.TotalAmt, 0.0) | ||
self.assertIn('Voided', query_invoice.PrivateNote) | ||
|
||
def test_invoice_link(self): | ||
# Sharable link for the invoice sent to external customers. | ||
# The link is generated only for invoices with online payment enabled and having a valid customer email address. | ||
# Include query param `include=invoiceLink` to get the link back on query response. | ||
|
||
# Create test customer | ||
customer_name = datetime.now().strftime('%d%H%M%S') | ||
customer = Customer() | ||
customer.DisplayName = customer_name | ||
customer.save(qb=self.qb_client) | ||
|
||
# Create an invoice with sharable link flags set | ||
invoice = Invoice() | ||
invoice.CustomerRef = customer.to_ref() | ||
invoice.DueDate = '2024-12-31' | ||
invoice.AllowOnlineCreditCardPayment = True | ||
invoice.AllowOnlineACHPayment = True | ||
invoice.Line.append(self.create_invoice_line()) | ||
|
||
# BillEmail must be set for Sharable link to work! | ||
invoice.BillEmail = EmailAddress() | ||
invoice.BillEmail.Address = '[email protected]' | ||
|
||
invoice.save(qb=self.qb_client) | ||
|
||
# You must add 'include': 'invoiceLink' to the params when doing a query for the invoice | ||
query_invoice = Invoice.get(invoice.Id, qb=self.qb_client, params={'include': 'invoiceLink'}) | ||
|
||
self.assertIsNotNone(query_invoice.InvoiceLink) | ||
self.assertIn('https', query_invoice.InvoiceLink) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters