Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
Merge in master for future payments header and subscription updates
  • Loading branch information
avidas committed Sep 19, 2014
2 parents c92dea0 + 12047b8 commit c07b045
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion paypalrestsdk/payments.py
Expand Up @@ -100,7 +100,7 @@ def search_transactions(self, start_date, end_date, api=None):

# Construct url similar to
# /billing-agreements/I-HT38K76XPMGJ/transactions?start-date=2014-04-13&end-date=2014-04-30
endpoint = util.join_url(self.path, str(self['id']), 'transaction')
endpoint = util.join_url(self.path, str(self['id']), 'transactions')
date_range = [('start-date', start_date), ('end-date', end_date)]
url = util.join_url_params(endpoint, date_range)

Expand Down
2 changes: 1 addition & 1 deletion paypalrestsdk/resource.py
Expand Up @@ -150,7 +150,7 @@ def create(self, refresh_token=None, correlation_id=None):
if correlation_id is not None:
headers = util.merge_dict(
self.http_headers(),
{'Paypal-Application-Correlation-Id': correlation_id}
{'Paypal-Application-Correlation-Id': correlation_id, 'Paypal-Client-Metadata-Id': correlation_id}
)
else:
headers = self.http_headers()
Expand Down
2 changes: 1 addition & 1 deletion paypalrestsdk/version.py
@@ -1 +1 @@
__version__ = "1.4.0"
__version__ = "1.4.1"
5 changes: 5 additions & 0 deletions release_notes.md
@@ -1,6 +1,11 @@
PayPal Python SDK release notes
============================

v1.4.1
-----
* Update Paypal-Client-Metadata-Id header for future payments
* Subscription API changes for searching transactions and listing billing plans

v1.4.0
-----
* Add Orders API support
Expand Down
2 changes: 1 addition & 1 deletion samples/subscription/billing_agreements/create.py
Expand Up @@ -24,6 +24,6 @@
})

if billing_agreement.create():
print("Billing Agreement [%s] created successfully" % (billing_agreement.id))
print("Billing Agreement created successfully")
else:
print(billing_agreement.error)
3 changes: 2 additions & 1 deletion samples/subscription/billing_plans/get_all.py
Expand Up @@ -2,7 +2,8 @@
import logging
logging.basicConfig(level=logging.INFO)

history = BillingPlan.all({"status": "CREATED"})
history = BillingPlan.all({"status": "CREATED", "page_size": 5, "page": 1, "total_required": "yes"})
print(history)

print("List BillingPlan:")
for plan in history.plans:
Expand Down
2 changes: 1 addition & 1 deletion samples/subscription/ppsubscribe/app.py
Expand Up @@ -194,7 +194,7 @@ def admin():
plans_created = []

plans_active_query_dict = BillingPlan.all({"status": "ACTIVE",
"sort_order": "DESC"})
"page_size": 5, "page": 1, "total_required": "yes"})
if plans_active_query_dict:
plans_active = plans_active_query_dict.to_dict().get('plans')
else:
Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/payments_test.py
Expand Up @@ -51,8 +51,8 @@ def test_create_future_payment(self, mock):
mock.assert_called_once_with(
self.payment.api,'v1/payments/payment',
self.payment_attributes,
{'PayPal-Request-Id' : self.payment.request_id, 'Paypal-Application-Correlation-Id' : self.correlation_id},
self.refresh_token
{'PayPal-Request-Id' : self.payment.request_id, 'Paypal-Application-Correlation-Id' : self.correlation_id,
'Paypal-Client-Metadata-Id' : self.correlation_id}, self.refresh_token
)
self.assertEqual(response, True)

Expand Down
2 changes: 1 addition & 1 deletion test/unit_tests/subscriptions_test.py
Expand Up @@ -288,7 +288,7 @@ def test_search_transactions(self, mock):
self.billing_agreement.id = self.billing_agreement_id
transactions = self.billing_agreement.search_transactions(start_date, end_date)
mock.assert_called_once_with(self.billing_agreement.api, 'v1/payments/billing-agreements/' + self.billing_agreement_id
+ '/transaction?start-date=' + start_date + '&end-date=' + end_date)
+ '/transactions?start-date=' + start_date + '&end-date=' + end_date)
self.assertEqual(len(transactions.agreement_transaction_list), 2)

@patch('test_helper.paypal.Api.post', autospec=True)
Expand Down

0 comments on commit c07b045

Please sign in to comment.