From b8e0d9447ae50c684597c9e514993819f03083df Mon Sep 17 00:00:00 2001 From: Thomas Vavrys Date: Wed, 16 Sep 2015 20:03:56 +0200 Subject: [PATCH 1/7] Add python2.x compatibility --- pay_with_amazon/client.py | 2 +- pay_with_amazon/login_with_amazon.py | 2 +- pay_with_amazon/payment_request.py | 7 +++++-- pay_with_amazon/payment_response.py | 2 +- setup.py | 4 +++- tests/test_ipn.py | 7 +++++++ tests/test_lwa.py | 7 +++++-- tests/test_pwa.py | 2 +- 8 files changed, 24 insertions(+), 9 deletions(-) diff --git a/pay_with_amazon/client.py b/pay_with_amazon/client.py index 6063aa4..66f447f 100644 --- a/pay_with_amazon/client.py +++ b/pay_with_amazon/client.py @@ -6,7 +6,7 @@ from pay_with_amazon.payment_request import PaymentRequest -class PayWithAmazonClient: +class PayWithAmazonClient(object): """This client allows you to make all the necessary API calls to integrate with Login and Pay with Amazon. diff --git a/pay_with_amazon/login_with_amazon.py b/pay_with_amazon/login_with_amazon.py index 4eaa6e1..84227a7 100644 --- a/pay_with_amazon/login_with_amazon.py +++ b/pay_with_amazon/login_with_amazon.py @@ -2,7 +2,7 @@ import pay_with_amazon.lwa_region as lwa_region -class LoginWithAmazon: +class LoginWithAmazon(object): """Login with Amazon class to wrap the get login profile method""" diff --git a/pay_with_amazon/payment_request.py b/pay_with_amazon/payment_request.py index ef95f0c..aa7669b 100644 --- a/pay_with_amazon/payment_request.py +++ b/pay_with_amazon/payment_request.py @@ -1,3 +1,6 @@ +from future.standard_library import install_aliases +install_aliases() + import hmac import time import base64 @@ -9,7 +12,7 @@ from pay_with_amazon.payment_response import PaymentResponse, PaymentErrorResponse -class PaymentRequest: +class PaymentRequest(object): """Parses request, generates signature and parameter string, posts request to Amazon, and returns result. @@ -102,7 +105,7 @@ def _querystring(self, params): parameters['Signature'] = self._sign(string_to_sign) ordered_parameters = OrderedDict(sorted(parameters.items())) - ordered_parameters.move_to_end('Signature') + ordered_parameters['Signature'] = ordered_parameters.pop('Signature') return parse.urlencode(ordered_parameters).encode(encoding='utf_8') def _request(self, retry_time): diff --git a/pay_with_amazon/payment_response.py b/pay_with_amazon/payment_response.py index a34af51..6ddf724 100644 --- a/pay_with_amazon/payment_response.py +++ b/pay_with_amazon/payment_response.py @@ -4,7 +4,7 @@ from collections import defaultdict -class PaymentResponse: +class PaymentResponse(object): """Base class for all OffAmazonPayments responses diff --git a/setup.py b/setup.py index 6a71a83..8a7d45c 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,9 @@ author_email='pay-with-amazon-sdk@amazon.com', license='Apache License version 2.0, January 2004', install_requires=['pyOpenSSL >= 0.11', - 'requests >= 2.6.0'], + 'requests >= 2.6.0', + 'mock', + 'future'], keywords=['Amazon', 'Payments', 'Login', 'Python', 'API', 'SDK'], classifiers=[ 'Development Status :: 5 - Production/Stable', diff --git a/tests/test_ipn.py b/tests/test_ipn.py index 90d5f72..3cb16aa 100644 --- a/tests/test_ipn.py +++ b/tests/test_ipn.py @@ -1,3 +1,6 @@ +from future.standard_library import install_aliases +install_aliases() + import os import unittest from pay_with_amazon.ipn_handler import IpnHandler @@ -68,3 +71,7 @@ def test_validate_signature(self): headers=self.headers) ipn_handler._pem = self.pem ipn_handler._validate_signature() + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_lwa.py b/tests/test_lwa.py index 7b574d1..ec2a952 100644 --- a/tests/test_lwa.py +++ b/tests/test_lwa.py @@ -1,5 +1,5 @@ import unittest -from unittest.mock import Mock, patch +from mock import Mock, patch from pay_with_amazon.login_with_amazon import LoginWithAmazon @@ -50,8 +50,11 @@ def test_get_login_profile_success(self, mock_urlopen): mock_urlopen.side_effect = self.mock_get_success res = self.lwa_client.get_login_profile( access_token='access_token') - print(res) def test_invalid_region(self): with self.assertRaises(KeyError): LoginWithAmazon(client_id='test', region='xx', sandbox=True) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_pwa.py b/tests/test_pwa.py index 554e5fc..03a9e73 100644 --- a/tests/test_pwa.py +++ b/tests/test_pwa.py @@ -3,7 +3,7 @@ import json import unittest import xml.etree.ElementTree as et -from unittest.mock import Mock, patch +from mock import Mock, patch from pay_with_amazon.client import PayWithAmazonClient from pay_with_amazon.payment_request import PaymentRequest from pay_with_amazon.payment_response import PaymentResponse, PaymentErrorResponse From 8d807b0471c4b8e9d8f076809448957a5019fb65 Mon Sep 17 00:00:00 2001 From: Thomas Vavrys Date: Fri, 18 Sep 2015 23:00:53 +0200 Subject: [PATCH 2/7] Add python2.6 compatibility --- pay_with_amazon/client.py | 10 +++++----- pay_with_amazon/ipn_handler.py | 6 +++--- pay_with_amazon/login_with_amazon.py | 10 +++++----- pay_with_amazon/payment_request.py | 4 ++-- pay_with_amazon/payment_response.py | 6 +++--- setup.py | 2 +- tests/test_ipn.py | 2 +- tests/test_pwa.py | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pay_with_amazon/client.py b/pay_with_amazon/client.py index 66f447f..46858c3 100644 --- a/pay_with_amazon/client.py +++ b/pay_with_amazon/client.py @@ -75,7 +75,7 @@ def __init__( try: setattr(self, param, os.environ[env_param_map[param]]) except: - raise ValueError('Invalid {}.'.format(param)) + raise ValueError('Invalid {0}.'.format(param)) else: setattr(self, param, eval(param)) @@ -84,7 +84,7 @@ def __init__( # used for Login with Amazon helper self._region_code = self.region except KeyError: - raise KeyError('Invalid region code ({})'.format(self.region)) + raise KeyError('Invalid region code ({0})'.format(self.region)) self.mws_access_key = self.mws_access_key self.mws_secret_key = self.mws_secret_key @@ -111,7 +111,7 @@ def __init__( application['ApplicationVersion'] = application_version self._user_agent = '; '.join( - '{}={}'.format( + '{0}={1}'.format( k, v) for ( k, @@ -136,11 +136,11 @@ def _set_endpoint(self): """Set endpoint for API calls""" if self._sandbox: self._mws_endpoint = \ - 'https://{}/OffAmazonPayments_Sandbox/{}'.format( + 'https://{0}/OffAmazonPayments_Sandbox/{1}'.format( self._region, self._api_version) else: self._mws_endpoint = \ - 'https://{}/OffAmazonPayments/{}'.format( + 'https://{0}/OffAmazonPayments/{1}'.format( self._region, self._api_version) def get_login_profile(self, access_token, client_id): diff --git a/pay_with_amazon/ipn_handler.py b/pay_with_amazon/ipn_handler.py index bb04d39..04a2f72 100644 --- a/pay_with_amazon/ipn_handler.py +++ b/pay_with_amazon/ipn_handler.py @@ -7,7 +7,7 @@ from pay_with_amazon.payment_response import PaymentResponse -class IpnHandler(): +class IpnHandler(object): """Instant Payment Notifications (IPN) can be used to monitor the state transition of payment objects. @@ -119,7 +119,7 @@ def _get_cert(self): except HTTPError as ex: self.error = 'Error retrieving certificate.' raise ValueError( - 'Error retrieving certificate. {}'.format( + 'Error retrieving certificate. {0}'.format( ex.reason)) self._pem = str(cert_req.read(), encoding='utf-8') @@ -127,7 +127,7 @@ def _get_cert(self): def _validate_signature(self): """Generate signing string and validate signature""" - signing_string = '{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n'.format( + signing_string = '{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}\n{8}\n{9}\n'.format( 'Message', self._message_encoded, 'MessageId', diff --git a/pay_with_amazon/login_with_amazon.py b/pay_with_amazon/login_with_amazon.py index 84227a7..07ea16d 100644 --- a/pay_with_amazon/login_with_amazon.py +++ b/pay_with_amazon/login_with_amazon.py @@ -24,17 +24,17 @@ def __init__(self, client_id, region, sandbox=False): try: self.region = lwa_region.regions[region] except KeyError: - raise KeyError('Invalid region code ({}).'.format(region)) + raise KeyError('Invalid region code ({0}).'.format(region)) self._sandbox_str = 'api.sandbox' if sandbox else 'api' - self._endpoint = 'https://{}.{}'.format( + self._endpoint = 'https://{0}.{1}'.format( self._sandbox_str, self.region) def get_login_profile(self, access_token): """Get profile associated with LWA user.""" token_info = requests.get( - url='{}/auth/o2/tokeninfo'.format(self._endpoint), + url='{0}/auth/o2/tokeninfo'.format(self._endpoint), headers=None, params={'access_token': access_token}, verify=True) @@ -51,8 +51,8 @@ def get_login_profile(self, access_token): raise ValueError('Invalid client Id.') profile = requests.get( - url='{}/user/profile'.format(self._endpoint), - headers={'Authorization': 'bearer {}'.format(access_token)}, + url='{0}/user/profile'.format(self._endpoint), + headers={'Authorization': 'bearer {0}'.format(access_token)}, params=None, verify=True) diff --git a/pay_with_amazon/payment_request.py b/pay_with_amazon/payment_request.py index aa7669b..058c226 100644 --- a/pay_with_amazon/payment_request.py +++ b/pay_with_amazon/payment_request.py @@ -95,7 +95,7 @@ def _querystring(self, params): parameters.update({k: v for (k, v) in params.items()}) parse_results = parse.urlparse(self._mws_endpoint) - string_to_sign = "POST\n{}\n{}\n{}".format( + string_to_sign = "POST\n{0}\n{1}\n{2}".format( parse_results[1], parse_results[2], parse.urlencode( @@ -127,7 +127,7 @@ def _request(self, retry_time): 503) and self.handle_throttle: self._should_throttle = True self.response = PaymentErrorResponse( - '{}'.format(r.status_code)) + '{0}'.format(r.status_code)) else: self.response = PaymentErrorResponse(r.text) diff --git a/pay_with_amazon/payment_response.py b/pay_with_amazon/payment_response.py index 6ddf724..15a75e0 100644 --- a/pay_with_amazon/payment_response.py +++ b/pay_with_amazon/payment_response.py @@ -47,12 +47,12 @@ def __init__(self, xml): 'RequestID' with capital 'ID'. 'na' endpoint returns 'RequestId' """ try: - if self._root.find('.//{}RequestId'.format(self._ns)) is None: + if self._root.find('.//{0}RequestId'.format(self._ns)) is None: self.request_id = self._root.find( - './/{}RequestID'.format(self._ns)).text + './/{0}RequestID'.format(self._ns)).text else: self.request_id = self._root.find( - './/{}RequestId'.format(self._ns)).text + './/{0}RequestId'.format(self._ns)).text except: self.request_id = None diff --git a/setup.py b/setup.py index 8a7d45c..5ec8079 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ version=pwa_version.versions['application_version'], description='Login and Pay with Amazon Python SDK', url='https://github.com/amzn/login-and-pay-with-amazon-sdk-python', - download_url='https://github.com/amzn/login-and-pay-with-amazon-sdk-python/tarball/{}'.format( + download_url='https://github.com/amzn/login-and-pay-with-amazon-sdk-python/tarball/{0}'.format( pwa_version.versions['application_version']), author='EPS-DSE', author_email='pay-with-amazon-sdk@amazon.com', diff --git a/tests/test_ipn.py b/tests/test_ipn.py index 3cb16aa..2b37981 100644 --- a/tests/test_ipn.py +++ b/tests/test_ipn.py @@ -12,7 +12,7 @@ def setUp(self): self.maxDiff = None with open( - '{}/test.pem'.format(os.path.dirname(os.path.realpath(__file__)))) as pemfile: + '{0}/test.pem'.format(os.path.dirname(os.path.realpath(__file__)))) as pemfile: self.pem = pemfile.read() self.body_valid = b'{\n "Type" : "Notification",\n "MessageId" : "15e7412b-e9ac-5f6a-b6df-0c909df567a0",\n "TopicArn" : "arn:aws:sns:us-east-1:291180941288:A3BXB0YN3XH17HAQR8184NJXADU",\n "Message" : "{\\"NotificationReferenceId\\":\\"1111111-1111-11111-1111-11111EXAMPLE\\",\\"MarketplaceID\\":\\"A3BXB0YN3XH17H\\",\\"NotificationType\\":\\"OrderReferenceNotification\\",\\"IsSample\\":true,\\"SellerId\\":\\"AQR8184NJXADU\\",\\"ReleaseEnvironment\\":\\"Sandbox\\",\\"Version\\":\\"2013-01-01\\",\\"NotificationData\\":\\"\\\\n \\\\n \\\\n P01-0000000-0000000-000000<\\\\/AmazonOrderReferenceId>\\\\n \\\\n 0.0<\\\\/Amount>\\\\n USD<\\\\/CurrencyCode>\\\\n <\\\\/OrderTotal>\\\\n \\\\n \\\\n Closed<\\\\/State> \\\\n 2013-01-01T01:01:01.001Z<\\\\/LastUpdateTimestamp>\\\\n AmazonClosed<\\\\/ReasonCode>\\\\n <\\\\/OrderReferenceStatus>\\\\n 2013-01-01T01:01:01.001Z<\\\\/CreationTimestamp> \\\\n 2013-01-01T01:01:01.001Z<\\\\/ExpirationTimestamp>\\\\n <\\\\/OrderReference>\\\\n <\\\\/OrderReferenceNotification>\\",\\"Timestamp\\":\\"2015-04-30T00:06:49.370Z\\"}",\n "Timestamp" : "2015-04-30T00:06:49.434Z",\n "SignatureVersion" : "1",\n "Signature" : "FltJb7WvAGpFayYBgzO5RMd5FoiGizURv+TdPnm/tLXE/E3ndwvLa08hYD3tvmggKSX7Qc0a4mSty9EjZFtTgRVT93jEGuXVBT/WjO5s0lD+7AnuWslxzuVtzLLuMTOnfFUIeoXX2V1bpGwNXPxGfRxLcqz7v41ZdvJvAauoIhjo4oAHF4nZOo2MBd6HY7LMIhJPHS0xmbyQ9Z4QFm5iDaDoSyZ5Q2hCM1RJ1Uv5MQMpNjTXdX4cX81C8lis4nMar/ejDJ8cOwiEweUl5F+y7jxI1uc8AgXNoMGXSwNvdVqoj4zgHVKPkb0Oz7HHY0c4LP9s0FMYkhLBmEGFZVKGKA==",\n "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-d6d679a1d18e95c2f9ffcf11f4f9e198.pem",\n "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:291180941288:A3BXB0YN3XH17HAQR8184NJXADU:6cab6de5-c2c7-4ef0-9d4f-d6a5db8b1636"\n}' diff --git a/tests/test_pwa.py b/tests/test_pwa.py index 03a9e73..6898f7f 100644 --- a/tests/test_pwa.py +++ b/tests/test_pwa.py @@ -18,7 +18,7 @@ def setUp(self): self.merchant_id = 'merchant_id' self.service_version = '2013-01-01' self.mws_endpoint = \ - 'https://mws.amazonservices.com/OffAmazonPayments_Sandbox/{}'.format( + 'https://mws.amazonservices.com/OffAmazonPayments_Sandbox/{0}'.format( self.service_version) self.client = PayWithAmazonClient( @@ -164,7 +164,7 @@ def test_headers(self, mock_urlopen): mock_urlopen.side_effect = self.mock_requests_post self.client.get_service_status() header_expected = { - 'User-Agent': 'Language=Python; MWSClientVersion=2013-01-01; Platform={}'.format(sys.platform), + 'User-Agent': 'Language=Python; MWSClientVersion=2013-01-01; Platform={0}'.format(sys.platform), 'Content-Type': 'application/x-www-form-urlencoded'} self.assertEqual(mock_urlopen.call_args[1]['headers'], header_expected) From 4a55cb9303e84f5e1322899dd6211ac8d06b3480 Mon Sep 17 00:00:00 2001 From: Thomas Vavrys Date: Fri, 18 Sep 2015 23:17:14 +0200 Subject: [PATCH 3/7] Add python2.6 dict comprehension compatibility --- pay_with_amazon/payment_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pay_with_amazon/payment_request.py b/pay_with_amazon/payment_request.py index 058c226..4c4a632 100644 --- a/pay_with_amazon/payment_request.py +++ b/pay_with_amazon/payment_request.py @@ -92,7 +92,7 @@ def _querystring(self, params): if 'SellerId' not in params: parameters['SellerId'] = self.merchant_id - parameters.update({k: v for (k, v) in params.items()}) + parameters.update(dict((k, v) for k, v in params.items())) parse_results = parse.urlparse(self._mws_endpoint) string_to_sign = "POST\n{0}\n{1}\n{2}".format( From 863708d740d942f78c3f87d9945d60289fae3439 Mon Sep 17 00:00:00 2001 From: Thomas Vavrys Date: Sat, 19 Sep 2015 11:04:25 +0200 Subject: [PATCH 4/7] Add missing python2.6 dict comprehension compatibility --- pay_with_amazon/client.py | 8 ++------ pay_with_amazon/payment_response.py | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/pay_with_amazon/client.py b/pay_with_amazon/client.py index 46858c3..47348fa 100644 --- a/pay_with_amazon/client.py +++ b/pay_with_amazon/client.py @@ -111,12 +111,8 @@ def __init__( application['ApplicationVersion'] = application_version self._user_agent = '; '.join( - '{0}={1}'.format( - k, - v) for ( - k, - v) in sorted( - application.items())) + '{0}={1}'.format(k, v) for (k, v) in sorted(application.items()) + ) self._headers = { 'Content-Type': 'application/x-www-form-urlencoded', diff --git a/pay_with_amazon/payment_response.py b/pay_with_amazon/payment_response.py index 15a75e0..93567c1 100644 --- a/pay_with_amazon/payment_response.py +++ b/pay_with_amazon/payment_response.py @@ -82,10 +82,10 @@ def _etree_to_dict(self, t): for dc in map(self._etree_to_dict, children): for k, v in dc.items(): dd[k].append(v) - d = { - t.tag.replace(self._ns, ''): { - k: v[0] if len(v) == 1 else v for k, - v in dd.items()}} + d = {t.tag.replace(self._ns, ''): dict( + (k, v[0] if len(v) == 1 else v) + for k, v in dd.items() + )} if t.attrib: d[t.tag.replace(self._ns, '')].update(('@' + k, v) for k, v in t.attrib.items()) From e9e32af974429ea9f1fae353710e5ecbf1ab8a07 Mon Sep 17 00:00:00 2001 From: Thomas Vavrys Date: Tue, 13 Oct 2015 19:58:58 +0200 Subject: [PATCH 5/7] Fixes a problem in future lib raising "TypeError: Cannot mix str and non-str arguments" --- pay_with_amazon/payment_request.py | 27 ++++++++++++++++----------- setup.py | 3 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pay_with_amazon/payment_request.py b/pay_with_amazon/payment_request.py index 4c4a632..7894285 100644 --- a/pay_with_amazon/payment_request.py +++ b/pay_with_amazon/payment_request.py @@ -1,15 +1,20 @@ -from future.standard_library import install_aliases -install_aliases() +try: + from urllib.parse import urlparse, urlencode +except ImportError: # Python 2 + from urlparse import urlparse + from urllib import urlencode -import hmac -import time import base64 -import hashlib import datetime -import requests -from urllib import parse +import hashlib +import hmac +import time from collections import OrderedDict -from pay_with_amazon.payment_response import PaymentResponse, PaymentErrorResponse + +import requests +from pay_with_amazon.payment_response import ( + PaymentErrorResponse, PaymentResponse +) class PaymentRequest(object): @@ -93,12 +98,12 @@ def _querystring(self, params): parameters['SellerId'] = self.merchant_id parameters.update(dict((k, v) for k, v in params.items())) - parse_results = parse.urlparse(self._mws_endpoint) + parse_results = urlparse(self._mws_endpoint) string_to_sign = "POST\n{0}\n{1}\n{2}".format( parse_results[1], parse_results[2], - parse.urlencode( + urlencode( sorted(parameters.items())).replace( '+', '%20').replace('*', '%2A').replace('%7E', '~')) @@ -106,7 +111,7 @@ def _querystring(self, params): ordered_parameters = OrderedDict(sorted(parameters.items())) ordered_parameters['Signature'] = ordered_parameters.pop('Signature') - return parse.urlencode(ordered_parameters).encode(encoding='utf_8') + return urlencode(ordered_parameters).encode(encoding='utf_8') def _request(self, retry_time): time.sleep(retry_time) diff --git a/setup.py b/setup.py index 5ec8079..7c17e52 100644 --- a/setup.py +++ b/setup.py @@ -14,8 +14,7 @@ license='Apache License version 2.0, January 2004', install_requires=['pyOpenSSL >= 0.11', 'requests >= 2.6.0', - 'mock', - 'future'], + 'mock'], keywords=['Amazon', 'Payments', 'Login', 'Python', 'API', 'SDK'], classifiers=[ 'Development Status :: 5 - Production/Stable', From 0728948e229821fd760cb89d8c111088594581b7 Mon Sep 17 00:00:00 2001 From: Thomas Vavrys Date: Tue, 13 Oct 2015 20:28:38 +0200 Subject: [PATCH 6/7] Fix str encode python2.6 compatibility --- pay_with_amazon/payment_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pay_with_amazon/payment_request.py b/pay_with_amazon/payment_request.py index 7894285..29b2515 100644 --- a/pay_with_amazon/payment_request.py +++ b/pay_with_amazon/payment_request.py @@ -111,7 +111,7 @@ def _querystring(self, params): ordered_parameters = OrderedDict(sorted(parameters.items())) ordered_parameters['Signature'] = ordered_parameters.pop('Signature') - return urlencode(ordered_parameters).encode(encoding='utf_8') + return urlencode(ordered_parameters).encode('utf_8') def _request(self, retry_time): time.sleep(retry_time) From 9ba47b05141f142701862744059a2cbda5055022 Mon Sep 17 00:00:00 2001 From: Thomas Vavrys Date: Wed, 13 Jan 2016 22:15:39 +0100 Subject: [PATCH 7/7] Fix SyntaxError: Non-ASCII character --- pay_with_amazon/client.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pay_with_amazon/client.py b/pay_with_amazon/client.py index 47348fa..93d58b2 100644 --- a/pay_with_amazon/client.py +++ b/pay_with_amazon/client.py @@ -775,9 +775,9 @@ def authorize( funds prior to fulfilling the order. Default: False soft_descriptor : string, optional - The description to be shown on the buyer’s payment instrument + The description to be shown on the buyer's payment instrument statement if CaptureNow is set to true. The soft descriptor sent to - the payment processor is: “AMZ* ”. + the payment processor is: "AMZ* ". merchant_id : string, required Your merchant ID. If you are a marketplace enter the seller's merchant @@ -863,9 +863,9 @@ def capture( emails to the buyer. Maximum: 255 characters, Default: None soft_descriptor : string, optional - The description to be shown on the buyer’s payment instrument + The description to be shown on the buyer's payment instrument statement. The soft descriptor sent to the payment processor is: - “AMZ* ”. + "AMZ* ". merchant_id : string, required Your merchant ID. If you are a marketplace enter the seller's merchant @@ -987,9 +987,9 @@ def refund( buyer. Maximum: 255 characters, Default: None soft_descriptor : string, optional - The description to be shown on the buyer’s payment instrument + The description to be shown on the buyer's payment instrument statement. The soft descriptor sent to the payment processor is: - “AMZ* ”. + "AMZ* ". merchant_id : string, required Your merchant ID. If you are a marketplace enter the seller's merchant @@ -1107,9 +1107,9 @@ def charge( Your marketplace web service auth token. Default: None soft_descriptor : string, optional - The description to be shown on the buyer’s payment instrument + The description to be shown on the buyer's payment instrument statement if CaptureNow is set to true. The soft descriptor sent to - the payment processor is: “AMZ* ”. + the payment processor is: "AMZ* ". """ if self.is_order_reference_id(amazon_reference_id):