misc: apply double-quote-string-fixer (#79788)

This commit is contained in:
Valentin Deniaud 2023-08-16 11:52:35 +02:00
parent ac990b7920
commit 02781300dc
11 changed files with 119 additions and 119 deletions

View File

@ -189,7 +189,7 @@ class Payment:
backend_trans_date = utc_tz.localize(datetime.datetime.utcnow()).astimezone(backend_tz)
capture_day = (capture_date - backend_trans_date.date()).days
if capture_day <= 0:
raise ValueError("capture_date needs to be superior to the transaction date.")
raise ValueError('capture_date needs to be superior to the transaction date.')
kwargs['capture_day'] = force_text(capture_day)

View File

@ -155,14 +155,14 @@ class Payment(PaymentCommon):
normal_return_url = self.normal_return_url
if next_url and not normal_return_url:
warnings.warn(
"passing next_url to request() is deprecated, " "set normal_return_url in options",
'passing next_url to request() is deprecated, ' 'set normal_return_url in options',
DeprecationWarning,
)
normal_return_url = next_url
automatic_return_url = self.automatic_return_url
if self.direct_notification_url and not automatic_return_url:
warnings.warn(
"direct_notification_url option is deprecated, " "use automatic_return_url",
'direct_notification_url option is deprecated, ' 'use automatic_return_url',
DeprecationWarning,
)
automatic_return_url = self.direct_notification_url

View File

@ -335,7 +335,7 @@ class Payment(PaymentCommon):
d['PBX_ATTENTE'] = self.normal_return_url
automatic_return_url = self.automatic_return_url
if not automatic_return_url and self.callback:
warnings.warn("callback option is deprecated, " "use automatic_return_url", DeprecationWarning)
warnings.warn('callback option is deprecated, ' 'use automatic_return_url', DeprecationWarning)
automatic_return_url = self.callback
capture_day = capture_day = kwargs.get('capture_day', self.capture_day)
if capture_day:

View File

@ -230,7 +230,7 @@ class Payment(PaymentCommon):
normal_return_url = self.normal_return_url
if next_url and not normal_return_url:
warnings.warn(
"passing next_url to request() is deprecated, " "set normal_return_url in options",
'passing next_url to request() is deprecated, ' 'set normal_return_url in options',
DeprecationWarning,
)
normal_return_url = next_url

View File

@ -263,7 +263,7 @@ class Payment(PaymentCommon):
"""
has_free_transaction_id = True
service_url = "https://paiement.systempay.fr/vads-payment/"
service_url = 'https://paiement.systempay.fr/vads-payment/'
signature_algo = 'sha1'
description = {
@ -408,7 +408,7 @@ class Payment(PaymentCommon):
normal_return_url = self.normal_return_url
if next_url:
warnings.warn(
"passing next_url to request() is deprecated, " "set normal_return_url in options",
'passing next_url to request() is deprecated, ' 'set normal_return_url in options',
DeprecationWarning,
)
normal_return_url = next_url

View File

@ -100,7 +100,7 @@ class Payment(PaymentCommon):
automatic_return_url = self.automatic_return_url
if next_url and not automatic_return_url:
warnings.warn(
"passing next_url to request() is deprecated, " "set automatic_return_url in options",
'passing next_url to request() is deprecated, ' 'set automatic_return_url in options',
DeprecationWarning,
)
automatic_return_url = next_url

View File

@ -52,7 +52,7 @@ class TestCommand(distutils.core.Command):
class eo_sdist(sdist):
def run(self):
print("creating VERSION file")
print('creating VERSION file')
if os.path.exists('VERSION'):
os.remove('VERSION')
version = get_version()
@ -60,7 +60,7 @@ class eo_sdist(sdist):
version_file.write(version)
version_file.close()
sdist.run(self)
print("removing VERSION file")
print('removing VERSION file')
if os.path.exists('VERSION'):
os.remove('VERSION')
@ -141,9 +141,9 @@ setuptools.setup(
long_description_content_type='text/plain',
url='http://dev.entrouvert.org/projects/eopayment/',
author="Entr'ouvert",
author_email="info@entrouvert.com",
maintainer="Benjamin Dauvergne",
maintainer_email="bdauvergne@entrouvert.com",
author_email='info@entrouvert.com',
maintainer='Benjamin Dauvergne',
maintainer_email='bdauvergne@entrouvert.com',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',

View File

@ -24,8 +24,8 @@ from requests.adapters import HTTPAdapter
def pytest_addoption(parser):
parser.addoption("--save-http-session", action="store_true", help="save HTTP session")
parser.addoption("--target-url", help="target URL")
parser.addoption('--save-http-session', action='store_true', help='save HTTP session')
parser.addoption('--target-url', help='target URL')
class LoggingAdapter(HTTPAdapter):

View File

@ -27,67 +27,67 @@ WEBHOOK_URL = 'https://callback.example.com'
RETURN_URL = 'https://return.example.com'
API_KEY = 'test'
ORDER_ID = "1c969951-f5f1-4290-ae41-6177961fb3cb"
ORDER_ID = '1c969951-f5f1-4290-ae41-6177961fb3cb'
QUERY_STRING = 'order_id=' + ORDER_ID
POST_ORDER_RESPONSE = {
"amount": 995,
"client": {"user_agent": "Testing API"},
"created": "2016-07-04T11:41:57.121017+00:00",
"currency": "EUR",
"description": "Example description",
"id": ORDER_ID,
"merchant_id": "7131b462-1b7d-489f-aba9-de2f0eadc9dc",
"modified": "2016-07-04T11:41:57.183822+00:00",
"order_url": "https://api.online.emspay.eu/pay/1c969951-f5f1-4290-ae41-6177961fb3cb/",
"project_id": "1ef558ed-d77d-470d-b43b-c0f4a131bcef",
"status": "new",
'amount': 995,
'client': {'user_agent': 'Testing API'},
'created': '2016-07-04T11:41:57.121017+00:00',
'currency': 'EUR',
'description': 'Example description',
'id': ORDER_ID,
'merchant_id': '7131b462-1b7d-489f-aba9-de2f0eadc9dc',
'modified': '2016-07-04T11:41:57.183822+00:00',
'order_url': 'https://api.online.emspay.eu/pay/1c969951-f5f1-4290-ae41-6177961fb3cb/',
'project_id': '1ef558ed-d77d-470d-b43b-c0f4a131bcef',
'status': 'new',
}
GET_ORDER_RESPONSE = {
"amount": 995,
"client": {"user_agent": "Testing API"},
"created": "2016-07-04T11:41:55.635115+00:00",
"currency": "EUR",
"description": "Example order #1",
"id": ORDER_ID,
"last_transaction_added": "2016-07-04T11:41:55.831655+00:00",
"merchant_id": "7131b462-1b7d-489f-aba9-de2f0eadc9dc",
"merchant_order_id": "EXAMPLE001",
"modified": "2016-07-04T11:41:56.215543+00:00",
"project_id": "1ef558ed-d77d-470d-b43b-c0f4a131bcef",
"return_url": "http://www.example.com/",
"status": "completed",
"transactions": [
'amount': 995,
'client': {'user_agent': 'Testing API'},
'created': '2016-07-04T11:41:55.635115+00:00',
'currency': 'EUR',
'description': 'Example order #1',
'id': ORDER_ID,
'last_transaction_added': '2016-07-04T11:41:55.831655+00:00',
'merchant_id': '7131b462-1b7d-489f-aba9-de2f0eadc9dc',
'merchant_order_id': 'EXAMPLE001',
'modified': '2016-07-04T11:41:56.215543+00:00',
'project_id': '1ef558ed-d77d-470d-b43b-c0f4a131bcef',
'return_url': 'http://www.example.com/',
'status': 'completed',
'transactions': [
{
"amount": 995,
"balance": "internal",
"created": "2016-07-04T11:41:55.831655+00:00",
"credit_debit": "credit",
"currency": "EUR",
"description": "Example order #1",
"events": [
'amount': 995,
'balance': 'internal',
'created': '2016-07-04T11:41:55.831655+00:00',
'credit_debit': 'credit',
'currency': 'EUR',
'description': 'Example order #1',
'events': [
{
"event": "new",
"id": "0c4bd0cd-f197-446b-b218-39cbeb028290",
"noticed": "2016-07-04T11:41:55.987468+00:00",
"occurred": "2016-07-04T11:41:55.831655+00:00",
"source": "set_status",
'event': 'new',
'id': '0c4bd0cd-f197-446b-b218-39cbeb028290',
'noticed': '2016-07-04T11:41:55.987468+00:00',
'occurred': '2016-07-04T11:41:55.831655+00:00',
'source': 'set_status',
}
],
"expiration_period": "PT60M",
"id": "6c81499c-14e4-4974-99e5-fe72ce019411",
"merchant_id": "7131b462-1b7d-489f-aba9-de2f0eadc9dc",
"modified": "2016-07-04T11:41:56.065147+00:00",
"order_id": ORDER_ID,
"payment_method": "ideal",
"payment_method_details": {
"issuer_id": "INGBNL2A",
'expiration_period': 'PT60M',
'id': '6c81499c-14e4-4974-99e5-fe72ce019411',
'merchant_id': '7131b462-1b7d-489f-aba9-de2f0eadc9dc',
'modified': '2016-07-04T11:41:56.065147+00:00',
'order_id': ORDER_ID,
'payment_method': 'ideal',
'payment_method_details': {
'issuer_id': 'INGBNL2A',
},
"payment_url": "https://api.online.emspay.eu/redirect/6c81499c-14e4-4974-99e5-fe72ce019411/to/payment/",
"project_id": "1ef558ed-d77d-470d-b43b-c0f4a131bcef",
"status": "completed",
'payment_url': 'https://api.online.emspay.eu/redirect/6c81499c-14e4-4974-99e5-fe72ce019411/to/payment/',
'project_id': '1ef558ed-d77d-470d-b43b-c0f4a131bcef',
'status': 'completed',
}
],
}

View File

@ -27,62 +27,62 @@ WEBHOOK_URL = 'https://callback.example.com'
RETURN_URL = 'https://return.example.com'
API_KEY = 'test'
PAYMENT_ID = "tr_7UhSN1zuXS"
PAYMENT_ID = 'tr_7UhSN1zuXS'
QUERY_STRING = 'id=' + PAYMENT_ID
POST_PAYMENTS_RESPONSE = {
"resource": "payment",
"id": PAYMENT_ID,
"mode": "test",
"createdAt": "2018-03-20T09:13:37+00:00",
"amount": {"value": "3.50", "currency": "EUR"},
"description": "Payment #12345",
"method": "null",
"status": "open",
"isCancelable": True,
"expiresAt": "2018-03-20T09:28:37+00:00",
"sequenceType": "oneoff",
"redirectUrl": "https://webshop.example.org/payment/12345/",
"webhookUrl": "https://webshop.example.org/payments/webhook/",
"_links": {
"checkout": {
"href": "https://www.mollie.com/payscreen/select-method/7UhSN1zuXS",
"type": "text/html",
'resource': 'payment',
'id': PAYMENT_ID,
'mode': 'test',
'createdAt': '2018-03-20T09:13:37+00:00',
'amount': {'value': '3.50', 'currency': 'EUR'},
'description': 'Payment #12345',
'method': 'null',
'status': 'open',
'isCancelable': True,
'expiresAt': '2018-03-20T09:28:37+00:00',
'sequenceType': 'oneoff',
'redirectUrl': 'https://webshop.example.org/payment/12345/',
'webhookUrl': 'https://webshop.example.org/payments/webhook/',
'_links': {
'checkout': {
'href': 'https://www.mollie.com/payscreen/select-method/7UhSN1zuXS',
'type': 'text/html',
},
},
}
GET_PAYMENTS_RESPONSE = {
"amount": {"currency": "EUR", "value": "3.50"},
"amountRefunded": {"currency": "EUR", "value": "0.00"},
"amountRemaining": {"currency": "EUR", "value": "3.50"},
"countryCode": "FR",
"createdAt": "2020-05-06T13:04:26+00:00",
"description": "Publik",
"details": {
"cardAudience": "consumer",
"cardCountryCode": "NL",
"cardHolder": "T. TEST",
"cardLabel": "Mastercard",
"cardNumber": "6787",
"cardSecurity": "normal",
"feeRegion": "other",
'amount': {'currency': 'EUR', 'value': '3.50'},
'amountRefunded': {'currency': 'EUR', 'value': '0.00'},
'amountRemaining': {'currency': 'EUR', 'value': '3.50'},
'countryCode': 'FR',
'createdAt': '2020-05-06T13:04:26+00:00',
'description': 'Publik',
'details': {
'cardAudience': 'consumer',
'cardCountryCode': 'NL',
'cardHolder': 'T. TEST',
'cardLabel': 'Mastercard',
'cardNumber': '6787',
'cardSecurity': 'normal',
'feeRegion': 'other',
},
"id": PAYMENT_ID,
"metadata": {"email": "test@entrouvert.com", "first_name": "test", "last_name": "test"},
"isCancelable": True,
"method": "creditcard",
"mode": "test",
"paidAt": "2020-05-06T14:01:04+00:00",
"profileId": "pfl_WNPCPTGepu",
"redirectUrl": "https://localhost/lingo/return-payment-backend/3/MTAw.1jWJis.6TbbjwSEurag6v4Z2VCheISBFjw/",
"resource": "payment",
"sequenceType": "oneoff",
"settlementAmount": {"currency": "EUR", "value": "3.50"},
"status": "paid",
"webhookUrl": "https://localhost/lingo/callback-payment-backend/3/",
'id': PAYMENT_ID,
'metadata': {'email': 'test@entrouvert.com', 'first_name': 'test', 'last_name': 'test'},
'isCancelable': True,
'method': 'creditcard',
'mode': 'test',
'paidAt': '2020-05-06T14:01:04+00:00',
'profileId': 'pfl_WNPCPTGepu',
'redirectUrl': 'https://localhost/lingo/return-payment-backend/3/MTAw.1jWJis.6TbbjwSEurag6v4Z2VCheISBFjw/',
'resource': 'payment',
'sequenceType': 'oneoff',
'settlementAmount': {'currency': 'EUR', 'value': '3.50'},
'status': 'paid',
'webhookUrl': 'https://localhost/lingo/callback-payment-backend/3/',
}

View File

@ -254,16 +254,16 @@ class PayboxTests(TestCase):
'&COMMENTAIRE=Demande traitée avec succès&REFABONNE=&PORTEUR='
)
backend_expected_response = {
"CODEREPONSE": "00000",
"RANG": "32",
"AUTORISATION": "XXXXXX",
"NUMTRANS": "0013989865",
"PORTEUR": "",
"COMMENTAIRE": "Demande traitée avec succès",
"SITE": "1999888",
"NUMAPPEL": "0030378572",
"REFABONNE": "",
"NUMQUESTION": "0013989862",
'CODEREPONSE': '00000',
'RANG': '32',
'AUTORISATION': 'XXXXXX',
'NUMTRANS': '0013989865',
'PORTEUR': '',
'COMMENTAIRE': 'Demande traitée avec succès',
'SITE': '1999888',
'NUMAPPEL': '0030378572',
'REFABONNE': '',
'NUMQUESTION': '0013989862',
}
with mock.patch('eopayment.paybox.requests.post') as requests_post: