diff --git a/recurly/__init__.py b/recurly/__init__.py
index 09af9c3b..520810f6 100644
--- a/recurly/__init__.py
+++ b/recurly/__init__.py
@@ -44,7 +44,7 @@
API_KEY = None
"""The API key to use when authenticating API requests."""
-API_VERSION = '2.11'
+API_VERSION = '2.12'
"""The API version to use when making API requests."""
CA_CERTS_FILE = None
@@ -916,6 +916,17 @@ def authorize(self):
"""
return self.__invoice(self.collection_path + '/authorize')
+ def pending(self):
+ """
+ Use for Adyen HPP transaction requests. Runs validations
+ but does not run any transactions.
+
+ Returns:
+ InvoiceCollection: The authorized collection of invoices
+ """
+ url = recurly.base_uri() + self.collection_path + '/pending'
+ return self.__invoice(url)
+
def __invoice(self, url):
# We must null out currency in subscriptions and adjustments
# TODO we should deprecate and remove default currency support
diff --git a/tests/fixtures/purchase/pending.xml b/tests/fixtures/purchase/pending.xml
new file mode 100644
index 00000000..681963d0
--- /dev/null
+++ b/tests/fixtures/purchase/pending.xml
@@ -0,0 +1,166 @@
+POST https://api.recurly.com/v2/purchases/pending HTTP/1.1
+X-Api-Version: {api-version}
+Accept: application/xml
+Authorization: Basic YXBpa2V5Og==
+User-Agent: {user-agent}
+Content-Type: application/xml; charset=utf-8
+
+
+
+
+ testmock
+ benjamin.dumonde@example.com
+
+
+ 123 Main St
+ New Orleans
+ US
+ Verena
+ Example
+ Work
+ LA
+ 70114
+
+
+
+ Verena
+ Example
+ 4111-1111-1111-1111
+ 123
+ 2020
+ 11
+ 123 Main St
+ New Orleans
+ LA
+ 70114
+ US
+ USD
+ adyen
+
+
+
+
+ Item 1
+ 1
+ 1000
+
+
+ Item 2
+ 2
+ 2000
+
+
+ USD
+
+
+ gold
+
+
+
+
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+Location: https://api.recurly.com/v2/invoices/1021
+
+
+
+
+
+
+ 123 Main St
+
+ New Orleans
+ LA
+ 70114
+ US
+
+
+ 40625fd700c1c2d90060744092b4a1b1
+ pending
+
+
+
+
+ 6000
+ 0
+ 6000
+ 6000
+ USD
+
+
+ 2017-10-06T21:25:55Z
+
+
+
+
+ 0
+ automatic
+
+
+
+ 40625fd6fc46181e2f15044db38c1c82
+ pending
+ gold
+
+ gold
+ plan
+ 1000
+ 1
+ 0
+ 0
+ 1000
+ USD
+ false
+ 2017-10-06T21:25:55Z
+ 2017-11-06T21:25:55Z
+
+
+ evenly
+
+
+
+ 40625fd6e6a5817b59a2174b72a92fea
+ pending
+ Item 1
+
+
+ debit
+ 1000
+ 1
+ 0
+ 0
+ 1000
+ USD
+ false
+ 2017-10-06T21:25:55Z
+
+
+
+
+
+
+
+ 40625fd6e9096c9922b52646e29f6d5e
+ pending
+ Item 2
+
+
+ debit
+ 2000
+ 2
+ 0
+ 0
+ 4000
+ USD
+ false
+ 2017-10-06T21:25:55Z
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/test_resources.py b/tests/test_resources.py
index 2f942e07..42c05bc6 100644
--- a/tests/test_resources.py
+++ b/tests/test_resources.py
@@ -121,6 +121,12 @@ def test_purchase(self):
collection = purchase.authorize()
self.assertIsInstance(collection, InvoiceCollection)
self.assertIsInstance(collection.charge_invoice, Invoice)
+ with self.mock_request('purchase/pending.xml'):
+ purchase.account.email = 'benjamin.dumonde@example.com'
+ purchase.account.billing_info.external_hpp_type = 'adyen'
+ collection = purchase.pending()
+ self.assertIsInstance(collection, InvoiceCollection)
+ self.assertIsInstance(collection.charge_invoice, Invoice)
def test_account(self):
account_code = 'test%s' % self.test_id