From 6892ab1a0058e5754aa114d59137cc646fdabd1d Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Tue, 10 Dec 2024 14:18:49 +0500 Subject: [PATCH 01/11] fix: handle paypal payment recipt handle paypal payment recipt url SONIC-784 --- commerce_coordinator/apps/commercetools/pipeline.py | 1 + 1 file changed, 1 insertion(+) diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index ec4bb555..5eaafef2 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -12,6 +12,7 @@ from openedx_filters.exceptions import OpenEdxFilterException from requests import HTTPError +from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_STRIPE_PAYMENT_INTERFACE_NAME from commerce_coordinator.apps.commercetools.catalog_info.edx_utils import ( get_edx_payment_intent_id, get_edx_refund_amount, From 3063f3bf013f717ae0ffae30b55af0c2a4978077 Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Fri, 13 Dec 2024 18:37:13 +0500 Subject: [PATCH 02/11] feat: add auto refund feature for paypal --- .../commercetools/catalog_info/edx_utils.py | 22 ++++---- .../apps/commercetools/pipeline.py | 46 ++++++++++------ .../apps/commercetools/tests/test_pipeline.py | 10 ++-- commerce_coordinator/apps/paypal/clients.py | 53 +++++++++++++++++++ commerce_coordinator/apps/paypal/pipeline.py | 51 +++++++++++++++++- commerce_coordinator/apps/stripe/pipeline.py | 7 +-- commerce_coordinator/settings/base.py | 3 ++ commerce_coordinator/settings/local.py | 2 + requirements/base.txt | 2 + 9 files changed, 161 insertions(+), 35 deletions(-) create mode 100644 commerce_coordinator/apps/paypal/clients.py diff --git a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py index ed7a5edc..c2e01b5f 100644 --- a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py +++ b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py @@ -11,6 +11,7 @@ from commerce_coordinator.apps.commercetools.catalog_info.constants import ( EDX_STRIPE_PAYMENT_INTERFACE_NAME, + EDX_PAYPAL_PAYMENT_INTERFACE_NAME, PAYMENT_STATUS_INTERFACE_CODE_SUCCEEDED, EdXFieldNames, TwoUKeys @@ -58,23 +59,22 @@ def get_edx_successful_stripe_payment(order: CTOrder) -> Union[CTPayment, None]: return None -def get_edx_payment_intent_id(order: CTOrder) -> Union[str, None]: - pmt = get_edx_successful_stripe_payment(order) - if pmt: - return pmt.interface_id - return None - - -# TODO update get_edx_successful_stripe_payment to accommodate this util logic -# and replace it with that. +# TODO remove get_edx_successful_stripe_payment if there is no more use. def get_edx_successful_payment_info(order: CTOrder): for pr in order.payment_info.payments: pmt = pr.obj if pmt.payment_status.interface_code == PAYMENT_STATUS_INTERFACE_CODE_SUCCEEDED and pmt.interface_id: - return pmt.interface_id, pmt.payment_method_info.payment_interface + return pmt, pmt.payment_method_info.payment_interface return None, None +def get_edx_payment_intent_id(order: CTOrder) -> Union[str, None]: + pmt, _ = get_edx_successful_payment_info(order) + if pmt: + return pmt.interface_id + return None + + def get_edx_order_workflow_state_key(order: CTOrder) -> Optional[str]: order_workflow_state = None if order.state and order.state.obj: # it should never be that we have one and not the other. # pragma no cover @@ -88,7 +88,7 @@ def get_edx_is_sanctioned(order: CTOrder) -> bool: def get_edx_refund_amount(order: CTOrder) -> decimal: refund_amount = decimal.Decimal(0.00) - pmt = get_edx_successful_stripe_payment(order) + pmt, _ = get_edx_successful_payment_info(order) for transaction in pmt.transactions: if transaction.type == TransactionType.CHARGE: # pragma no cover refund_amount += decimal.Decimal(typed_money_to_string(transaction.amount, money_as_decimal_string=True)) diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index 5eaafef2..4b4fc61b 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -12,9 +12,11 @@ from openedx_filters.exceptions import OpenEdxFilterException from requests import HTTPError -from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_STRIPE_PAYMENT_INTERFACE_NAME +from commerce_coordinator.apps.commercetools.catalog_info.constants import ( + EDX_STRIPE_PAYMENT_INTERFACE_NAME, + EDX_PAYPAL_PAYMENT_INTERFACE_NAME +) from commerce_coordinator.apps.commercetools.catalog_info.edx_utils import ( - get_edx_payment_intent_id, get_edx_refund_amount, get_edx_successful_payment_info ) @@ -110,12 +112,12 @@ def run_filter(self, active_order_management_system, order_number, **kwargs): # duration = (datetime.now() - start_time).total_seconds() log.info(f"[Performance Check] get_order_by_number call took {duration} seconds") - intent_id, psp = get_edx_successful_payment_info(ct_order) + payment, psp = get_edx_successful_payment_info(ct_order) ret_val = { "order_data": ct_order, "psp": psp, - "payment_intent_id": intent_id + "payment_intent_id": payment.interface_id } return ret_val @@ -156,21 +158,21 @@ def run_filter(self, active_order_management_system, order_id, **kwargs): # pyl duration = (datetime.now() - start_time).total_seconds() log.info(f"[Performance Check] get_order_by_id call took {duration} seconds") + payment, psp = get_edx_successful_payment_info(ct_order) + ret_val = { "order_data": ct_order, - "order_id": ct_order.id + "order_id": ct_order.id, + "psp": psp, + "payment_intent_id": payment.interface_id } - intent_id = get_edx_payment_intent_id(ct_order) - - if intent_id: - ct_payment = ct_api_client.get_payment_by_key(intent_id) - ret_val['payment_intent_id'] = intent_id + if payment: + ct_payment = ct_api_client.get_payment_by_key(payment.interface_id) ret_val['amount_in_cents'] = get_edx_refund_amount(ct_order) ret_val['has_been_refunded'] = has_refund_transaction(ct_payment) ret_val['payment_data'] = ct_payment else: - ret_val['payment_intent_id'] = None ret_val['amount_in_cents'] = decimal.Decimal(0.00) ret_val['has_been_refunded'] = False ret_val['payment_data'] = None @@ -288,7 +290,7 @@ def run_filter( class CreateReturnPaymentTransaction(PipelineStep): """ Creates a Transaction for a return payment of a Commercetools order - based on Stripes refund object on a refunded charge. + based on Stripes or PayPal refund object on a refunded charge. """ def run_filter( @@ -297,12 +299,13 @@ def run_filter( active_order_management_system, payment_data, has_been_refunded, + psp, **kwargs ): # pylint: disable=arguments-differ """ Execute a filter with the signature specified. Arguments: - refund_response: Stripe refund object or str value "charge_already_refunded" + refund_response: PSP refund object or str value "charge_already_refunded" active_order_management_system: The Active Order System payment_data: CT payment object attached to the refunded order has_been_refunded (bool): Has this payment been refunded @@ -325,28 +328,37 @@ def run_filter( try: if payment_data is not None: payment_on_order = payment_data - else: + elif psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME: payment_key = refund_response['payment_intent'] payment_on_order = ct_api_client.get_payment_by_key(payment_key) + elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: + payment_on_order = ct_api_client.get_payment_by_transaction_interaction_id(refund_response['paypal_capture_id']) updated_payment = ct_api_client.create_return_payment_transaction( payment_id=payment_on_order.id, payment_version=payment_on_order.version, - refund=refund_response + refund=refund_response, + psp=psp, ) return { 'returned_payment': updated_payment } except CommercetoolsError as err: # pragma no cover + if psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME: + error_message = f"[payment_intent_id: {refund_response['payment_intent']}, " + elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: + error_message = f"[paypal_capture_id: {refund_response['paypal_capture_id']}, " log.info(f"[{tag}] Unsuccessful attempt to create refund payment transaction with details: " - f"[stripe_payment_intent_id: {refund_response['payment_intent']}, " + f"psp: {psp}, " + f"{error_message}" f"payment_id: {payment_on_order.id}], message_id: {kwargs['message_id']}") log.exception(f"[{tag}] Commercetools Error: {err}, {err.errors}") return PipelineCommand.CONTINUE.value except HTTPError as err: # pragma no cover log.info(f"[{tag}] Unsuccessful attempt to create refund payment transaction with details: " - f"[stripe_payment_intent_id: {refund_response['payment_intent']}, " + f"psp: {psp}, " + f"{error_message}" f"payment_id: {payment_on_order.id}], message_id: {kwargs['message_id']}") log.exception(f"[{tag}] HTTP Error: {err}") return PipelineCommand.CONTINUE.value diff --git a/commerce_coordinator/apps/commercetools/tests/test_pipeline.py b/commerce_coordinator/apps/commercetools/tests/test_pipeline.py index 1f02f1de..2c330604 100644 --- a/commerce_coordinator/apps/commercetools/tests/test_pipeline.py +++ b/commerce_coordinator/apps/commercetools/tests/test_pipeline.py @@ -3,6 +3,7 @@ from unittest import TestCase from unittest.mock import patch +from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_STRIPE_PAYMENT_INTERFACE_NAME from commercetools.platform.models import ReturnInfo, ReturnPaymentState, ReturnShipmentState, TransactionType from django.contrib.auth import get_user_model from django.test import RequestFactory @@ -146,7 +147,8 @@ def test_commercetools_transaction_create(self, mock_returned_payment, mock_paym payment_data=self.mock_response_payment, refund_response={"payment_intent": "mock_payment_intent"}, active_order_management_system=COMMERCETOOLS_ORDER_MANAGEMENT_SYSTEM, - has_been_refunded=False + has_been_refunded=False, + psp=EDX_STRIPE_PAYMENT_INTERFACE_NAME ) mock_payment_result = ret['returned_payment'] @@ -167,7 +169,8 @@ def test_commercetools_transaction_create_no_payment_data(self, mock_returned_pa payment_data=None, refund_response={"payment_intent": "mock_payment_intent"}, active_order_management_system=COMMERCETOOLS_ORDER_MANAGEMENT_SYSTEM, - has_been_refunded=False + has_been_refunded=False, + psp=EDX_STRIPE_PAYMENT_INTERFACE_NAME ) mock_payment_result = ret['returned_payment'] @@ -184,7 +187,8 @@ def test_commercetools_transaction_create_has_refund(self, mock_logger, mock_has payment_data=self.mock_response_payment, refund_response="charge_already_refunded", active_order_management_system=COMMERCETOOLS_ORDER_MANAGEMENT_SYSTEM, - has_been_refunded=True + has_been_refunded=True, + psp=EDX_STRIPE_PAYMENT_INTERFACE_NAME ) mock_logger.assert_called_once_with('[CreateReturnPaymentTransaction] refund has already been processed, ' 'skipping refund payment transaction creation') diff --git a/commerce_coordinator/apps/paypal/clients.py b/commerce_coordinator/apps/paypal/clients.py new file mode 100644 index 00000000..e7c343b7 --- /dev/null +++ b/commerce_coordinator/apps/paypal/clients.py @@ -0,0 +1,53 @@ +import logging + +from django.conf import settings +from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials +from paypalserversdk.logging.configuration.api_logging_configuration import ( + LoggingConfiguration, + RequestLoggingConfiguration, + ResponseLoggingConfiguration, +) +from paypalserversdk.paypalserversdk_client import PaypalserversdkClient +from paypalserversdk.controllers.orders_controller import OrdersController +from paypalserversdk.controllers.payments_controller import PaymentsController +from paypalserversdk.api_helper import ApiHelper + + +class PayPalClient: + def __init__(self): + self.paypal_client: PaypalserversdkClient = PaypalserversdkClient( + client_credentials_auth_credentials=ClientCredentialsAuthCredentials( + o_auth_client_id=settings.PAYMENT_PROCESSOR_CONFIG['edx']['paypal']['client_id'], + o_auth_client_secret=settings.PAYMENT_PROCESSOR_CONFIG['edx']['paypal']['client_secret'], + ), + logging_configuration=LoggingConfiguration( + log_level=logging.INFO, + # Disable masking of sensitive headers for Sandbox testing. + # This should be set to True (the default if unset)in production. + mask_sensitive_headers=False, + request_logging_config=RequestLoggingConfiguration( + log_headers=True, log_body=True + ), + response_logging_config=ResponseLoggingConfiguration( + log_headers=True, log_body=True + ), + ), + ) + + + def refund_order(self, order_id): + paypal_client = self.paypal_client + orders_controller: OrdersController = paypal_client.orders + payments_controller: PaymentsController = paypal_client.payments + + order = orders_controller.orders_get({"id": order_id}) + + capture_id = order.body.purchase_units[0].payments.captures[0].id + + collect = {"capture_id": capture_id, "prefer": "return=minimal"} + result = payments_controller.captures_refund(collect) + + if result.body: + return {"paypal_capture_id": capture_id} + + return None diff --git a/commerce_coordinator/apps/paypal/pipeline.py b/commerce_coordinator/apps/paypal/pipeline.py index 9d4841d9..5b7e589b 100644 --- a/commerce_coordinator/apps/paypal/pipeline.py +++ b/commerce_coordinator/apps/paypal/pipeline.py @@ -6,10 +6,11 @@ from urllib.parse import urlencode from django.conf import settings +from commerce_coordinator.apps.paypal.clients import PayPalClient +from commerce_coordinator.apps.core.constants import PipelineCommand from openedx_filters import PipelineStep from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_PAYPAL_PAYMENT_INTERFACE_NAME -from commerce_coordinator.apps.core.constants import PipelineCommand logger = logging.getLogger(__name__) @@ -30,3 +31,51 @@ def run_filter(self, psp=None, payment_intent_id=None, **params): return { 'redirect_url': redirect_url, } + + +class RefundPayPalPayment(PipelineStep): + """ + Refunds a PayPal payment + """ + + def run_filter( + self, + order_id, + amount_in_cents, + has_been_refunded, + psp, + **kwargs + ): # pylint: disable=arguments-differ + """ + Execute a filter with the signature specified. + Arguments: + order_id (str): The identifier of the order. + amount_in_cents (decimal): Total amount to refund + has_been_refunded (bool): Has this payment been refunded + kwargs: arguments passed through from the filter. + """ + + tag = type(self).__name__ + + if psp != EDX_PAYPAL_PAYMENT_INTERFACE_NAME and not amount_in_cents: + return PipelineCommand.CONTINUE.value + + if has_been_refunded: + logger.info(f'[{tag}] payment already refunded from psp: {psp}, skipping.') + return { + 'refund_response': "charge_already_refunded" + } + + paypal_client = PayPalClient() + try: + paypal_refund_response = paypal_client.refund_order(order_id=order_id) + return { + 'refund_response': paypal_refund_response + } + except Exception as ex: + logger.info(f'[CT-{tag}] Unsuccessful PayPal refund with details:' + f'[order_id: {order_id}' + f'message_id: {kwargs["message_id"]}') + raise Exception from ex + + diff --git a/commerce_coordinator/apps/stripe/pipeline.py b/commerce_coordinator/apps/stripe/pipeline.py index 1840223d..41395e8a 100644 --- a/commerce_coordinator/apps/stripe/pipeline.py +++ b/commerce_coordinator/apps/stripe/pipeline.py @@ -218,7 +218,7 @@ class GetPaymentIntentReceipt(PipelineStep): def run_filter(self, psp=None, payment_intent_id=None, **params): tag = type(self).__name__ - if payment_intent_id is None: + if psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME and payment_intent_id is None: logger.debug(f'[{tag}] payment_intent_id not set, skipping.') return PipelineCommand.CONTINUE.value @@ -249,6 +249,7 @@ def run_filter( payment_intent_id, amount_in_cents, has_been_refunded, + psp, **kwargs ): # pylint: disable=arguments-differ """ @@ -256,14 +257,14 @@ def run_filter( Arguments: order_id (str): The identifier of the order. payment_intent_id (str): The Stripe PaymentIntent id to look up. - amount_in_cents (decimal): Total amount to refund + refund_amount (decimal): Total amount to refund has_been_refunded (bool): Has this payment been refunded kwargs: arguments passed through from the filter. """ tag = type(self).__name__ - if not payment_intent_id or not amount_in_cents: # pragma: no cover + if psp != EDX_STRIPE_PAYMENT_INTERFACE_NAME and not payment_intent_id or not amount_in_cents: # pragma: no cover logger.info(f'[{tag}] payment_intent_id or amount_in_cents not set, skipping.') return PipelineCommand.CONTINUE.value diff --git a/commerce_coordinator/settings/base.py b/commerce_coordinator/settings/base.py index 8bcec13a..3d183c00 100644 --- a/commerce_coordinator/settings/base.py +++ b/commerce_coordinator/settings/base.py @@ -395,6 +395,7 @@ def root(*path_fragments): 'commerce_coordinator.apps.rollout.pipeline.DetermineActiveOrderManagementSystemByOrderID', 'commerce_coordinator.apps.commercetools.pipeline.FetchOrderDetailsByOrderID', 'commerce_coordinator.apps.stripe.pipeline.RefundPaymentIntent', + 'commerce_coordinator.apps.paypal.pipeline.RefundPayPalPayment', 'commerce_coordinator.apps.commercetools.pipeline.CreateReturnPaymentTransaction', 'commerce_coordinator.apps.commercetools.pipeline.UpdateCommercetoolsOrderReturnPaymentStatus', ] @@ -438,6 +439,8 @@ def root(*path_fragments): 'paypal': { 'user_activity_page_url': '', 'paypal_webhook_id': PAYPAL_WEBHOOK_ID, + 'client_id': '', + 'client_secret': '', }, }, } diff --git a/commerce_coordinator/settings/local.py b/commerce_coordinator/settings/local.py index a41afccd..ff2d1174 100644 --- a/commerce_coordinator/settings/local.py +++ b/commerce_coordinator/settings/local.py @@ -147,6 +147,8 @@ 'paypal': { 'user_activity_page_url': 'https://sandbox.paypal.com/myaccount/activities/', 'paypal_webhook_id': 'SET-ME-PLEASE', + 'client_id': '', + 'client_secret': '', }, }, } diff --git a/requirements/base.txt b/requirements/base.txt index f1484a6b..62ca0518 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -147,6 +147,8 @@ openedx-filters==1.11.0 # via -r requirements/base.in packaging==24.1 # via marshmallow +paypal-server-sdk==0.5.1 + # via -r requirements/base.in pbr==6.1.0 # via stevedore pillow==11.0.0 From 86b61a5a1c7f643c80e2a1f88739054d02d000cc Mon Sep 17 00:00:00 2001 From: Syed Sajjad Hussain Shah Date: Tue, 17 Dec 2024 21:02:29 +0500 Subject: [PATCH 03/11] feat: working code --- .../commercetools/catalog_info/edx_utils.py | 13 +++-- .../apps/commercetools/clients.py | 2 +- .../apps/commercetools/pipeline.py | 17 +++++-- .../apps/commercetools/views.py | 2 + commerce_coordinator/apps/paypal/clients.py | 47 +++++++------------ commerce_coordinator/apps/paypal/pipeline.py | 21 +++++---- commerce_coordinator/apps/stripe/pipeline.py | 5 +- commerce_coordinator/settings/base.py | 4 +- commerce_coordinator/settings/local.py | 4 +- commerce_coordinator/urls.py | 6 +++ 10 files changed, 69 insertions(+), 52 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py index c2e01b5f..1240ab5a 100644 --- a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py +++ b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py @@ -86,10 +86,15 @@ def get_edx_is_sanctioned(order: CTOrder) -> bool: return get_edx_order_workflow_state_key(order) == TwoUKeys.SDN_SANCTIONED_ORDER_STATE -def get_edx_refund_amount(order: CTOrder) -> decimal: +def get_edx_refund_info(payment: CTPayment) -> decimal: refund_amount = decimal.Decimal(0.00) - pmt, _ = get_edx_successful_payment_info(order) - for transaction in pmt.transactions: + interaction_id = None + for transaction in payment.transactions: + print('\n\n\n\n\n\nget_edx_refund_amount transaction.type = ', transaction.type) if transaction.type == TransactionType.CHARGE: # pragma no cover + print('\n\n\n\n\n\nget_edx_refund_amount transaction.amount = ', transaction.amount) refund_amount += decimal.Decimal(typed_money_to_string(transaction.amount, money_as_decimal_string=True)) - return refund_amount + interaction_id = transaction.interaction_id + return refund_amount, interaction_id + return refund_amount, interaction_id + diff --git a/commerce_coordinator/apps/commercetools/clients.py b/commerce_coordinator/apps/commercetools/clients.py index e6dc617d..df5d57ca 100644 --- a/commerce_coordinator/apps/commercetools/clients.py +++ b/commerce_coordinator/apps/commercetools/clients.py @@ -511,7 +511,7 @@ def _preprocess_refund_object(self, refund: Refund, psp: str) -> Refund: else: refund["created"] = datetime.datetime.utcfromtimestamp(refund["created"]) - refund["status"] = translate_refund_status_to_transaction_status(refund["status"]) + refund["status"] = translate_refund_status_to_transaction_status(refund["status"].lower()) refund["currency"] = refund["currency"].upper() return refund diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index 4b4fc61b..93f5be41 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -17,7 +17,7 @@ EDX_PAYPAL_PAYMENT_INTERFACE_NAME ) from commerce_coordinator.apps.commercetools.catalog_info.edx_utils import ( - get_edx_refund_amount, + get_edx_refund_info, get_edx_successful_payment_info ) from commerce_coordinator.apps.commercetools.clients import CommercetoolsAPIClient @@ -169,11 +169,14 @@ def run_filter(self, active_order_management_system, order_id, **kwargs): # pyl if payment: ct_payment = ct_api_client.get_payment_by_key(payment.interface_id) - ret_val['amount_in_cents'] = get_edx_refund_amount(ct_order) + refund_amount, ct_transaction_interaction_id = get_edx_refund_info(ct_payment) + ret_val['amount_in_cents'] = refund_amount + ret_val['ct_transaction_interaction_id'] = ct_transaction_interaction_id ret_val['has_been_refunded'] = has_refund_transaction(ct_payment) ret_val['payment_data'] = ct_payment else: ret_val['amount_in_cents'] = decimal.Decimal(0.00) + ret_val['ct_transaction_interaction_id'] = None ret_val['has_been_refunded'] = False ret_val['payment_data'] = None @@ -299,6 +302,7 @@ def run_filter( active_order_management_system, payment_data, has_been_refunded, + payment_intent_id, psp, **kwargs ): # pylint: disable=arguments-differ @@ -332,7 +336,8 @@ def run_filter( payment_key = refund_response['payment_intent'] payment_on_order = ct_api_client.get_payment_by_key(payment_key) elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: - payment_on_order = ct_api_client.get_payment_by_transaction_interaction_id(refund_response['paypal_capture_id']) + payment_on_order = ct_api_client.get_payment_by_key(payment_intent_id) + print('\n\n\n paypal payment_on_order = ', payment_on_order) updated_payment = ct_api_client.create_return_payment_transaction( payment_id=payment_on_order.id, @@ -345,6 +350,7 @@ def run_filter( 'returned_payment': updated_payment } except CommercetoolsError as err: # pragma no cover + error_message = "unknown" if psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME: error_message = f"[payment_intent_id: {refund_response['payment_intent']}, " elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: @@ -356,6 +362,11 @@ def run_filter( log.exception(f"[{tag}] Commercetools Error: {err}, {err.errors}") return PipelineCommand.CONTINUE.value except HTTPError as err: # pragma no cover + error_message = "unknown" + if psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME: + error_message = f"[payment_intent_id: {refund_response['payment_intent']}, " + elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: + error_message = f"[paypal_capture_id: {refund_response['paypal_capture_id']}, " log.info(f"[{tag}] Unsuccessful attempt to create refund payment transaction with details: " f"psp: {psp}, " f"{error_message}" diff --git a/commerce_coordinator/apps/commercetools/views.py b/commerce_coordinator/apps/commercetools/views.py index f159248a..44999587 100644 --- a/commerce_coordinator/apps/commercetools/views.py +++ b/commerce_coordinator/apps/commercetools/views.py @@ -127,6 +127,8 @@ def post(self, request): **request.data } + print('\n\n\n\n\n\nrequest.data', request.data) + logger.debug(f'[CT-{tag}] Message received from commercetools with details: {input_data}') message_details = OrderReturnedViewMessageInputSerializer(data=input_data) diff --git a/commerce_coordinator/apps/paypal/clients.py b/commerce_coordinator/apps/paypal/clients.py index e7c343b7..4ab243e3 100644 --- a/commerce_coordinator/apps/paypal/clients.py +++ b/commerce_coordinator/apps/paypal/clients.py @@ -1,18 +1,11 @@ -import logging +import json from django.conf import settings from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials -from paypalserversdk.logging.configuration.api_logging_configuration import ( - LoggingConfiguration, - RequestLoggingConfiguration, - ResponseLoggingConfiguration, -) from paypalserversdk.paypalserversdk_client import PaypalserversdkClient -from paypalserversdk.controllers.orders_controller import OrdersController from paypalserversdk.controllers.payments_controller import PaymentsController from paypalserversdk.api_helper import ApiHelper - class PayPalClient: def __init__(self): self.paypal_client: PaypalserversdkClient = PaypalserversdkClient( @@ -20,34 +13,26 @@ def __init__(self): o_auth_client_id=settings.PAYMENT_PROCESSOR_CONFIG['edx']['paypal']['client_id'], o_auth_client_secret=settings.PAYMENT_PROCESSOR_CONFIG['edx']['paypal']['client_secret'], ), - logging_configuration=LoggingConfiguration( - log_level=logging.INFO, - # Disable masking of sensitive headers for Sandbox testing. - # This should be set to True (the default if unset)in production. - mask_sensitive_headers=False, - request_logging_config=RequestLoggingConfiguration( - log_headers=True, log_body=True - ), - response_logging_config=ResponseLoggingConfiguration( - log_headers=True, log_body=True - ), - ), ) - def refund_order(self, order_id): + def refund_order(self, capture_id): paypal_client = self.paypal_client - orders_controller: OrdersController = paypal_client.orders payments_controller: PaymentsController = paypal_client.payments - order = orders_controller.orders_get({"id": order_id}) - - capture_id = order.body.purchase_units[0].payments.captures[0].id - - collect = {"capture_id": capture_id, "prefer": "return=minimal"} - result = payments_controller.captures_refund(collect) + collect = {"capture_id": capture_id, "prefer": "return=representation"} + refund_response = payments_controller.captures_refund(collect) + print('\n\n\n\n\n refund_response.body = ', refund_response.body) + if refund_response.body: + response = json.loads(ApiHelper.json_serialize(refund_response.body)) + print('\n\n\n\n\n refund_order response serialized = ', response) + + return { + "id": response.get("id"), + "created": response.get("create_time"), + "status": response.get("status"), + "amount": response.get("amount").get("value"), + "currency": response.get("amount").get("currency_code"), + } - if result.body: - return {"paypal_capture_id": capture_id} - return None diff --git a/commerce_coordinator/apps/paypal/pipeline.py b/commerce_coordinator/apps/paypal/pipeline.py index 5b7e589b..222a1926 100644 --- a/commerce_coordinator/apps/paypal/pipeline.py +++ b/commerce_coordinator/apps/paypal/pipeline.py @@ -9,6 +9,7 @@ from commerce_coordinator.apps.paypal.clients import PayPalClient from commerce_coordinator.apps.core.constants import PipelineCommand from openedx_filters import PipelineStep +from requests import RequestException from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_PAYPAL_PAYMENT_INTERFACE_NAME @@ -43,6 +44,7 @@ def run_filter( order_id, amount_in_cents, has_been_refunded, + ct_transaction_interaction_id, psp, **kwargs ): # pylint: disable=arguments-differ @@ -57,7 +59,7 @@ def run_filter( tag = type(self).__name__ - if psp != EDX_PAYPAL_PAYMENT_INTERFACE_NAME and not amount_in_cents: + if psp != EDX_PAYPAL_PAYMENT_INTERFACE_NAME or not amount_in_cents or not ct_transaction_interaction_id: return PipelineCommand.CONTINUE.value if has_been_refunded: @@ -66,16 +68,19 @@ def run_filter( 'refund_response': "charge_already_refunded" } - paypal_client = PayPalClient() try: - paypal_refund_response = paypal_client.refund_order(order_id=order_id) + paypal_client = PayPalClient() + paypal_refund_response = paypal_client.refund_order(capture_id=ct_transaction_interaction_id) + print('\n\n\n\n\n paypal_refund_response = ', paypal_refund_response) return { - 'refund_response': paypal_refund_response + 'refund_response': paypal_refund_response, } except Exception as ex: - logger.info(f'[CT-{tag}] Unsuccessful PayPal refund with details:' - f'[order_id: {order_id}' - f'message_id: {kwargs["message_id"]}') - raise Exception from ex + logger.error(f'[CT-{tag}] Unsuccessful PayPal refund with details: ' + f'[order_id: {order_id} ' + f'message_id: {kwargs["message_id"]} ' + f'exception: {ex}') + + raise RequestException(str(ex)) diff --git a/commerce_coordinator/apps/stripe/pipeline.py b/commerce_coordinator/apps/stripe/pipeline.py index 41395e8a..32ed8a1e 100644 --- a/commerce_coordinator/apps/stripe/pipeline.py +++ b/commerce_coordinator/apps/stripe/pipeline.py @@ -263,8 +263,11 @@ def run_filter( """ tag = type(self).__name__ + print('\n\n\n\n\n\nRefundPaymentIntent psp = ', psp) + print('\n\n\n\n\n\nRefundPaymentIntent payment_intent_id = ', payment_intent_id) + print('\n\n\n\n\n\nRefundPaymentIntent amount_in_cents = ', amount_in_cents) - if psp != EDX_STRIPE_PAYMENT_INTERFACE_NAME and not payment_intent_id or not amount_in_cents: # pragma: no cover + if psp != EDX_STRIPE_PAYMENT_INTERFACE_NAME or not payment_intent_id or not amount_in_cents: # pragma: no cover logger.info(f'[{tag}] payment_intent_id or amount_in_cents not set, skipping.') return PipelineCommand.CONTINUE.value diff --git a/commerce_coordinator/settings/base.py b/commerce_coordinator/settings/base.py index 3d183c00..74b6095f 100644 --- a/commerce_coordinator/settings/base.py +++ b/commerce_coordinator/settings/base.py @@ -439,8 +439,8 @@ def root(*path_fragments): 'paypal': { 'user_activity_page_url': '', 'paypal_webhook_id': PAYPAL_WEBHOOK_ID, - 'client_id': '', - 'client_secret': '', + 'client_id': 'ASoOt8z1BmLEzJGLV-N_gWP083ghlpWaj9eOj4BxQ9k8rQ-jDoSO5e_5-gRR3uzwp-hOt_YmfzKsnrFV', + 'client_secret': 'EL_StzjNHS0lUbtVLPOUxC-fa27E4x12WIAN4XRHjYNNYM3kkUNxXoaFd_XextoDC1h3TvF9vuC74J1Z', }, }, } diff --git a/commerce_coordinator/settings/local.py b/commerce_coordinator/settings/local.py index ff2d1174..07d10cf7 100644 --- a/commerce_coordinator/settings/local.py +++ b/commerce_coordinator/settings/local.py @@ -147,8 +147,8 @@ 'paypal': { 'user_activity_page_url': 'https://sandbox.paypal.com/myaccount/activities/', 'paypal_webhook_id': 'SET-ME-PLEASE', - 'client_id': '', - 'client_secret': '', + 'client_id': 'ASoOt8z1BmLEzJGLV-N_gWP083ghlpWaj9eOj4BxQ9k8rQ-jDoSO5e_5-gRR3uzwp-hOt_YmfzKsnrFV', + 'client_secret': 'EL_StzjNHS0lUbtVLPOUxC-fa27E4x12WIAN4XRHjYNNYM3kkUNxXoaFd_XextoDC1h3TvF9vuC74J1Z', }, }, } diff --git a/commerce_coordinator/urls.py b/commerce_coordinator/urls.py index 9e4fbc79..6bd3409b 100644 --- a/commerce_coordinator/urls.py +++ b/commerce_coordinator/urls.py @@ -43,6 +43,10 @@ from commerce_coordinator.apps.titan import urls as titan_urls from commerce_coordinator.settings.base import FAVICON_URL +from commerce_coordinator.apps.paypal.clients import PayPalClient + +paypal_client = PayPalClient() + admin.autodiscover() urlpatterns = oauth2_urlpatterns + [ @@ -70,6 +74,7 @@ re_path(r'^$', lambda r: JsonResponse(data=[ "Welcome to Commerce Coordinator", "This is an API app that provides a backend for Commerce.", + str(paypal_client), ], status=status.HTTP_200_OK, safe=False), name='root'), path('favicon.ico', RedirectView.as_view(url=FAVICON_URL), name='favicon'), @@ -84,3 +89,4 @@ import debug_toolbar urlpatterns.append(re_path(r'^__debug__/', include(debug_toolbar.urls))) + From 68da628214b7a167da91d170f773526d1db99c09 Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Wed, 18 Dec 2024 00:33:20 +0500 Subject: [PATCH 04/11] fix: fix test --- .../commercetools/catalog_info/edx_utils.py | 15 ------------ .../apps/commercetools/pipeline.py | 5 ++-- .../apps/commercetools/tests/test_pipeline.py | 5 +++- .../apps/commercetools/views.py | 2 -- commerce_coordinator/apps/paypal/clients.py | 23 +++++++++++++++---- commerce_coordinator/apps/paypal/pipeline.py | 10 ++++---- .../apps/paypal/tests/__init__.py | 1 - commerce_coordinator/apps/stripe/pipeline.py | 3 --- commerce_coordinator/settings/base.py | 4 ++-- commerce_coordinator/settings/local.py | 4 ++-- commerce_coordinator/settings/test.py | 2 ++ commerce_coordinator/urls.py | 5 ---- requirements/base.in | 1 + requirements/base.txt | 2 -- requirements/common_constraints.txt | 4 ++++ 15 files changed, 39 insertions(+), 47 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py index 1240ab5a..64b6acad 100644 --- a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py +++ b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py @@ -10,8 +10,6 @@ from commercetools.platform.models import TransactionType from commerce_coordinator.apps.commercetools.catalog_info.constants import ( - EDX_STRIPE_PAYMENT_INTERFACE_NAME, - EDX_PAYPAL_PAYMENT_INTERFACE_NAME, PAYMENT_STATUS_INTERFACE_CODE_SUCCEEDED, EdXFieldNames, TwoUKeys @@ -49,17 +47,6 @@ def get_edx_lms_user_name(customer: CTCustomer): return customer.custom.fields[EdXFieldNames.LMS_USER_NAME] -def get_edx_successful_stripe_payment(order: CTOrder) -> Union[CTPayment, None]: - for pr in order.payment_info.payments: - pmt = pr.obj - if pmt.payment_status.interface_code == PAYMENT_STATUS_INTERFACE_CODE_SUCCEEDED \ - and pmt.payment_method_info.payment_interface == EDX_STRIPE_PAYMENT_INTERFACE_NAME and \ - pmt.interface_id: - return pmt - return None - - -# TODO remove get_edx_successful_stripe_payment if there is no more use. def get_edx_successful_payment_info(order: CTOrder): for pr in order.payment_info.payments: pmt = pr.obj @@ -90,9 +77,7 @@ def get_edx_refund_info(payment: CTPayment) -> decimal: refund_amount = decimal.Decimal(0.00) interaction_id = None for transaction in payment.transactions: - print('\n\n\n\n\n\nget_edx_refund_amount transaction.type = ', transaction.type) if transaction.type == TransactionType.CHARGE: # pragma no cover - print('\n\n\n\n\n\nget_edx_refund_amount transaction.amount = ', transaction.amount) refund_amount += decimal.Decimal(typed_money_to_string(transaction.amount, money_as_decimal_string=True)) interaction_id = transaction.interaction_id return refund_amount, interaction_id diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index 93f5be41..70cd3a0d 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -13,8 +13,8 @@ from requests import HTTPError from commerce_coordinator.apps.commercetools.catalog_info.constants import ( - EDX_STRIPE_PAYMENT_INTERFACE_NAME, - EDX_PAYPAL_PAYMENT_INTERFACE_NAME + EDX_PAYPAL_PAYMENT_INTERFACE_NAME, + EDX_STRIPE_PAYMENT_INTERFACE_NAME ) from commerce_coordinator.apps.commercetools.catalog_info.edx_utils import ( get_edx_refund_info, @@ -337,7 +337,6 @@ def run_filter( payment_on_order = ct_api_client.get_payment_by_key(payment_key) elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: payment_on_order = ct_api_client.get_payment_by_key(payment_intent_id) - print('\n\n\n paypal payment_on_order = ', payment_on_order) updated_payment = ct_api_client.create_return_payment_transaction( payment_id=payment_on_order.id, diff --git a/commerce_coordinator/apps/commercetools/tests/test_pipeline.py b/commerce_coordinator/apps/commercetools/tests/test_pipeline.py index 2c330604..b5a74bff 100644 --- a/commerce_coordinator/apps/commercetools/tests/test_pipeline.py +++ b/commerce_coordinator/apps/commercetools/tests/test_pipeline.py @@ -3,12 +3,12 @@ from unittest import TestCase from unittest.mock import patch -from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_STRIPE_PAYMENT_INTERFACE_NAME from commercetools.platform.models import ReturnInfo, ReturnPaymentState, ReturnShipmentState, TransactionType from django.contrib.auth import get_user_model from django.test import RequestFactory from rest_framework.test import APITestCase +from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_STRIPE_PAYMENT_INTERFACE_NAME from commerce_coordinator.apps.commercetools.constants import COMMERCETOOLS_ORDER_MANAGEMENT_SYSTEM from commerce_coordinator.apps.commercetools.pipeline import ( AnonymizeRetiredUser, @@ -148,6 +148,7 @@ def test_commercetools_transaction_create(self, mock_returned_payment, mock_paym refund_response={"payment_intent": "mock_payment_intent"}, active_order_management_system=COMMERCETOOLS_ORDER_MANAGEMENT_SYSTEM, has_been_refunded=False, + payment_intent_id="pi_4MtwBwLkdIwGlenn28a3tqPa", psp=EDX_STRIPE_PAYMENT_INTERFACE_NAME ) mock_payment_result = ret['returned_payment'] @@ -170,6 +171,7 @@ def test_commercetools_transaction_create_no_payment_data(self, mock_returned_pa refund_response={"payment_intent": "mock_payment_intent"}, active_order_management_system=COMMERCETOOLS_ORDER_MANAGEMENT_SYSTEM, has_been_refunded=False, + payment_intent_id="pi_4MtwBwLkdIwGlenn28a3tqPa", psp=EDX_STRIPE_PAYMENT_INTERFACE_NAME ) mock_payment_result = ret['returned_payment'] @@ -188,6 +190,7 @@ def test_commercetools_transaction_create_has_refund(self, mock_logger, mock_has refund_response="charge_already_refunded", active_order_management_system=COMMERCETOOLS_ORDER_MANAGEMENT_SYSTEM, has_been_refunded=True, + payment_intent_id="pi_4MtwBwLkdIwGlenn28a3tqPa", psp=EDX_STRIPE_PAYMENT_INTERFACE_NAME ) mock_logger.assert_called_once_with('[CreateReturnPaymentTransaction] refund has already been processed, ' diff --git a/commerce_coordinator/apps/commercetools/views.py b/commerce_coordinator/apps/commercetools/views.py index 44999587..f159248a 100644 --- a/commerce_coordinator/apps/commercetools/views.py +++ b/commerce_coordinator/apps/commercetools/views.py @@ -127,8 +127,6 @@ def post(self, request): **request.data } - print('\n\n\n\n\n\nrequest.data', request.data) - logger.debug(f'[CT-{tag}] Message received from commercetools with details: {input_data}') message_details = OrderReturnedViewMessageInputSerializer(data=input_data) diff --git a/commerce_coordinator/apps/paypal/clients.py b/commerce_coordinator/apps/paypal/clients.py index 4ab243e3..8369c5a9 100644 --- a/commerce_coordinator/apps/paypal/clients.py +++ b/commerce_coordinator/apps/paypal/clients.py @@ -1,12 +1,17 @@ +"""PayPal client""" import json from django.conf import settings +from paypalserversdk.api_helper import ApiHelper +from paypalserversdk.controllers.payments_controller import PaymentsController from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials from paypalserversdk.paypalserversdk_client import PaypalserversdkClient -from paypalserversdk.controllers.payments_controller import PaymentsController -from paypalserversdk.api_helper import ApiHelper + class PayPalClient: + """ + PayPal SDK client to call PayPal APIs. + """ def __init__(self): self.paypal_client: PaypalserversdkClient = PaypalserversdkClient( client_credentials_auth_credentials=ClientCredentialsAuthCredentials( @@ -17,16 +22,24 @@ def __init__(self): def refund_order(self, capture_id): + """ + Capture PayPal refund. + + Args: + capture_id (str): The identifier of the PayPal order to cpture refund. + + Returns: + The response from PayPal. + """ + paypal_client = self.paypal_client payments_controller: PaymentsController = paypal_client.payments collect = {"capture_id": capture_id, "prefer": "return=representation"} refund_response = payments_controller.captures_refund(collect) - print('\n\n\n\n\n refund_response.body = ', refund_response.body) + if refund_response.body: response = json.loads(ApiHelper.json_serialize(refund_response.body)) - print('\n\n\n\n\n refund_order response serialized = ', response) - return { "id": response.get("id"), "created": response.get("create_time"), diff --git a/commerce_coordinator/apps/paypal/pipeline.py b/commerce_coordinator/apps/paypal/pipeline.py index 222a1926..db74b7e9 100644 --- a/commerce_coordinator/apps/paypal/pipeline.py +++ b/commerce_coordinator/apps/paypal/pipeline.py @@ -6,12 +6,12 @@ from urllib.parse import urlencode from django.conf import settings -from commerce_coordinator.apps.paypal.clients import PayPalClient -from commerce_coordinator.apps.core.constants import PipelineCommand from openedx_filters import PipelineStep from requests import RequestException from commerce_coordinator.apps.commercetools.catalog_info.constants import EDX_PAYPAL_PAYMENT_INTERFACE_NAME +from commerce_coordinator.apps.core.constants import PipelineCommand +from commerce_coordinator.apps.paypal.clients import PayPalClient logger = logging.getLogger(__name__) @@ -71,7 +71,7 @@ def run_filter( try: paypal_client = PayPalClient() paypal_refund_response = paypal_client.refund_order(capture_id=ct_transaction_interaction_id) - print('\n\n\n\n\n paypal_refund_response = ', paypal_refund_response) + return { 'refund_response': paypal_refund_response, } @@ -81,6 +81,4 @@ def run_filter( f'message_id: {kwargs["message_id"]} ' f'exception: {ex}') - raise RequestException(str(ex)) - - + raise RequestException(str(ex)) from ex diff --git a/commerce_coordinator/apps/paypal/tests/__init__.py b/commerce_coordinator/apps/paypal/tests/__init__.py index 2e06d004..e69de29b 100644 --- a/commerce_coordinator/apps/paypal/tests/__init__.py +++ b/commerce_coordinator/apps/paypal/tests/__init__.py @@ -1 +0,0 @@ -"""Constants for PayPal app tests.""" diff --git a/commerce_coordinator/apps/stripe/pipeline.py b/commerce_coordinator/apps/stripe/pipeline.py index 32ed8a1e..132c7461 100644 --- a/commerce_coordinator/apps/stripe/pipeline.py +++ b/commerce_coordinator/apps/stripe/pipeline.py @@ -263,9 +263,6 @@ def run_filter( """ tag = type(self).__name__ - print('\n\n\n\n\n\nRefundPaymentIntent psp = ', psp) - print('\n\n\n\n\n\nRefundPaymentIntent payment_intent_id = ', payment_intent_id) - print('\n\n\n\n\n\nRefundPaymentIntent amount_in_cents = ', amount_in_cents) if psp != EDX_STRIPE_PAYMENT_INTERFACE_NAME or not payment_intent_id or not amount_in_cents: # pragma: no cover logger.info(f'[{tag}] payment_intent_id or amount_in_cents not set, skipping.') diff --git a/commerce_coordinator/settings/base.py b/commerce_coordinator/settings/base.py index 74b6095f..3d183c00 100644 --- a/commerce_coordinator/settings/base.py +++ b/commerce_coordinator/settings/base.py @@ -439,8 +439,8 @@ def root(*path_fragments): 'paypal': { 'user_activity_page_url': '', 'paypal_webhook_id': PAYPAL_WEBHOOK_ID, - 'client_id': 'ASoOt8z1BmLEzJGLV-N_gWP083ghlpWaj9eOj4BxQ9k8rQ-jDoSO5e_5-gRR3uzwp-hOt_YmfzKsnrFV', - 'client_secret': 'EL_StzjNHS0lUbtVLPOUxC-fa27E4x12WIAN4XRHjYNNYM3kkUNxXoaFd_XextoDC1h3TvF9vuC74J1Z', + 'client_id': '', + 'client_secret': '', }, }, } diff --git a/commerce_coordinator/settings/local.py b/commerce_coordinator/settings/local.py index 07d10cf7..ff2d1174 100644 --- a/commerce_coordinator/settings/local.py +++ b/commerce_coordinator/settings/local.py @@ -147,8 +147,8 @@ 'paypal': { 'user_activity_page_url': 'https://sandbox.paypal.com/myaccount/activities/', 'paypal_webhook_id': 'SET-ME-PLEASE', - 'client_id': 'ASoOt8z1BmLEzJGLV-N_gWP083ghlpWaj9eOj4BxQ9k8rQ-jDoSO5e_5-gRR3uzwp-hOt_YmfzKsnrFV', - 'client_secret': 'EL_StzjNHS0lUbtVLPOUxC-fa27E4x12WIAN4XRHjYNNYM3kkUNxXoaFd_XextoDC1h3TvF9vuC74J1Z', + 'client_id': '', + 'client_secret': '', }, }, } diff --git a/commerce_coordinator/settings/test.py b/commerce_coordinator/settings/test.py index 11e80417..b44ce027 100644 --- a/commerce_coordinator/settings/test.py +++ b/commerce_coordinator/settings/test.py @@ -18,6 +18,8 @@ 'paypal': { 'user_activity_page_url': 'https://test.paypal.com/myaccount/activities/', 'paypal_webhook_id': PAYPAL_WEBHOOK_ID, + 'client_id': '', + 'client_secret': '', }, }, } diff --git a/commerce_coordinator/urls.py b/commerce_coordinator/urls.py index 6bd3409b..4d5a0bc9 100644 --- a/commerce_coordinator/urls.py +++ b/commerce_coordinator/urls.py @@ -43,9 +43,6 @@ from commerce_coordinator.apps.titan import urls as titan_urls from commerce_coordinator.settings.base import FAVICON_URL -from commerce_coordinator.apps.paypal.clients import PayPalClient - -paypal_client = PayPalClient() admin.autodiscover() @@ -74,7 +71,6 @@ re_path(r'^$', lambda r: JsonResponse(data=[ "Welcome to Commerce Coordinator", "This is an API app that provides a backend for Commerce.", - str(paypal_client), ], status=status.HTTP_200_OK, safe=False), name='root'), path('favicon.ico', RedirectView.as_view(url=FAVICON_URL), name='favicon'), @@ -89,4 +85,3 @@ import debug_toolbar urlpatterns.append(re_path(r'^__debug__/', include(debug_toolbar.urls))) - diff --git a/requirements/base.in b/requirements/base.in index c9985da9..d36494ba 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -25,6 +25,7 @@ edx-rest-api-client mysqlclient openedx-filters Pillow +paypal-server-sdk==0.5.1 pytz segment-analytics-python stripe diff --git a/requirements/base.txt b/requirements/base.txt index 62ca0518..f1484a6b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -147,8 +147,6 @@ openedx-filters==1.11.0 # via -r requirements/base.in packaging==24.1 # via marshmallow -paypal-server-sdk==0.5.1 - # via -r requirements/base.in pbr==6.1.0 # via stevedore pillow==11.0.0 diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index c54963e0..f40aa200 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -1,4 +1,8 @@ + + + + # A central location for most common version constraints # (across edx repos) for pip-installation. # From 60c376b3c94b71e0ea72f521da4a8c5b9f1cf1b5 Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Wed, 18 Dec 2024 15:16:45 +0500 Subject: [PATCH 05/11] fix: fix test --- .../commercetools/catalog_info/edx_utils.py | 1 + .../apps/commercetools/pipeline.py | 4 +- .../apps/commercetools/tests/conftest.py | 1 + .../tests/sub_messages/test_tasks.py | 4 +- commerce_coordinator/urls.py | 1 - requirements/base.txt | 66 +++++--- requirements/ci.txt | 4 +- requirements/common_constraints.txt | 1 + requirements/dev.txt | 111 ++++++++----- requirements/django.txt | 2 +- requirements/doc.txt | 149 +++++++++++------- requirements/pip-tools.txt | 4 +- requirements/pip.txt | 4 +- requirements/production.txt | 80 +++++++--- requirements/quality.txt | 104 ++++++++---- requirements/test.txt | 89 ++++++++--- requirements/validation.txt | 117 +++++++++----- 17 files changed, 490 insertions(+), 252 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py index 64b6acad..36924fba 100644 --- a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py +++ b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py @@ -77,6 +77,7 @@ def get_edx_refund_info(payment: CTPayment) -> decimal: refund_amount = decimal.Decimal(0.00) interaction_id = None for transaction in payment.transactions: + if transaction.type == TransactionType.CHARGE: # pragma no cover refund_amount += decimal.Decimal(typed_money_to_string(transaction.amount, money_as_decimal_string=True)) interaction_id = transaction.interaction_id diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index 70cd3a0d..2759aa47 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -117,7 +117,7 @@ def run_filter(self, active_order_management_system, order_number, **kwargs): # ret_val = { "order_data": ct_order, "psp": psp, - "payment_intent_id": payment.interface_id + "payment_intent_id": payment.interface_id if payment else None } return ret_val @@ -298,12 +298,12 @@ class CreateReturnPaymentTransaction(PipelineStep): def run_filter( self, - refund_response, active_order_management_system, payment_data, has_been_refunded, payment_intent_id, psp, + refund_response=None, **kwargs ): # pylint: disable=arguments-differ """ diff --git a/commerce_coordinator/apps/commercetools/tests/conftest.py b/commerce_coordinator/apps/commercetools/tests/conftest.py index 61b7f639..7310ac49 100644 --- a/commerce_coordinator/apps/commercetools/tests/conftest.py +++ b/commerce_coordinator/apps/commercetools/tests/conftest.py @@ -23,6 +23,7 @@ from commercetools.platform.models import Transaction as CTTransaction from commercetools.platform.models import TransactionState, TransactionType from commercetools.platform.models import TypeReference as CTTypeReference +from commercetools.platform.models import TypedMoney as CTTypedMoney from commercetools.platform.models.state import State as CTLineItemState from commercetools.platform.models.state import StateTypeEnum as CTStateType from commercetools.testing import BackendRepository diff --git a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py index b7d88260..bd99fb6c 100644 --- a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py +++ b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py @@ -273,12 +273,14 @@ def get_uut(): # todo this flow is broken @patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order') @patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient') - def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal): + @patch.object(CommercetoolsAPIClientMock, 'payment_mock', new_callable=MagicMock) + def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal, custom_payment_mock): """ Check calling uut with mock_parameters yields call to client with expected_data. """ mock_values = self.mock + custom_payment_mock.return_value = CTPaymentByKey() ret_val = self.get_uut()(*self.unpack_for_uut(self.mock.example_payload)) diff --git a/commerce_coordinator/urls.py b/commerce_coordinator/urls.py index 4d5a0bc9..9e4fbc79 100644 --- a/commerce_coordinator/urls.py +++ b/commerce_coordinator/urls.py @@ -43,7 +43,6 @@ from commerce_coordinator.apps.titan import urls as titan_urls from commerce_coordinator.settings.base import FAVICON_URL - admin.autodiscover() urlpatterns = oauth2_urlpatterns + [ diff --git a/requirements/base.txt b/requirements/base.txt index f1484a6b..2d4b784d 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -4,22 +4,33 @@ # # make upgrade # -amqp==5.2.0 +amqp==5.3.1 # via kombu +apimatic-core==0.2.17 + # via paypal-server-sdk +apimatic-core-interfaces==0.1.5 + # via + # apimatic-core + # apimatic-requests-client-adapter + # paypal-server-sdk +apimatic-requests-client-adapter==0.1.6 + # via paypal-server-sdk asgiref==3.7.2 # via # -r requirements/base.in # django # django-cors-headers -attrs==24.2.0 +attrs==24.3.0 # via -r requirements/base.in backoff==2.2.1 # via segment-analytics-python billiard==4.2.1 # via celery +cachecontrol==0.12.14 + # via apimatic-requests-client-adapter celery[redis]==5.4.0 # via -r requirements/base.in -certifi==2024.8.30 +certifi==2024.12.14 # via requests cffi==1.17.1 # via @@ -48,7 +59,7 @@ coreapi==2.3.3 # openapi-codec coreschema==0.0.4 # via coreapi -cryptography==43.0.3 +cryptography==44.0.0 # via # pyjwt # social-auth-core @@ -58,7 +69,7 @@ defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core -django==4.2.16 +django==4.2.17 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt @@ -83,7 +94,7 @@ django-extensions==3.2.3 # via -r requirements/base.in django-rest-swagger==2.2.0 # via -r requirements/base.in -django-waffle==4.1.0 +django-waffle==4.2.0 # via # -r requirements/base.in # edx-django-utils @@ -104,7 +115,7 @@ edx-braze-client==0.2.5 # via -r requirements/base.in edx-django-release-util==1.4.0 # via -r requirements/base.in -edx-django-utils==7.0.0 +edx-django-utils==7.1.0 # via # -r requirements/base.in # edx-drf-extensions @@ -121,21 +132,27 @@ itypes==1.2.0 # via coreapi jinja2==3.1.4 # via coreschema +jsonpickle==3.3.0 + # via apimatic-core +jsonpointer==2.4 + # via apimatic-core kombu==5.4.2 # via celery markupsafe==3.0.2 # via # jinja2 # werkzeug -marshmallow==3.23.0 +marshmallow==3.23.1 # via # commercetools # marshmallow-enum marshmallow-enum==1.5.1 # via commercetools -mysqlclient==2.2.5 +msgpack==1.1.0 + # via cachecontrol +mysqlclient==2.2.6 # via -r requirements/base.in -newrelic==10.2.0 +newrelic==10.4.0 # via edx-django-utils oauthlib==3.2.2 # via @@ -143,10 +160,12 @@ oauthlib==3.2.2 # social-auth-core openapi-codec==1.3.2 # via django-rest-swagger -openedx-filters==1.11.0 +openedx-filters==1.12.0 # via -r requirements/base.in -packaging==24.1 +packaging==24.2 # via marshmallow +paypal-server-sdk==0.5.1 + # via -r requirements/base.in pbr==6.1.0 # via stevedore pillow==11.0.0 @@ -157,7 +176,7 @@ psutil==6.1.0 # via edx-django-utils pycparser==2.22 # via cffi -pyjwt[crypto]==2.9.0 +pyjwt[crypto]==2.10.1 # via # drf-jwt # edx-auth-backends @@ -172,6 +191,7 @@ pynacl==1.5.0 python-dateutil==2.9.0.post0 # via # -r requirements/base.in + # apimatic-core # celery # segment-analytics-python python3-openid==3.2.0 @@ -182,10 +202,13 @@ pytz==2024.2 # commercetools pyyaml==6.0.2 # via edx-django-release-util -redis==5.2.0 +redis==5.2.1 # via celery requests==2.32.3 # via + # apimatic-core + # apimatic-requests-client-adapter + # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -207,7 +230,7 @@ semantic-version==2.10.0 # via edx-drf-extensions simplejson==3.19.3 # via django-rest-swagger -six==1.16.0 +six==1.17.0 # via # edx-auth-backends # edx-django-release-util @@ -218,13 +241,13 @@ social-auth-core==4.5.4 # via # edx-auth-backends # social-auth-app-django -sqlparse==0.5.1 +sqlparse==0.5.3 # via django -stevedore==5.3.0 +stevedore==5.4.0 # via # edx-django-utils # edx-opaque-keys -stripe==11.2.0 +stripe==11.3.0 # via -r requirements/base.in typing-extensions==4.12.2 # via @@ -247,7 +270,10 @@ wcwidth==0.2.13 # via prompt-toolkit webob==1.8.9 # via commercetools -werkzeug==3.0.6 +werkzeug==3.1.3 # via commercetools -wrapt==1.16.0 +wrapt==1.17.0 # via commercetools + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/ci.txt b/requirements/ci.txt index dc61486c..8ec4e7c2 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -16,7 +16,7 @@ filelock==3.16.1 # via # tox # virtualenv -packaging==24.1 +packaging==24.2 # via # pyproject-api # tox @@ -30,5 +30,5 @@ pyproject-api==1.8.0 # via tox tox==4.23.2 # via -r requirements/ci.in -virtualenv==20.27.1 +virtualenv==20.28.0 # via tox diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index f40aa200..5863251e 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -3,6 +3,7 @@ + # A central location for most common version constraints # (across edx repos) for pip-installation. # diff --git a/requirements/dev.txt b/requirements/dev.txt index 5cb7e1a7..84972329 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,21 +4,35 @@ # # make upgrade # -amqp==5.2.0 +amqp==5.3.1 # via # -r requirements/validation.txt # kombu +apimatic-core==0.2.17 + # via + # -r requirements/validation.txt + # paypal-server-sdk +apimatic-core-interfaces==0.1.5 + # via + # -r requirements/validation.txt + # apimatic-core + # apimatic-requests-client-adapter + # paypal-server-sdk +apimatic-requests-client-adapter==0.1.6 + # via + # -r requirements/validation.txt + # paypal-server-sdk asgiref==3.7.2 # via # -r requirements/validation.txt # django # django-cors-headers -astroid==3.3.5 +astroid==3.3.6 # via # -r requirements/validation.txt # pylint # pylint-celery -attrs==24.2.0 +attrs==24.3.0 # via -r requirements/validation.txt backoff==2.2.1 # via @@ -32,13 +46,17 @@ build==1.2.2.post1 # via # -r requirements/pip-tools.txt # pip-tools +cachecontrol==0.12.14 + # via + # -r requirements/validation.txt + # apimatic-requests-client-adapter cachetools==5.5.0 # via # -r requirements/validation.txt # tox celery[redis]==5.4.0 # via -r requirements/validation.txt -certifi==2024.8.30 +certifi==2024.12.14 # via # -r requirements/validation.txt # requests @@ -85,7 +103,7 @@ click-repl==0.3.0 # via # -r requirements/validation.txt # celery -code-annotations==1.8.0 +code-annotations==2.1.0 # via # -r requirements/validation.txt # edx-lint @@ -104,11 +122,11 @@ coreschema==0.0.4 # via # -r requirements/validation.txt # coreapi -coverage[toml]==7.6.4 +coverage[toml]==7.6.9 # via # -r requirements/validation.txt # pytest-cov -cryptography==43.0.3 +cryptography==44.0.0 # via # -r requirements/validation.txt # pyjwt @@ -122,7 +140,7 @@ defusedxml==0.8.0rc2 # -r requirements/validation.txt # python3-openid # social-auth-core -diff-cover==9.2.0 +diff-cover==9.2.1 # via -r requirements/dev.in dill==0.3.9 # via @@ -132,7 +150,7 @@ distlib==0.3.9 # via # -r requirements/validation.txt # virtualenv -django==4.2.16 +django==4.2.17 # via # -r requirements/validation.txt # django-cors-headers @@ -165,7 +183,7 @@ django-extensions==3.2.3 # via -r requirements/validation.txt django-rest-swagger==2.2.0 # via -r requirements/validation.txt -django-waffle==4.1.0 +django-waffle==4.2.0 # via # -r requirements/validation.txt # edx-django-utils @@ -194,7 +212,7 @@ edx-braze-client==0.2.5 # via -r requirements/validation.txt edx-django-release-util==1.4.0 # via -r requirements/validation.txt -edx-django-utils==7.0.0 +edx-django-utils==7.1.0 # via # -r requirements/validation.txt # edx-drf-extensions @@ -220,10 +238,6 @@ idna==3.10 # via # -r requirements/validation.txt # requests -importlib-metadata==8.5.0 - # via - # -r requirements/validation.txt - # twine iniconfig==2.0.0 # via # -r requirements/validation.txt @@ -254,6 +268,14 @@ jinja2==3.1.4 # code-annotations # coreschema # diff-cover +jsonpickle==3.3.0 + # via + # -r requirements/validation.txt + # apimatic-core +jsonpointer==2.4 + # via + # -r requirements/validation.txt + # apimatic-core keyring==25.5.0 # via # -r requirements/validation.txt @@ -266,7 +288,7 @@ lxml[html-clean,html_clean]==5.3.0 # via # edx-i18n-tools # lxml-html-clean -lxml-html-clean==0.3.1 +lxml-html-clean==0.4.1 # via lxml markdown-it-py==3.0.0 # via @@ -277,7 +299,7 @@ markupsafe==3.0.2 # -r requirements/validation.txt # jinja2 # werkzeug -marshmallow==3.23.0 +marshmallow==3.23.1 # via # -r requirements/validation.txt # commercetools @@ -301,13 +323,17 @@ more-itertools==10.5.0 # -r requirements/validation.txt # jaraco-classes # jaraco-functools -mysqlclient==2.2.5 +msgpack==1.1.0 + # via + # -r requirements/validation.txt + # cachecontrol +mysqlclient==2.2.6 # via -r requirements/validation.txt -newrelic==10.2.0 +newrelic==10.4.0 # via # -r requirements/validation.txt # edx-django-utils -nh3==0.2.18 +nh3==0.2.20 # via # -r requirements/validation.txt # readme-renderer @@ -320,9 +346,9 @@ openapi-codec==1.3.2 # via # -r requirements/validation.txt # django-rest-swagger -openedx-filters==1.11.0 +openedx-filters==1.12.0 # via -r requirements/validation.txt -packaging==24.1 +packaging==24.2 # via # -r requirements/pip-tools.txt # -r requirements/validation.txt @@ -331,8 +357,11 @@ packaging==24.1 # pyproject-api # pytest # tox + # twine path==16.16.0 # via edx-i18n-tools +paypal-server-sdk==0.5.1 + # via -r requirements/validation.txt pbr==6.1.0 # via # -r requirements/validation.txt @@ -341,7 +370,7 @@ pillow==11.0.0 # via -r requirements/validation.txt pip-tools==7.4.1 # via -r requirements/pip-tools.txt -pkginfo==1.10.0 +pkginfo==1.12.0 # via # -r requirements/validation.txt # twine @@ -381,7 +410,7 @@ pygments==2.18.0 # diff-cover # readme-renderer # rich -pyjwt[crypto]==2.9.0 +pyjwt[crypto]==2.10.1 # via # -r requirements/validation.txt # drf-jwt @@ -390,7 +419,7 @@ pyjwt[crypto]==2.9.0 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.1 +pylint==3.3.2 # via # -r requirements/validation.txt # edx-lint @@ -427,7 +456,7 @@ pyproject-hooks==1.2.0 # -r requirements/pip-tools.txt # build # pip-tools -pytest==8.3.3 +pytest==8.3.4 # via # -r requirements/validation.txt # pytest-cov @@ -439,6 +468,7 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/validation.txt + # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -464,13 +494,16 @@ readme-renderer==44.0 # via # -r requirements/validation.txt # twine -redis==5.2.0 +redis==5.2.1 # via # -r requirements/validation.txt # celery requests==2.32.3 # via # -r requirements/validation.txt + # apimatic-core + # apimatic-requests-client-adapter + # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -502,7 +535,7 @@ rfc3986==2.0.0 # via # -r requirements/validation.txt # twine -rich==13.9.3 +rich==13.9.4 # via # -r requirements/validation.txt # twine @@ -516,7 +549,7 @@ simplejson==3.19.3 # via # -r requirements/validation.txt # django-rest-swagger -six==1.16.0 +six==1.17.0 # via # -r requirements/validation.txt # edx-auth-backends @@ -536,18 +569,18 @@ social-auth-core==4.5.4 # -r requirements/validation.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.1 +sqlparse==0.5.3 # via # -r requirements/validation.txt # django # django-debug-toolbar -stevedore==5.3.0 +stevedore==5.4.0 # via # -r requirements/validation.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.2.0 +stripe==11.3.0 # via -r requirements/validation.txt testfixtures==8.3.0 # via -r requirements/validation.txt @@ -561,7 +594,7 @@ tomlkit==0.13.2 # pylint tox==4.23.2 # via -r requirements/validation.txt -twine==5.1.1 +twine==6.0.1 # via -r requirements/validation.txt typing-extensions==4.12.2 # via @@ -589,7 +622,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.27.1 +virtualenv==20.28.0 # via # -r requirements/validation.txt # tox @@ -601,22 +634,18 @@ webob==1.8.9 # via # -r requirements/validation.txt # commercetools -werkzeug==3.0.6 +werkzeug==3.1.3 # via # -r requirements/validation.txt # commercetools -wheel==0.44.0 +wheel==0.45.1 # via # -r requirements/pip-tools.txt # pip-tools -wrapt==1.16.0 +wrapt==1.17.0 # via # -r requirements/validation.txt # commercetools -zipp==3.20.2 - # via - # -r requirements/validation.txt - # importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/django.txt b/requirements/django.txt index 64aaf996..ebf97308 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==4.2.16 +django==4.2.17 diff --git a/requirements/doc.txt b/requirements/doc.txt index b37232a4..47f26dfa 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -2,52 +2,69 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile --output-file=requirements/doc.txt requirements/doc.in +# make upgrade # -alabaster==0.7.16 -accessible-pygments==0.0.4 +accessible-pygments==0.0.5 # via pydata-sphinx-theme +alabaster==1.0.0 # via sphinx -amqp==5.2.0 +amqp==5.3.1 # via # -r requirements/test.txt # kombu +apimatic-core==0.2.17 + # via + # -r requirements/test.txt + # paypal-server-sdk +apimatic-core-interfaces==0.1.5 + # via + # -r requirements/test.txt + # apimatic-core + # apimatic-requests-client-adapter + # paypal-server-sdk +apimatic-requests-client-adapter==0.1.6 + # via + # -r requirements/test.txt + # paypal-server-sdk asgiref==3.7.2 # via # -r requirements/test.txt # django # django-cors-headers -astroid==3.3.5 +astroid==3.3.6 # via # -r requirements/test.txt # pylint # pylint-celery -attrs==24.2.0 +attrs==24.3.0 # via -r requirements/test.txt babel==2.16.0 - # via sphinx - # pydata-sphinx-theme + # via + # pydata-sphinx-theme + # sphinx backoff==2.2.1 # via # -r requirements/test.txt # segment-analytics-python +beautifulsoup4==4.12.3 + # via pydata-sphinx-theme billiard==4.2.1 # via # -r requirements/test.txt # celery build==1.2.2.post1 - # django - # djangorestframework - # kombu -beautifulsoup4==4.12.3 - # via pydata-sphinx-theme + # via -r requirements/doc.in +cachecontrol==0.12.14 + # via + # -r requirements/test.txt + # apimatic-requests-client-adapter cachetools==5.5.0 # via # -r requirements/test.txt # tox celery[redis]==5.4.0 # via -r requirements/test.txt -certifi==2024.8.30 +certifi==2024.12.14 # via # -r requirements/test.txt # requests @@ -91,7 +108,7 @@ click-repl==0.3.0 # via # -r requirements/test.txt # celery -code-annotations==1.8.0 +code-annotations==2.1.0 # via # -r requirements/test.txt # edx-lint @@ -110,11 +127,11 @@ coreschema==0.0.4 # via # -r requirements/test.txt # coreapi -coverage[toml]==7.6.4 +coverage[toml]==7.6.9 # via # -r requirements/test.txt # pytest-cov -cryptography==43.0.3 +cryptography==44.0.0 # via # -r requirements/test.txt # pyjwt @@ -136,10 +153,11 @@ distlib==0.3.9 # via # -r requirements/test.txt # virtualenv -django==4.2.16 +django==4.2.17 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt + # -r requirements/test.txt # django-cors-headers # django-crum # django-extensions @@ -164,7 +182,7 @@ django-extensions==3.2.3 # via -r requirements/test.txt django-rest-swagger==2.2.0 # via -r requirements/test.txt -django-waffle==4.1.0 +django-waffle==4.2.0 # via # -r requirements/test.txt # edx-django-utils @@ -181,7 +199,7 @@ dnspython==2.7.0 # pymongo doc8==1.1.2 # via -r requirements/doc.in -docutils==0.19 +docutils==0.21.2 # via # doc8 # pydata-sphinx-theme @@ -198,7 +216,7 @@ edx-braze-client==0.2.5 # via -r requirements/test.txt edx-django-release-util==1.4.0 # via -r requirements/test.txt -edx-django-utils==7.0.0 +edx-django-utils==7.1.0 # via # -r requirements/test.txt # edx-drf-extensions @@ -213,12 +231,6 @@ edx-opaque-keys==2.11.0 # edx-drf-extensions edx-rest-api-client==6.0.0 # via -r requirements/test.txt -edx-sphinx-theme==3.1.0 - # via -r requirements/doc.in -exceptiongroup==1.2.1 - # via - # -r requirements/test.txt - # pytest filelock==3.16.1 # via # -r requirements/test.txt @@ -230,8 +242,6 @@ idna==3.10 # requests imagesize==1.4.1 # via sphinx -importlib-metadata==8.5.0 - # via twine iniconfig==2.0.0 # via # -r requirements/test.txt @@ -256,6 +266,14 @@ jinja2==3.1.4 # code-annotations # coreschema # sphinx +jsonpickle==3.3.0 + # via + # -r requirements/test.txt + # apimatic-core +jsonpointer==2.4 + # via + # -r requirements/test.txt + # apimatic-core keyring==25.5.0 # via twine kombu==5.4.2 @@ -269,7 +287,7 @@ markupsafe==3.0.2 # -r requirements/test.txt # jinja2 # werkzeug -marshmallow==3.23.0 +marshmallow==3.23.1 # via # -r requirements/test.txt # commercetools @@ -290,13 +308,17 @@ more-itertools==10.5.0 # via # jaraco-classes # jaraco-functools -mysqlclient==2.2.5 +msgpack==1.1.0 + # via + # -r requirements/test.txt + # cachecontrol +mysqlclient==2.2.6 # via -r requirements/test.txt -newrelic==10.2.0 +newrelic==10.4.0 # via # -r requirements/test.txt # edx-django-utils -nh3==0.2.18 +nh3==0.2.20 # via readme-renderer oauthlib==3.2.2 # via @@ -307,25 +329,27 @@ openapi-codec==1.3.2 # via # -r requirements/test.txt # django-rest-swagger -openedx-filters==1.11.0 +openedx-filters==1.12.0 # via -r requirements/test.txt -packaging==24.1 +packaging==24.2 # via # -r requirements/test.txt # build # marshmallow - # pydata-sphinx-theme # pyproject-api # pytest # sphinx # tox + # twine +paypal-server-sdk==0.5.1 + # via -r requirements/test.txt pbr==6.1.0 # via # -r requirements/test.txt # stevedore pillow==11.0.0 # via -r requirements/test.txt -pkginfo==1.10.0 +pkginfo==1.12.0 # via twine platformdirs==4.3.6 # via @@ -350,7 +374,7 @@ pycparser==2.22 # via # -r requirements/test.txt # cffi -pydata-sphinx-theme==0.14.4 +pydata-sphinx-theme==0.16.1 # via sphinx-book-theme pygments==2.18.0 # via @@ -360,7 +384,7 @@ pygments==2.18.0 # readme-renderer # rich # sphinx -pyjwt[crypto]==2.9.0 +pyjwt[crypto]==2.10.1 # via # -r requirements/test.txt # drf-jwt @@ -369,7 +393,7 @@ pyjwt[crypto]==2.9.0 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.1 +pylint==3.3.2 # via # -r requirements/test.txt # edx-lint @@ -403,7 +427,7 @@ pyproject-api==1.8.0 # tox pyproject-hooks==1.2.0 # via build -pytest==8.3.3 +pytest==8.3.4 # via # -r requirements/test.txt # pytest-cov @@ -415,6 +439,7 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/test.txt + # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -435,15 +460,18 @@ pyyaml==6.0.2 # code-annotations # edx-django-release-util # responses -readme-renderer==43.0 +readme-renderer==44.0 # via twine -redis==5.2.0 +redis==5.2.1 # via # -r requirements/test.txt # celery requests==2.32.3 # via # -r requirements/test.txt + # apimatic-core + # apimatic-requests-client-adapter + # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -474,7 +502,7 @@ restructuredtext-lint==1.4.0 # via doc8 rfc3986==2.0.0 # via twine -rich==13.9.3 +rich==13.9.4 # via twine segment-analytics-python==2.3.3 # via -r requirements/test.txt @@ -486,7 +514,7 @@ simplejson==3.19.3 # via # -r requirements/test.txt # django-rest-swagger -six==1.16.0 +six==1.17.0 # via # -r requirements/test.txt # edx-auth-backends @@ -504,16 +532,17 @@ social-auth-core==4.5.4 # -r requirements/test.txt # edx-auth-backends # social-auth-app-django -soupsieve==2.5 +soupsieve==2.6 # via beautifulsoup4 -sphinx==5.3.0 +sphinx==8.1.3 # via # -r requirements/doc.in -sphinxcontrib-applehelp==2.0.0 # pydata-sphinx-theme # sphinx-book-theme -sphinx-book-theme==1.0.1 +sphinx-book-theme==1.1.3 # via -r requirements/doc.in +sphinxcontrib-applehelp==2.0.0 + # via sphinx sphinxcontrib-devhelp==2.0.0 # via sphinx sphinxcontrib-htmlhelp==2.1.0 @@ -524,18 +553,18 @@ sphinxcontrib-qthelp==2.0.0 # via sphinx sphinxcontrib-serializinghtml==2.0.0 # via sphinx -sqlparse==0.5.1 +sqlparse==0.5.3 # via # -r requirements/test.txt # django -stevedore==5.3.0 +stevedore==5.4.0 # via # -r requirements/test.txt # code-annotations # doc8 # edx-django-utils # edx-opaque-keys -stripe==11.2.0 +stripe==11.3.0 # via -r requirements/test.txt testfixtures==8.3.0 # via -r requirements/test.txt @@ -549,16 +578,13 @@ tomlkit==0.13.2 # pylint tox==4.23.2 # via -r requirements/test.txt -twine==5.1.1 +twine==6.0.1 # via -r requirements/doc.in typing-extensions==4.12.2 # via # -r requirements/test.txt # edx-opaque-keys - # kombu # pydata-sphinx-theme - # pylint - # rich # stripe tzdata==2024.2 # via @@ -581,7 +607,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.27.1 +virtualenv==20.28.0 # via # -r requirements/test.txt # tox @@ -593,13 +619,14 @@ webob==1.8.9 # via # -r requirements/test.txt # commercetools -werkzeug==3.0.6 +werkzeug==3.1.3 # via # -r requirements/test.txt # commercetools -wrapt==1.16.0 +wrapt==1.17.0 # via # -r requirements/test.txt # commercetools -zipp==3.20.2 - # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index cf4131e2..154dd417 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -8,7 +8,7 @@ build==1.2.2.post1 # via pip-tools click==8.1.7 # via pip-tools -packaging==24.1 +packaging==24.2 # via build pip-tools==7.4.1 # via -r requirements/pip-tools.in @@ -16,7 +16,7 @@ pyproject-hooks==1.2.0 # via # build # pip-tools -wheel==0.44.0 +wheel==0.45.1 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/pip.txt b/requirements/pip.txt index a8a601eb..72284813 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -4,7 +4,7 @@ # # make upgrade # -wheel==0.44.0 +wheel==0.45.1 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: @@ -12,5 +12,5 @@ pip==24.2 # via # -c requirements/common_constraints.txt # -r requirements/pip.in -setuptools==75.2.0 +setuptools==75.6.0 # via -r requirements/pip.in diff --git a/requirements/production.txt b/requirements/production.txt index e55689f7..b555daba 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -4,16 +4,30 @@ # # make upgrade # -amqp==5.2.0 +amqp==5.3.1 # via # -r requirements/base.txt # kombu +apimatic-core==0.2.17 + # via + # -r requirements/base.txt + # paypal-server-sdk +apimatic-core-interfaces==0.1.5 + # via + # -r requirements/base.txt + # apimatic-core + # apimatic-requests-client-adapter + # paypal-server-sdk +apimatic-requests-client-adapter==0.1.6 + # via + # -r requirements/base.txt + # paypal-server-sdk asgiref==3.7.2 # via # -r requirements/base.txt # django # django-cors-headers -attrs==24.2.0 +attrs==24.3.0 # via -r requirements/base.txt backoff==2.2.1 # via @@ -23,9 +37,13 @@ billiard==4.2.1 # via # -r requirements/base.txt # celery +cachecontrol==0.12.14 + # via + # -r requirements/base.txt + # apimatic-requests-client-adapter celery[redis]==5.4.0 # via -r requirements/base.txt -certifi==2024.8.30 +certifi==2024.12.14 # via # -r requirements/base.txt # requests @@ -69,7 +87,7 @@ coreschema==0.0.4 # via # -r requirements/base.txt # coreapi -cryptography==43.0.3 +cryptography==44.0.0 # via # -r requirements/base.txt # pyjwt @@ -81,7 +99,7 @@ defusedxml==0.8.0rc2 # -r requirements/base.txt # python3-openid # social-auth-core -django==4.2.16 +django==4.2.17 # via # -r requirements/base.txt # django-cors-headers @@ -106,7 +124,7 @@ django-extensions==3.2.3 # via -r requirements/base.txt django-rest-swagger==2.2.0 # via -r requirements/base.txt -django-waffle==4.1.0 +django-waffle==4.2.0 # via # -r requirements/base.txt # edx-django-utils @@ -131,7 +149,7 @@ edx-braze-client==0.2.5 # via -r requirements/base.txt edx-django-release-util==1.4.0 # via -r requirements/base.txt -edx-django-utils==7.0.0 +edx-django-utils==7.1.0 # via # -r requirements/base.txt # edx-drf-extensions @@ -144,7 +162,7 @@ edx-opaque-keys==2.11.0 # edx-drf-extensions edx-rest-api-client==6.0.0 # via -r requirements/base.txt -gevent==24.10.3 +gevent==24.11.1 # via -r requirements/production.in greenlet==3.1.1 # via gevent @@ -162,6 +180,14 @@ jinja2==3.1.4 # via # -r requirements/base.txt # coreschema +jsonpickle==3.3.0 + # via + # -r requirements/base.txt + # apimatic-core +jsonpointer==2.4 + # via + # -r requirements/base.txt + # apimatic-core kombu==5.4.2 # via # -r requirements/base.txt @@ -171,7 +197,7 @@ markupsafe==3.0.2 # -r requirements/base.txt # jinja2 # werkzeug -marshmallow==3.23.0 +marshmallow==3.23.1 # via # -r requirements/base.txt # commercetools @@ -180,11 +206,15 @@ marshmallow-enum==1.5.1 # via # -r requirements/base.txt # commercetools -mysqlclient==2.2.5 +msgpack==1.1.0 + # via + # -r requirements/base.txt + # cachecontrol +mysqlclient==2.2.6 # via # -r requirements/base.txt # -r requirements/production.in -newrelic==10.2.0 +newrelic==10.4.0 # via # -r requirements/base.txt # edx-django-utils @@ -197,13 +227,15 @@ openapi-codec==1.3.2 # via # -r requirements/base.txt # django-rest-swagger -openedx-filters==1.11.0 +openedx-filters==1.12.0 # via -r requirements/base.txt -packaging==24.1 +packaging==24.2 # via # -r requirements/base.txt # gunicorn # marshmallow +paypal-server-sdk==0.5.1 + # via -r requirements/base.txt pbr==6.1.0 # via # -r requirements/base.txt @@ -222,7 +254,7 @@ pycparser==2.22 # via # -r requirements/base.txt # cffi -pyjwt[crypto]==2.9.0 +pyjwt[crypto]==2.10.1 # via # -r requirements/base.txt # drf-jwt @@ -244,6 +276,7 @@ pynacl==1.5.0 python-dateutil==2.9.0.post0 # via # -r requirements/base.txt + # apimatic-core # celery # segment-analytics-python python3-openid==3.2.0 @@ -259,13 +292,16 @@ pyyaml==6.0.2 # -r requirements/base.txt # -r requirements/production.in # edx-django-release-util -redis==5.2.0 +redis==5.2.1 # via # -r requirements/base.txt # celery requests==2.32.3 # via # -r requirements/base.txt + # apimatic-core + # apimatic-requests-client-adapter + # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -294,7 +330,7 @@ simplejson==3.19.3 # via # -r requirements/base.txt # django-rest-swagger -six==1.16.0 +six==1.17.0 # via # -r requirements/base.txt # edx-auth-backends @@ -309,16 +345,16 @@ social-auth-core==4.5.4 # -r requirements/base.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.1 +sqlparse==0.5.3 # via # -r requirements/base.txt # django -stevedore==5.3.0 +stevedore==5.4.0 # via # -r requirements/base.txt # edx-django-utils # edx-opaque-keys -stripe==11.2.0 +stripe==11.3.0 # via -r requirements/base.txt typing-extensions==4.12.2 # via @@ -352,17 +388,17 @@ webob==1.8.9 # via # -r requirements/base.txt # commercetools -werkzeug==3.0.6 +werkzeug==3.1.3 # via # -r requirements/base.txt # commercetools -wrapt==1.16.0 +wrapt==1.17.0 # via # -r requirements/base.txt # commercetools zope-event==5.0 # via gevent -zope-interface==7.1.1 +zope-interface==7.2 # via gevent # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/quality.txt b/requirements/quality.txt index 252fe212..cac6239b 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -4,21 +4,35 @@ # # make upgrade # -amqp==5.2.0 +amqp==5.3.1 # via # -r requirements/test.txt # kombu +apimatic-core==0.2.17 + # via + # -r requirements/test.txt + # paypal-server-sdk +apimatic-core-interfaces==0.1.5 + # via + # -r requirements/test.txt + # apimatic-core + # apimatic-requests-client-adapter + # paypal-server-sdk +apimatic-requests-client-adapter==0.1.6 + # via + # -r requirements/test.txt + # paypal-server-sdk asgiref==3.7.2 # via # -r requirements/test.txt # django # django-cors-headers -astroid==3.3.5 +astroid==3.3.6 # via # -r requirements/test.txt # pylint # pylint-celery -attrs==24.2.0 +attrs==24.3.0 # via -r requirements/test.txt backoff==2.2.1 # via @@ -28,13 +42,17 @@ billiard==4.2.1 # via # -r requirements/test.txt # celery +cachecontrol==0.12.14 + # via + # -r requirements/test.txt + # apimatic-requests-client-adapter cachetools==5.5.0 # via # -r requirements/test.txt # tox celery[redis]==5.4.0 # via -r requirements/test.txt -certifi==2024.8.30 +certifi==2024.12.14 # via # -r requirements/test.txt # requests @@ -78,7 +96,7 @@ click-repl==0.3.0 # via # -r requirements/test.txt # celery -code-annotations==1.8.0 +code-annotations==2.1.0 # via # -r requirements/test.txt # edx-lint @@ -97,11 +115,11 @@ coreschema==0.0.4 # via # -r requirements/test.txt # coreapi -coverage[toml]==7.6.4 +coverage[toml]==7.6.9 # via # -r requirements/test.txt # pytest-cov -cryptography==43.0.3 +cryptography==44.0.0 # via # -r requirements/test.txt # pyjwt @@ -123,7 +141,7 @@ distlib==0.3.9 # via # -r requirements/test.txt # virtualenv -django==4.2.16 +django==4.2.17 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt @@ -155,7 +173,7 @@ django-extensions==3.2.3 # via -r requirements/test.txt django-rest-swagger==2.2.0 # via -r requirements/test.txt -django-waffle==4.1.0 +django-waffle==4.2.0 # via # -r requirements/test.txt # edx-django-utils @@ -182,7 +200,7 @@ edx-braze-client==0.2.5 # via -r requirements/test.txt edx-django-release-util==1.4.0 # via -r requirements/test.txt -edx-django-utils==7.0.0 +edx-django-utils==7.1.0 # via # -r requirements/test.txt # edx-drf-extensions @@ -208,8 +226,6 @@ idna==3.10 # via # -r requirements/test.txt # requests -importlib-metadata==8.5.0 - # via twine iniconfig==2.0.0 # via # -r requirements/test.txt @@ -234,6 +250,14 @@ jinja2==3.1.4 # -r requirements/test.txt # code-annotations # coreschema +jsonpickle==3.3.0 + # via + # -r requirements/test.txt + # apimatic-core +jsonpointer==2.4 + # via + # -r requirements/test.txt + # apimatic-core keyring==25.5.0 # via twine kombu==5.4.2 @@ -247,7 +271,7 @@ markupsafe==3.0.2 # -r requirements/test.txt # jinja2 # werkzeug -marshmallow==3.23.0 +marshmallow==3.23.1 # via # -r requirements/test.txt # commercetools @@ -268,13 +292,17 @@ more-itertools==10.5.0 # via # jaraco-classes # jaraco-functools -mysqlclient==2.2.5 +msgpack==1.1.0 + # via + # -r requirements/test.txt + # cachecontrol +mysqlclient==2.2.6 # via -r requirements/test.txt -newrelic==10.2.0 +newrelic==10.4.0 # via # -r requirements/test.txt # edx-django-utils -nh3==0.2.18 +nh3==0.2.20 # via readme-renderer oauthlib==3.2.2 # via @@ -285,22 +313,25 @@ openapi-codec==1.3.2 # via # -r requirements/test.txt # django-rest-swagger -openedx-filters==1.11.0 +openedx-filters==1.12.0 # via -r requirements/test.txt -packaging==24.1 +packaging==24.2 # via # -r requirements/test.txt # marshmallow # pyproject-api # pytest # tox + # twine +paypal-server-sdk==0.5.1 + # via -r requirements/test.txt pbr==6.1.0 # via # -r requirements/test.txt # stevedore pillow==11.0.0 # via -r requirements/test.txt -pkginfo==1.10.0 +pkginfo==1.12.0 # via twine platformdirs==4.3.6 # via @@ -333,7 +364,7 @@ pygments==2.18.0 # via # readme-renderer # rich -pyjwt[crypto]==2.9.0 +pyjwt[crypto]==2.10.1 # via # -r requirements/test.txt # drf-jwt @@ -342,7 +373,7 @@ pyjwt[crypto]==2.9.0 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.1 +pylint==3.3.2 # via # -r requirements/test.txt # edx-lint @@ -374,7 +405,7 @@ pyproject-api==1.8.0 # via # -r requirements/test.txt # tox -pytest==8.3.3 +pytest==8.3.4 # via # -r requirements/test.txt # pytest-cov @@ -386,6 +417,7 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/test.txt + # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -408,13 +440,16 @@ pyyaml==6.0.2 # responses readme-renderer==44.0 # via twine -redis==5.2.0 +redis==5.2.1 # via # -r requirements/test.txt # celery requests==2.32.3 # via # -r requirements/test.txt + # apimatic-core + # apimatic-requests-client-adapter + # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -442,7 +477,7 @@ responses==0.25.3 # via -r requirements/test.txt rfc3986==2.0.0 # via twine -rich==13.9.3 +rich==13.9.4 # via twine segment-analytics-python==2.3.3 # via -r requirements/test.txt @@ -454,7 +489,7 @@ simplejson==3.19.3 # via # -r requirements/test.txt # django-rest-swagger -six==1.16.0 +six==1.17.0 # via # -r requirements/test.txt # edx-auth-backends @@ -472,18 +507,18 @@ social-auth-core==4.5.4 # -r requirements/test.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.1 +sqlparse==0.5.3 # via # -r requirements/test.txt # django # django-debug-toolbar -stevedore==5.3.0 +stevedore==5.4.0 # via # -r requirements/test.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.2.0 +stripe==11.3.0 # via -r requirements/test.txt testfixtures==8.3.0 # via -r requirements/test.txt @@ -497,7 +532,7 @@ tomlkit==0.13.2 # pylint tox==4.23.2 # via -r requirements/test.txt -twine==5.1.1 +twine==6.0.1 # via -r requirements/quality.in typing-extensions==4.12.2 # via @@ -525,7 +560,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.27.1 +virtualenv==20.28.0 # via # -r requirements/test.txt # tox @@ -537,13 +572,14 @@ webob==1.8.9 # via # -r requirements/test.txt # commercetools -werkzeug==3.0.6 +werkzeug==3.1.3 # via # -r requirements/test.txt # commercetools -wrapt==1.16.0 +wrapt==1.17.0 # via # -r requirements/test.txt # commercetools -zipp==3.20.2 - # via importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/test.txt b/requirements/test.txt index 1ad7269b..e0b04297 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -4,20 +4,34 @@ # # make upgrade # -amqp==5.2.0 +amqp==5.3.1 # via # -r requirements/base.txt # kombu +apimatic-core==0.2.17 + # via + # -r requirements/base.txt + # paypal-server-sdk +apimatic-core-interfaces==0.1.5 + # via + # -r requirements/base.txt + # apimatic-core + # apimatic-requests-client-adapter + # paypal-server-sdk +apimatic-requests-client-adapter==0.1.6 + # via + # -r requirements/base.txt + # paypal-server-sdk asgiref==3.7.2 # via # -r requirements/base.txt # django # django-cors-headers -astroid==3.3.5 +astroid==3.3.6 # via # pylint # pylint-celery -attrs==24.2.0 +attrs==24.3.0 # via -r requirements/base.txt backoff==2.2.1 # via @@ -27,11 +41,15 @@ billiard==4.2.1 # via # -r requirements/base.txt # celery +cachecontrol==0.12.14 + # via + # -r requirements/base.txt + # apimatic-requests-client-adapter cachetools==5.5.0 # via tox celery[redis]==5.4.0 # via -r requirements/base.txt -certifi==2024.8.30 +certifi==2024.12.14 # via # -r requirements/base.txt # requests @@ -71,7 +89,7 @@ click-repl==0.3.0 # via # -r requirements/base.txt # celery -code-annotations==1.8.0 +code-annotations==2.1.0 # via # -r requirements/test.in # edx-lint @@ -88,11 +106,11 @@ coreschema==0.0.4 # via # -r requirements/base.txt # coreapi -coverage[toml]==7.6.4 +coverage[toml]==7.6.9 # via # -r requirements/test.in # pytest-cov -cryptography==43.0.3 +cryptography==44.0.0 # via # -r requirements/base.txt # pyjwt @@ -138,7 +156,7 @@ django-extensions==3.2.3 # via -r requirements/base.txt django-rest-swagger==2.2.0 # via -r requirements/base.txt -django-waffle==4.1.0 +django-waffle==4.2.0 # via # -r requirements/base.txt # edx-django-utils @@ -163,7 +181,7 @@ edx-braze-client==0.2.5 # via -r requirements/base.txt edx-django-release-util==1.4.0 # via -r requirements/base.txt -edx-django-utils==7.0.0 +edx-django-utils==7.1.0 # via # -r requirements/base.txt # edx-drf-extensions @@ -199,6 +217,14 @@ jinja2==3.1.4 # -r requirements/base.txt # code-annotations # coreschema +jsonpickle==3.3.0 + # via + # -r requirements/base.txt + # apimatic-core +jsonpointer==2.4 + # via + # -r requirements/base.txt + # apimatic-core kombu==5.4.2 # via # -r requirements/base.txt @@ -208,7 +234,7 @@ markupsafe==3.0.2 # -r requirements/base.txt # jinja2 # werkzeug -marshmallow==3.23.0 +marshmallow==3.23.1 # via # -r requirements/base.txt # commercetools @@ -221,9 +247,13 @@ mccabe==0.7.0 # via pylint mock==5.1.0 # via -r requirements/test.in -mysqlclient==2.2.5 +msgpack==1.1.0 + # via + # -r requirements/base.txt + # cachecontrol +mysqlclient==2.2.6 # via -r requirements/base.txt -newrelic==10.2.0 +newrelic==10.4.0 # via # -r requirements/base.txt # edx-django-utils @@ -236,15 +266,17 @@ openapi-codec==1.3.2 # via # -r requirements/base.txt # django-rest-swagger -openedx-filters==1.11.0 +openedx-filters==1.12.0 # via -r requirements/base.txt -packaging==24.1 +packaging==24.2 # via # -r requirements/base.txt # marshmallow # pyproject-api # pytest # tox +paypal-server-sdk==0.5.1 + # via -r requirements/base.txt pbr==6.1.0 # via # -r requirements/base.txt @@ -272,7 +304,7 @@ pycparser==2.22 # via # -r requirements/base.txt # cffi -pyjwt[crypto]==2.9.0 +pyjwt[crypto]==2.10.1 # via # -r requirements/base.txt # drf-jwt @@ -281,7 +313,7 @@ pyjwt[crypto]==2.9.0 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.1 +pylint==3.3.2 # via # edx-lint # pylint-celery @@ -305,7 +337,7 @@ pynacl==1.5.0 # edx-django-utils pyproject-api==1.8.0 # via tox -pytest==8.3.3 +pytest==8.3.4 # via # -r requirements/test.in # pytest-cov @@ -317,6 +349,7 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/base.txt + # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -335,13 +368,16 @@ pyyaml==6.0.2 # code-annotations # edx-django-release-util # responses -redis==5.2.0 +redis==5.2.1 # via # -r requirements/base.txt # celery requests==2.32.3 # via # -r requirements/base.txt + # apimatic-core + # apimatic-requests-client-adapter + # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -373,7 +409,7 @@ simplejson==3.19.3 # via # -r requirements/base.txt # django-rest-swagger -six==1.16.0 +six==1.17.0 # via # -r requirements/base.txt # edx-auth-backends @@ -389,17 +425,17 @@ social-auth-core==4.5.4 # -r requirements/base.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.1 +sqlparse==0.5.3 # via # -r requirements/base.txt # django -stevedore==5.3.0 +stevedore==5.4.0 # via # -r requirements/base.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.2.0 +stripe==11.3.0 # via -r requirements/base.txt testfixtures==8.3.0 # via -r requirements/test.in @@ -434,7 +470,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.27.1 +virtualenv==20.28.0 # via tox wcwidth==0.2.13 # via @@ -444,11 +480,14 @@ webob==1.8.9 # via # -r requirements/base.txt # commercetools -werkzeug==3.0.6 +werkzeug==3.1.3 # via # -r requirements/base.txt # commercetools -wrapt==1.16.0 +wrapt==1.17.0 # via # -r requirements/base.txt # commercetools + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/validation.txt b/requirements/validation.txt index 5c181e20..d3f2de07 100644 --- a/requirements/validation.txt +++ b/requirements/validation.txt @@ -4,24 +4,41 @@ # # make upgrade # -amqp==5.2.0 +amqp==5.3.1 # via # -r requirements/quality.txt # -r requirements/test.txt # kombu +apimatic-core==0.2.17 + # via + # -r requirements/quality.txt + # -r requirements/test.txt + # paypal-server-sdk +apimatic-core-interfaces==0.1.5 + # via + # -r requirements/quality.txt + # -r requirements/test.txt + # apimatic-core + # apimatic-requests-client-adapter + # paypal-server-sdk +apimatic-requests-client-adapter==0.1.6 + # via + # -r requirements/quality.txt + # -r requirements/test.txt + # paypal-server-sdk asgiref==3.7.2 # via # -r requirements/quality.txt # -r requirements/test.txt # django # django-cors-headers -astroid==3.3.5 +astroid==3.3.6 # via # -r requirements/quality.txt # -r requirements/test.txt # pylint # pylint-celery -attrs==24.2.0 +attrs==24.3.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -35,6 +52,11 @@ billiard==4.2.1 # -r requirements/quality.txt # -r requirements/test.txt # celery +cachecontrol==0.12.14 + # via + # -r requirements/quality.txt + # -r requirements/test.txt + # apimatic-requests-client-adapter cachetools==5.5.0 # via # -r requirements/quality.txt @@ -44,7 +66,7 @@ celery[redis]==5.4.0 # via # -r requirements/quality.txt # -r requirements/test.txt -certifi==2024.8.30 +certifi==2024.12.14 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -97,7 +119,7 @@ click-repl==0.3.0 # -r requirements/quality.txt # -r requirements/test.txt # celery -code-annotations==1.8.0 +code-annotations==2.1.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -122,12 +144,12 @@ coreschema==0.0.4 # -r requirements/quality.txt # -r requirements/test.txt # coreapi -coverage[toml]==7.6.4 +coverage[toml]==7.6.9 # via # -r requirements/quality.txt # -r requirements/test.txt # pytest-cov -cryptography==43.0.3 +cryptography==44.0.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -157,7 +179,7 @@ distlib==0.3.9 # -r requirements/quality.txt # -r requirements/test.txt # virtualenv -django==4.2.16 +django==4.2.17 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -197,7 +219,7 @@ django-rest-swagger==2.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt -django-waffle==4.1.0 +django-waffle==4.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -236,7 +258,7 @@ edx-django-release-util==1.4.0 # via # -r requirements/quality.txt # -r requirements/test.txt -edx-django-utils==7.0.0 +edx-django-utils==7.1.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -270,10 +292,6 @@ idna==3.10 # -r requirements/quality.txt # -r requirements/test.txt # requests -importlib-metadata==8.5.0 - # via - # -r requirements/quality.txt - # twine iniconfig==2.0.0 # via # -r requirements/quality.txt @@ -307,6 +325,16 @@ jinja2==3.1.4 # -r requirements/test.txt # code-annotations # coreschema +jsonpickle==3.3.0 + # via + # -r requirements/quality.txt + # -r requirements/test.txt + # apimatic-core +jsonpointer==2.4 + # via + # -r requirements/quality.txt + # -r requirements/test.txt + # apimatic-core keyring==25.5.0 # via # -r requirements/quality.txt @@ -326,7 +354,7 @@ markupsafe==3.0.2 # -r requirements/test.txt # jinja2 # werkzeug -marshmallow==3.23.0 +marshmallow==3.23.1 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -355,16 +383,21 @@ more-itertools==10.5.0 # -r requirements/quality.txt # jaraco-classes # jaraco-functools -mysqlclient==2.2.5 +msgpack==1.1.0 # via # -r requirements/quality.txt # -r requirements/test.txt -newrelic==10.2.0 + # cachecontrol +mysqlclient==2.2.6 + # via + # -r requirements/quality.txt + # -r requirements/test.txt +newrelic==10.4.0 # via # -r requirements/quality.txt # -r requirements/test.txt # edx-django-utils -nh3==0.2.18 +nh3==0.2.20 # via # -r requirements/quality.txt # readme-renderer @@ -379,11 +412,11 @@ openapi-codec==1.3.2 # -r requirements/quality.txt # -r requirements/test.txt # django-rest-swagger -openedx-filters==1.11.0 +openedx-filters==1.12.0 # via # -r requirements/quality.txt # -r requirements/test.txt -packaging==24.1 +packaging==24.2 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -391,6 +424,11 @@ packaging==24.1 # pyproject-api # pytest # tox + # twine +paypal-server-sdk==0.5.1 + # via + # -r requirements/quality.txt + # -r requirements/test.txt pbr==6.1.0 # via # -r requirements/quality.txt @@ -400,7 +438,7 @@ pillow==11.0.0 # via # -r requirements/quality.txt # -r requirements/test.txt -pkginfo==1.10.0 +pkginfo==1.12.0 # via # -r requirements/quality.txt # twine @@ -441,7 +479,7 @@ pygments==2.18.0 # -r requirements/quality.txt # readme-renderer # rich -pyjwt[crypto]==2.9.0 +pyjwt[crypto]==2.10.1 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -451,7 +489,7 @@ pyjwt[crypto]==2.9.0 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.1 +pylint==3.3.2 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -490,7 +528,7 @@ pyproject-api==1.8.0 # -r requirements/quality.txt # -r requirements/test.txt # tox -pytest==8.3.3 +pytest==8.3.4 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -508,6 +546,7 @@ python-dateutil==2.9.0.post0 # via # -r requirements/quality.txt # -r requirements/test.txt + # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -536,7 +575,7 @@ readme-renderer==44.0 # via # -r requirements/quality.txt # twine -redis==5.2.0 +redis==5.2.1 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -545,6 +584,9 @@ requests==2.32.3 # via # -r requirements/quality.txt # -r requirements/test.txt + # apimatic-core + # apimatic-requests-client-adapter + # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -580,7 +622,7 @@ rfc3986==2.0.0 # via # -r requirements/quality.txt # twine -rich==13.9.3 +rich==13.9.4 # via # -r requirements/quality.txt # twine @@ -598,7 +640,7 @@ simplejson==3.19.3 # -r requirements/quality.txt # -r requirements/test.txt # django-rest-swagger -six==1.16.0 +six==1.17.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -621,20 +663,20 @@ social-auth-core==4.5.4 # -r requirements/test.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.1 +sqlparse==0.5.3 # via # -r requirements/quality.txt # -r requirements/test.txt # django # django-debug-toolbar -stevedore==5.3.0 +stevedore==5.4.0 # via # -r requirements/quality.txt # -r requirements/test.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.2.0 +stripe==11.3.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -656,7 +698,7 @@ tox==4.23.2 # via # -r requirements/quality.txt # -r requirements/test.txt -twine==5.1.1 +twine==6.0.1 # via -r requirements/quality.txt typing-extensions==4.12.2 # via @@ -689,7 +731,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.27.1 +virtualenv==20.28.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -704,17 +746,16 @@ webob==1.8.9 # -r requirements/quality.txt # -r requirements/test.txt # commercetools -werkzeug==3.0.6 +werkzeug==3.1.3 # via # -r requirements/quality.txt # -r requirements/test.txt # commercetools -wrapt==1.16.0 +wrapt==1.17.0 # via # -r requirements/quality.txt # -r requirements/test.txt # commercetools -zipp==3.20.2 - # via - # -r requirements/quality.txt - # importlib-metadata + +# The following packages are considered to be unsafe in a requirements file: +# setuptools From 0b7f90eeb6aa91e2263b64cedcce8f794a8b616e Mon Sep 17 00:00:00 2001 From: Shafqat Farhan Date: Wed, 18 Dec 2024 20:06:08 +0500 Subject: [PATCH 06/11] fix: linting errors --- commerce_coordinator/apps/commercetools/pipeline.py | 1 + commerce_coordinator/apps/commercetools/tests/conftest.py | 1 - .../apps/commercetools/tests/sub_messages/test_tasks.py | 7 ++++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index 2759aa47..e206b040 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -330,6 +330,7 @@ def run_filter( ct_api_client = CommercetoolsAPIClient() try: + payment_on_order = None if payment_data is not None: payment_on_order = payment_data elif psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME: diff --git a/commerce_coordinator/apps/commercetools/tests/conftest.py b/commerce_coordinator/apps/commercetools/tests/conftest.py index 7310ac49..61b7f639 100644 --- a/commerce_coordinator/apps/commercetools/tests/conftest.py +++ b/commerce_coordinator/apps/commercetools/tests/conftest.py @@ -23,7 +23,6 @@ from commercetools.platform.models import Transaction as CTTransaction from commercetools.platform.models import TransactionState, TransactionType from commercetools.platform.models import TypeReference as CTTypeReference -from commercetools.platform.models import TypedMoney as CTTypedMoney from commercetools.platform.models.state import State as CTLineItemState from commercetools.platform.models.state import StateTypeEnum as CTStateType from commercetools.testing import BackendRepository diff --git a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py index bd99fb6c..f962e5cb 100644 --- a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py +++ b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py @@ -274,7 +274,12 @@ def get_uut(): @patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order') @patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient') @patch.object(CommercetoolsAPIClientMock, 'payment_mock', new_callable=MagicMock) - def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal, custom_payment_mock): + def test_correct_arguments_passed_already_refunded_doest_break( + self, + _stripe_api_mock, + _lms_signal, + custom_payment_mock + ): """ Check calling uut with mock_parameters yields call to client with expected_data. From ca250cd2f7d495d259a1bc16632054b44546f955 Mon Sep 17 00:00:00 2001 From: Shafqat Farhan Date: Wed, 18 Dec 2024 20:11:58 +0500 Subject: [PATCH 07/11] fix: linting errors --- .../apps/commercetools/catalog_info/edx_utils.py | 1 - commerce_coordinator/apps/paypal/clients.py | 3 +-- commerce_coordinator/apps/paypal/pipeline.py | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py index 36924fba..3cf75736 100644 --- a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py +++ b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py @@ -83,4 +83,3 @@ def get_edx_refund_info(payment: CTPayment) -> decimal: interaction_id = transaction.interaction_id return refund_amount, interaction_id return refund_amount, interaction_id - diff --git a/commerce_coordinator/apps/paypal/clients.py b/commerce_coordinator/apps/paypal/clients.py index 8369c5a9..1ef2bc99 100644 --- a/commerce_coordinator/apps/paypal/clients.py +++ b/commerce_coordinator/apps/paypal/clients.py @@ -20,13 +20,12 @@ def __init__(self): ), ) - def refund_order(self, capture_id): """ Capture PayPal refund. Args: - capture_id (str): The identifier of the PayPal order to cpture refund. + capture_id (str): The identifier of the PayPal order to capture refund. Returns: The response from PayPal. diff --git a/commerce_coordinator/apps/paypal/pipeline.py b/commerce_coordinator/apps/paypal/pipeline.py index db74b7e9..955bd4c6 100644 --- a/commerce_coordinator/apps/paypal/pipeline.py +++ b/commerce_coordinator/apps/paypal/pipeline.py @@ -77,8 +77,8 @@ def run_filter( } except Exception as ex: logger.error(f'[CT-{tag}] Unsuccessful PayPal refund with details: ' - f'[order_id: {order_id} ' - f'message_id: {kwargs["message_id"]} ' - f'exception: {ex}') + f'[order_id: {order_id} ' + f'message_id: {kwargs["message_id"]} ' + f'exception: {ex}') raise RequestException(str(ex)) from ex From fae1fe4909d87a43460dd7cd6309731d0e887a0b Mon Sep 17 00:00:00 2001 From: Shafqat Farhan Date: Wed, 18 Dec 2024 21:33:31 +0500 Subject: [PATCH 08/11] fix: fixed requirement files errors --- .../commercetools/catalog_info/edx_utils.py | 2 +- .../apps/commercetools/clients.py | 2 +- .../apps/commercetools/pipeline.py | 6 +- .../apps/commercetools/sub_messages/tasks.py | 4 +- .../tests/sub_messages/test_tasks.py | 5 +- commerce_coordinator/apps/stripe/pipeline.py | 2 +- requirements/base.in | 2 +- requirements/base.txt | 47 +++---- requirements/ci.txt | 4 +- requirements/common_constraints.txt | 5 - requirements/dev.txt | 79 ++++++------ requirements/django.txt | 2 +- requirements/doc.txt | 117 +++++++++--------- requirements/pip-tools.txt | 4 +- requirements/pip.txt | 4 +- requirements/production.txt | 50 ++++---- requirements/quality.txt | 72 +++++------ requirements/test.txt | 57 ++++----- requirements/validation.txt | 76 ++++++------ 19 files changed, 261 insertions(+), 279 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py index 3cf75736..5ce6948b 100644 --- a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py +++ b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py @@ -77,9 +77,9 @@ def get_edx_refund_info(payment: CTPayment) -> decimal: refund_amount = decimal.Decimal(0.00) interaction_id = None for transaction in payment.transactions: - if transaction.type == TransactionType.CHARGE: # pragma no cover refund_amount += decimal.Decimal(typed_money_to_string(transaction.amount, money_as_decimal_string=True)) interaction_id = transaction.interaction_id return refund_amount, interaction_id + return refund_amount, interaction_id diff --git a/commerce_coordinator/apps/commercetools/clients.py b/commerce_coordinator/apps/commercetools/clients.py index df5d57ca..e6dc617d 100644 --- a/commerce_coordinator/apps/commercetools/clients.py +++ b/commerce_coordinator/apps/commercetools/clients.py @@ -511,7 +511,7 @@ def _preprocess_refund_object(self, refund: Refund, psp: str) -> Refund: else: refund["created"] = datetime.datetime.utcfromtimestamp(refund["created"]) - refund["status"] = translate_refund_status_to_transaction_status(refund["status"].lower()) + refund["status"] = translate_refund_status_to_transaction_status(refund["status"]) refund["currency"] = refund["currency"].upper() return refund diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index e206b040..05c6b5a9 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -293,7 +293,7 @@ def run_filter( class CreateReturnPaymentTransaction(PipelineStep): """ Creates a Transaction for a return payment of a Commercetools order - based on Stripes or PayPal refund object on a refunded charge. + based on PSP refund object on a refunded charge. """ def run_filter( @@ -352,7 +352,7 @@ def run_filter( except CommercetoolsError as err: # pragma no cover error_message = "unknown" if psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME: - error_message = f"[payment_intent_id: {refund_response['payment_intent']}, " + error_message = f"[stripe_payment_intent_id: {refund_response['payment_intent']}, " elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: error_message = f"[paypal_capture_id: {refund_response['paypal_capture_id']}, " log.info(f"[{tag}] Unsuccessful attempt to create refund payment transaction with details: " @@ -364,7 +364,7 @@ def run_filter( except HTTPError as err: # pragma no cover error_message = "unknown" if psp == EDX_STRIPE_PAYMENT_INTERFACE_NAME: - error_message = f"[payment_intent_id: {refund_response['payment_intent']}, " + error_message = f"[stripe_payment_intent_id: {refund_response['payment_intent']}, " elif psp == EDX_PAYPAL_PAYMENT_INTERFACE_NAME: error_message = f"[paypal_capture_id: {refund_response['paypal_capture_id']}, " log.info(f"[{tag}] Unsuccessful attempt to create refund payment transaction with details: " diff --git a/commerce_coordinator/apps/commercetools/sub_messages/tasks.py b/commerce_coordinator/apps/commercetools/sub_messages/tasks.py index b6505d6f..a1d5590a 100644 --- a/commerce_coordinator/apps/commercetools/sub_messages/tasks.py +++ b/commerce_coordinator/apps/commercetools/sub_messages/tasks.py @@ -270,9 +270,9 @@ def _prepare_segment_event_properties(in_order, return_line_item_return_id): lms_user_name = get_edx_lms_user_name(customer) lms_user_id = get_edx_lms_user_id(customer) - logger.info(f'[CT-{tag}] calling stripe to refund payment intent {payment_intent_id}, message id: {message_id}') + logger.info(f'[CT-{tag}] calling PSP to refund payment "{payment_intent_id}", message id: {message_id}') - # Return payment if payment intent id is set + # Return payment if payment id is set if payment_intent_id is not None: result = OrderRefundRequested.run_filter( order_id=order_id, return_line_item_return_id=return_line_item_return_id, message_id=message_id diff --git a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py index f962e5cb..93c2f359 100644 --- a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py +++ b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py @@ -1,6 +1,6 @@ """Commercetools Task Tests""" import logging -from unittest import TestCase +from unittest import skip, TestCase from unittest.mock import MagicMock, call, patch from commercetools.platform.models import Order as CTOrder @@ -270,10 +270,11 @@ def unpack_for_uut(values): def get_uut(): return fulfill_order_returned_uut - # todo this flow is broken + # TODO: Fix this test. It is failing because of the way the mock is set up. @patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order') @patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient') @patch.object(CommercetoolsAPIClientMock, 'payment_mock', new_callable=MagicMock) + @skip(reason="It is failing because of the way the mock is set up.") def test_correct_arguments_passed_already_refunded_doest_break( self, _stripe_api_mock, diff --git a/commerce_coordinator/apps/stripe/pipeline.py b/commerce_coordinator/apps/stripe/pipeline.py index 132c7461..25b9433f 100644 --- a/commerce_coordinator/apps/stripe/pipeline.py +++ b/commerce_coordinator/apps/stripe/pipeline.py @@ -257,7 +257,7 @@ def run_filter( Arguments: order_id (str): The identifier of the order. payment_intent_id (str): The Stripe PaymentIntent id to look up. - refund_amount (decimal): Total amount to refund + amount_in_cents (decimal): Total amount to refund has_been_refunded (bool): Has this payment been refunded kwargs: arguments passed through from the filter. """ diff --git a/requirements/base.in b/requirements/base.in index d36494ba..bb309d7f 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -25,7 +25,7 @@ edx-rest-api-client mysqlclient openedx-filters Pillow -paypal-server-sdk==0.5.1 +paypal-server-sdk pytz segment-analytics-python stripe diff --git a/requirements/base.txt b/requirements/base.txt index 2d4b784d..2ccda068 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -4,7 +4,7 @@ # # make upgrade # -amqp==5.3.1 +amqp==5.2.0 # via kombu apimatic-core==0.2.17 # via paypal-server-sdk @@ -20,7 +20,7 @@ asgiref==3.7.2 # -r requirements/base.in # django # django-cors-headers -attrs==24.3.0 +attrs==24.2.0 # via -r requirements/base.in backoff==2.2.1 # via segment-analytics-python @@ -30,7 +30,7 @@ cachecontrol==0.12.14 # via apimatic-requests-client-adapter celery[redis]==5.4.0 # via -r requirements/base.in -certifi==2024.12.14 +certifi==2024.8.30 # via requests cffi==1.17.1 # via @@ -59,7 +59,7 @@ coreapi==2.3.3 # openapi-codec coreschema==0.0.4 # via coreapi -cryptography==44.0.0 +cryptography==43.0.3 # via # pyjwt # social-auth-core @@ -69,7 +69,7 @@ defusedxml==0.8.0rc2 # via # python3-openid # social-auth-core -django==4.2.17 +django==4.2.16 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt @@ -94,7 +94,7 @@ django-extensions==3.2.3 # via -r requirements/base.in django-rest-swagger==2.2.0 # via -r requirements/base.in -django-waffle==4.2.0 +django-waffle==4.1.0 # via # -r requirements/base.in # edx-django-utils @@ -115,7 +115,7 @@ edx-braze-client==0.2.5 # via -r requirements/base.in edx-django-release-util==1.4.0 # via -r requirements/base.in -edx-django-utils==7.1.0 +edx-django-utils==7.0.0 # via # -r requirements/base.in # edx-drf-extensions @@ -142,7 +142,7 @@ markupsafe==3.0.2 # via # jinja2 # werkzeug -marshmallow==3.23.1 +marshmallow==3.23.0 # via # commercetools # marshmallow-enum @@ -150,9 +150,9 @@ marshmallow-enum==1.5.1 # via commercetools msgpack==1.1.0 # via cachecontrol -mysqlclient==2.2.6 +mysqlclient==2.2.5 # via -r requirements/base.in -newrelic==10.4.0 +newrelic==10.2.0 # via edx-django-utils oauthlib==3.2.2 # via @@ -160,9 +160,9 @@ oauthlib==3.2.2 # social-auth-core openapi-codec==1.3.2 # via django-rest-swagger -openedx-filters==1.12.0 +openedx-filters==1.11.0 # via -r requirements/base.in -packaging==24.2 +packaging==24.1 # via marshmallow paypal-server-sdk==0.5.1 # via -r requirements/base.in @@ -176,7 +176,7 @@ psutil==6.1.0 # via edx-django-utils pycparser==2.22 # via cffi -pyjwt[crypto]==2.10.1 +pyjwt[crypto]==2.9.0 # via # drf-jwt # edx-auth-backends @@ -191,7 +191,6 @@ pynacl==1.5.0 python-dateutil==2.9.0.post0 # via # -r requirements/base.in - # apimatic-core # celery # segment-analytics-python python3-openid==3.2.0 @@ -202,13 +201,10 @@ pytz==2024.2 # commercetools pyyaml==6.0.2 # via edx-django-release-util -redis==5.2.1 +redis==5.2.0 # via celery requests==2.32.3 # via - # apimatic-core - # apimatic-requests-client-adapter - # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -230,7 +226,7 @@ semantic-version==2.10.0 # via edx-drf-extensions simplejson==3.19.3 # via django-rest-swagger -six==1.17.0 +six==1.16.0 # via # edx-auth-backends # edx-django-release-util @@ -241,13 +237,13 @@ social-auth-core==4.5.4 # via # edx-auth-backends # social-auth-app-django -sqlparse==0.5.3 +sqlparse==0.5.1 # via django -stevedore==5.4.0 +stevedore==5.3.0 # via # edx-django-utils # edx-opaque-keys -stripe==11.3.0 +stripe==11.2.0 # via -r requirements/base.in typing-extensions==4.12.2 # via @@ -270,10 +266,7 @@ wcwidth==0.2.13 # via prompt-toolkit webob==1.8.9 # via commercetools -werkzeug==3.1.3 +werkzeug==3.0.6 # via commercetools -wrapt==1.17.0 +wrapt==1.16.0 # via commercetools - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/requirements/ci.txt b/requirements/ci.txt index 8ec4e7c2..dc61486c 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -16,7 +16,7 @@ filelock==3.16.1 # via # tox # virtualenv -packaging==24.2 +packaging==24.1 # via # pyproject-api # tox @@ -30,5 +30,5 @@ pyproject-api==1.8.0 # via tox tox==4.23.2 # via -r requirements/ci.in -virtualenv==20.28.0 +virtualenv==20.27.1 # via tox diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index 5863251e..c54963e0 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -1,9 +1,4 @@ - - - - - # A central location for most common version constraints # (across edx repos) for pip-installation. # diff --git a/requirements/dev.txt b/requirements/dev.txt index 84972329..1c29a9e1 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,7 +4,7 @@ # # make upgrade # -amqp==5.3.1 +amqp==5.2.0 # via # -r requirements/validation.txt # kombu @@ -27,12 +27,12 @@ asgiref==3.7.2 # -r requirements/validation.txt # django # django-cors-headers -astroid==3.3.6 +astroid==3.3.5 # via # -r requirements/validation.txt # pylint # pylint-celery -attrs==24.3.0 +attrs==24.2.0 # via -r requirements/validation.txt backoff==2.2.1 # via @@ -56,7 +56,7 @@ cachetools==5.5.0 # tox celery[redis]==5.4.0 # via -r requirements/validation.txt -certifi==2024.12.14 +certifi==2024.8.30 # via # -r requirements/validation.txt # requests @@ -103,7 +103,7 @@ click-repl==0.3.0 # via # -r requirements/validation.txt # celery -code-annotations==2.1.0 +code-annotations==1.8.0 # via # -r requirements/validation.txt # edx-lint @@ -122,11 +122,11 @@ coreschema==0.0.4 # via # -r requirements/validation.txt # coreapi -coverage[toml]==7.6.9 +coverage[toml]==7.6.4 # via # -r requirements/validation.txt # pytest-cov -cryptography==44.0.0 +cryptography==43.0.3 # via # -r requirements/validation.txt # pyjwt @@ -140,7 +140,7 @@ defusedxml==0.8.0rc2 # -r requirements/validation.txt # python3-openid # social-auth-core -diff-cover==9.2.1 +diff-cover==9.2.0 # via -r requirements/dev.in dill==0.3.9 # via @@ -150,7 +150,7 @@ distlib==0.3.9 # via # -r requirements/validation.txt # virtualenv -django==4.2.17 +django==4.2.16 # via # -r requirements/validation.txt # django-cors-headers @@ -183,7 +183,7 @@ django-extensions==3.2.3 # via -r requirements/validation.txt django-rest-swagger==2.2.0 # via -r requirements/validation.txt -django-waffle==4.2.0 +django-waffle==4.1.0 # via # -r requirements/validation.txt # edx-django-utils @@ -212,7 +212,7 @@ edx-braze-client==0.2.5 # via -r requirements/validation.txt edx-django-release-util==1.4.0 # via -r requirements/validation.txt -edx-django-utils==7.1.0 +edx-django-utils==7.0.0 # via # -r requirements/validation.txt # edx-drf-extensions @@ -238,6 +238,10 @@ idna==3.10 # via # -r requirements/validation.txt # requests +importlib-metadata==8.5.0 + # via + # -r requirements/validation.txt + # twine iniconfig==2.0.0 # via # -r requirements/validation.txt @@ -288,7 +292,7 @@ lxml[html-clean,html_clean]==5.3.0 # via # edx-i18n-tools # lxml-html-clean -lxml-html-clean==0.4.1 +lxml-html-clean==0.3.1 # via lxml markdown-it-py==3.0.0 # via @@ -299,7 +303,7 @@ markupsafe==3.0.2 # -r requirements/validation.txt # jinja2 # werkzeug -marshmallow==3.23.1 +marshmallow==3.23.0 # via # -r requirements/validation.txt # commercetools @@ -327,13 +331,13 @@ msgpack==1.1.0 # via # -r requirements/validation.txt # cachecontrol -mysqlclient==2.2.6 +mysqlclient==2.2.5 # via -r requirements/validation.txt -newrelic==10.4.0 +newrelic==10.2.0 # via # -r requirements/validation.txt # edx-django-utils -nh3==0.2.20 +nh3==0.2.18 # via # -r requirements/validation.txt # readme-renderer @@ -346,9 +350,9 @@ openapi-codec==1.3.2 # via # -r requirements/validation.txt # django-rest-swagger -openedx-filters==1.12.0 +openedx-filters==1.11.0 # via -r requirements/validation.txt -packaging==24.2 +packaging==24.1 # via # -r requirements/pip-tools.txt # -r requirements/validation.txt @@ -357,7 +361,6 @@ packaging==24.2 # pyproject-api # pytest # tox - # twine path==16.16.0 # via edx-i18n-tools paypal-server-sdk==0.5.1 @@ -370,7 +373,7 @@ pillow==11.0.0 # via -r requirements/validation.txt pip-tools==7.4.1 # via -r requirements/pip-tools.txt -pkginfo==1.12.0 +pkginfo==1.10.0 # via # -r requirements/validation.txt # twine @@ -410,7 +413,7 @@ pygments==2.18.0 # diff-cover # readme-renderer # rich -pyjwt[crypto]==2.10.1 +pyjwt[crypto]==2.9.0 # via # -r requirements/validation.txt # drf-jwt @@ -419,7 +422,7 @@ pyjwt[crypto]==2.10.1 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.2 +pylint==3.3.1 # via # -r requirements/validation.txt # edx-lint @@ -456,7 +459,7 @@ pyproject-hooks==1.2.0 # -r requirements/pip-tools.txt # build # pip-tools -pytest==8.3.4 +pytest==8.3.3 # via # -r requirements/validation.txt # pytest-cov @@ -468,7 +471,6 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/validation.txt - # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -494,16 +496,13 @@ readme-renderer==44.0 # via # -r requirements/validation.txt # twine -redis==5.2.1 +redis==5.2.0 # via # -r requirements/validation.txt # celery requests==2.32.3 # via # -r requirements/validation.txt - # apimatic-core - # apimatic-requests-client-adapter - # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -535,7 +534,7 @@ rfc3986==2.0.0 # via # -r requirements/validation.txt # twine -rich==13.9.4 +rich==13.9.3 # via # -r requirements/validation.txt # twine @@ -549,7 +548,7 @@ simplejson==3.19.3 # via # -r requirements/validation.txt # django-rest-swagger -six==1.17.0 +six==1.16.0 # via # -r requirements/validation.txt # edx-auth-backends @@ -569,18 +568,18 @@ social-auth-core==4.5.4 # -r requirements/validation.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.3 +sqlparse==0.5.1 # via # -r requirements/validation.txt # django # django-debug-toolbar -stevedore==5.4.0 +stevedore==5.3.0 # via # -r requirements/validation.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.3.0 +stripe==11.2.0 # via -r requirements/validation.txt testfixtures==8.3.0 # via -r requirements/validation.txt @@ -594,7 +593,7 @@ tomlkit==0.13.2 # pylint tox==4.23.2 # via -r requirements/validation.txt -twine==6.0.1 +twine==5.1.1 # via -r requirements/validation.txt typing-extensions==4.12.2 # via @@ -622,7 +621,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.28.0 +virtualenv==20.27.1 # via # -r requirements/validation.txt # tox @@ -634,18 +633,22 @@ webob==1.8.9 # via # -r requirements/validation.txt # commercetools -werkzeug==3.1.3 +werkzeug==3.0.6 # via # -r requirements/validation.txt # commercetools -wheel==0.45.1 +wheel==0.44.0 # via # -r requirements/pip-tools.txt # pip-tools -wrapt==1.17.0 +wrapt==1.16.0 # via # -r requirements/validation.txt # commercetools +zipp==3.20.2 + # via + # -r requirements/validation.txt + # importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/django.txt b/requirements/django.txt index ebf97308..64aaf996 100644 --- a/requirements/django.txt +++ b/requirements/django.txt @@ -1 +1 @@ -django==4.2.17 +django==4.2.16 diff --git a/requirements/doc.txt b/requirements/doc.txt index 47f26dfa..515f902d 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -2,13 +2,13 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# make upgrade +# pip-compile --output-file=requirements/doc.txt requirements/doc.in # -accessible-pygments==0.0.5 +alabaster==0.7.16 +accessible-pygments==0.0.4 # via pydata-sphinx-theme -alabaster==1.0.0 # via sphinx -amqp==5.3.1 +amqp==5.2.0 # via # -r requirements/test.txt # kombu @@ -31,29 +31,30 @@ asgiref==3.7.2 # -r requirements/test.txt # django # django-cors-headers -astroid==3.3.6 +astroid==3.3.5 # via # -r requirements/test.txt # pylint # pylint-celery -attrs==24.3.0 +attrs==24.2.0 # via -r requirements/test.txt babel==2.16.0 - # via - # pydata-sphinx-theme - # sphinx + # via sphinx + # pydata-sphinx-theme backoff==2.2.1 # via # -r requirements/test.txt # segment-analytics-python -beautifulsoup4==4.12.3 - # via pydata-sphinx-theme billiard==4.2.1 # via # -r requirements/test.txt # celery build==1.2.2.post1 - # via -r requirements/doc.in + # django + # djangorestframework + # kombu +beautifulsoup4==4.12.3 + # via pydata-sphinx-theme cachecontrol==0.12.14 # via # -r requirements/test.txt @@ -64,7 +65,7 @@ cachetools==5.5.0 # tox celery[redis]==5.4.0 # via -r requirements/test.txt -certifi==2024.12.14 +certifi==2024.8.30 # via # -r requirements/test.txt # requests @@ -108,7 +109,7 @@ click-repl==0.3.0 # via # -r requirements/test.txt # celery -code-annotations==2.1.0 +code-annotations==1.8.0 # via # -r requirements/test.txt # edx-lint @@ -127,11 +128,11 @@ coreschema==0.0.4 # via # -r requirements/test.txt # coreapi -coverage[toml]==7.6.9 +coverage[toml]==7.6.4 # via # -r requirements/test.txt # pytest-cov -cryptography==44.0.0 +cryptography==43.0.3 # via # -r requirements/test.txt # pyjwt @@ -153,11 +154,10 @@ distlib==0.3.9 # via # -r requirements/test.txt # virtualenv -django==4.2.17 +django==4.2.16 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt - # -r requirements/test.txt # django-cors-headers # django-crum # django-extensions @@ -182,7 +182,7 @@ django-extensions==3.2.3 # via -r requirements/test.txt django-rest-swagger==2.2.0 # via -r requirements/test.txt -django-waffle==4.2.0 +django-waffle==4.1.0 # via # -r requirements/test.txt # edx-django-utils @@ -199,7 +199,7 @@ dnspython==2.7.0 # pymongo doc8==1.1.2 # via -r requirements/doc.in -docutils==0.21.2 +docutils==0.19 # via # doc8 # pydata-sphinx-theme @@ -216,7 +216,7 @@ edx-braze-client==0.2.5 # via -r requirements/test.txt edx-django-release-util==1.4.0 # via -r requirements/test.txt -edx-django-utils==7.1.0 +edx-django-utils==7.0.0 # via # -r requirements/test.txt # edx-drf-extensions @@ -231,6 +231,12 @@ edx-opaque-keys==2.11.0 # edx-drf-extensions edx-rest-api-client==6.0.0 # via -r requirements/test.txt +edx-sphinx-theme==3.1.0 + # via -r requirements/doc.in +exceptiongroup==1.2.1 + # via + # -r requirements/test.txt + # pytest filelock==3.16.1 # via # -r requirements/test.txt @@ -242,6 +248,8 @@ idna==3.10 # requests imagesize==1.4.1 # via sphinx +importlib-metadata==8.5.0 + # via twine iniconfig==2.0.0 # via # -r requirements/test.txt @@ -287,7 +295,7 @@ markupsafe==3.0.2 # -r requirements/test.txt # jinja2 # werkzeug -marshmallow==3.23.1 +marshmallow==3.23.0 # via # -r requirements/test.txt # commercetools @@ -312,13 +320,13 @@ msgpack==1.1.0 # via # -r requirements/test.txt # cachecontrol -mysqlclient==2.2.6 +mysqlclient==2.2.5 # via -r requirements/test.txt -newrelic==10.4.0 +newrelic==10.2.0 # via # -r requirements/test.txt # edx-django-utils -nh3==0.2.20 +nh3==0.2.18 # via readme-renderer oauthlib==3.2.2 # via @@ -329,18 +337,18 @@ openapi-codec==1.3.2 # via # -r requirements/test.txt # django-rest-swagger -openedx-filters==1.12.0 +openedx-filters==1.11.0 # via -r requirements/test.txt -packaging==24.2 +packaging==24.1 # via # -r requirements/test.txt # build # marshmallow + # pydata-sphinx-theme # pyproject-api # pytest # sphinx # tox - # twine paypal-server-sdk==0.5.1 # via -r requirements/test.txt pbr==6.1.0 @@ -349,7 +357,7 @@ pbr==6.1.0 # stevedore pillow==11.0.0 # via -r requirements/test.txt -pkginfo==1.12.0 +pkginfo==1.10.0 # via twine platformdirs==4.3.6 # via @@ -374,7 +382,7 @@ pycparser==2.22 # via # -r requirements/test.txt # cffi -pydata-sphinx-theme==0.16.1 +pydata-sphinx-theme==0.14.4 # via sphinx-book-theme pygments==2.18.0 # via @@ -384,7 +392,7 @@ pygments==2.18.0 # readme-renderer # rich # sphinx -pyjwt[crypto]==2.10.1 +pyjwt[crypto]==2.9.0 # via # -r requirements/test.txt # drf-jwt @@ -393,7 +401,7 @@ pyjwt[crypto]==2.10.1 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.2 +pylint==3.3.1 # via # -r requirements/test.txt # edx-lint @@ -427,7 +435,7 @@ pyproject-api==1.8.0 # tox pyproject-hooks==1.2.0 # via build -pytest==8.3.4 +pytest==8.3.3 # via # -r requirements/test.txt # pytest-cov @@ -439,7 +447,6 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/test.txt - # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -460,18 +467,15 @@ pyyaml==6.0.2 # code-annotations # edx-django-release-util # responses -readme-renderer==44.0 +readme-renderer==43.0 # via twine -redis==5.2.1 +redis==5.2.0 # via # -r requirements/test.txt # celery requests==2.32.3 # via # -r requirements/test.txt - # apimatic-core - # apimatic-requests-client-adapter - # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -502,7 +506,7 @@ restructuredtext-lint==1.4.0 # via doc8 rfc3986==2.0.0 # via twine -rich==13.9.4 +rich==13.9.3 # via twine segment-analytics-python==2.3.3 # via -r requirements/test.txt @@ -514,7 +518,7 @@ simplejson==3.19.3 # via # -r requirements/test.txt # django-rest-swagger -six==1.17.0 +six==1.16.0 # via # -r requirements/test.txt # edx-auth-backends @@ -532,17 +536,16 @@ social-auth-core==4.5.4 # -r requirements/test.txt # edx-auth-backends # social-auth-app-django -soupsieve==2.6 +soupsieve==2.5 # via beautifulsoup4 -sphinx==8.1.3 +sphinx==5.3.0 # via # -r requirements/doc.in +sphinxcontrib-applehelp==2.0.0 # pydata-sphinx-theme # sphinx-book-theme -sphinx-book-theme==1.1.3 +sphinx-book-theme==1.0.1 # via -r requirements/doc.in -sphinxcontrib-applehelp==2.0.0 - # via sphinx sphinxcontrib-devhelp==2.0.0 # via sphinx sphinxcontrib-htmlhelp==2.1.0 @@ -553,18 +556,18 @@ sphinxcontrib-qthelp==2.0.0 # via sphinx sphinxcontrib-serializinghtml==2.0.0 # via sphinx -sqlparse==0.5.3 +sqlparse==0.5.1 # via # -r requirements/test.txt # django -stevedore==5.4.0 +stevedore==5.3.0 # via # -r requirements/test.txt # code-annotations # doc8 # edx-django-utils # edx-opaque-keys -stripe==11.3.0 +stripe==11.2.0 # via -r requirements/test.txt testfixtures==8.3.0 # via -r requirements/test.txt @@ -578,13 +581,16 @@ tomlkit==0.13.2 # pylint tox==4.23.2 # via -r requirements/test.txt -twine==6.0.1 +twine==5.1.1 # via -r requirements/doc.in typing-extensions==4.12.2 # via # -r requirements/test.txt # edx-opaque-keys + # kombu # pydata-sphinx-theme + # pylint + # rich # stripe tzdata==2024.2 # via @@ -607,7 +613,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.28.0 +virtualenv==20.27.1 # via # -r requirements/test.txt # tox @@ -619,14 +625,13 @@ webob==1.8.9 # via # -r requirements/test.txt # commercetools -werkzeug==3.1.3 +werkzeug==3.0.6 # via # -r requirements/test.txt # commercetools -wrapt==1.17.0 +wrapt==1.16.0 # via # -r requirements/test.txt # commercetools - -# The following packages are considered to be unsafe in a requirements file: -# setuptools +zipp==3.20.2 + # via importlib-metadata diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 154dd417..cf4131e2 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -8,7 +8,7 @@ build==1.2.2.post1 # via pip-tools click==8.1.7 # via pip-tools -packaging==24.2 +packaging==24.1 # via build pip-tools==7.4.1 # via -r requirements/pip-tools.in @@ -16,7 +16,7 @@ pyproject-hooks==1.2.0 # via # build # pip-tools -wheel==0.45.1 +wheel==0.44.0 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/pip.txt b/requirements/pip.txt index 72284813..a8a601eb 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -4,7 +4,7 @@ # # make upgrade # -wheel==0.45.1 +wheel==0.44.0 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: @@ -12,5 +12,5 @@ pip==24.2 # via # -c requirements/common_constraints.txt # -r requirements/pip.in -setuptools==75.6.0 +setuptools==75.2.0 # via -r requirements/pip.in diff --git a/requirements/production.txt b/requirements/production.txt index b555daba..2c972f65 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -4,7 +4,7 @@ # # make upgrade # -amqp==5.3.1 +amqp==5.2.0 # via # -r requirements/base.txt # kombu @@ -27,7 +27,7 @@ asgiref==3.7.2 # -r requirements/base.txt # django # django-cors-headers -attrs==24.3.0 +attrs==24.2.0 # via -r requirements/base.txt backoff==2.2.1 # via @@ -43,7 +43,7 @@ cachecontrol==0.12.14 # apimatic-requests-client-adapter celery[redis]==5.4.0 # via -r requirements/base.txt -certifi==2024.12.14 +certifi==2024.8.30 # via # -r requirements/base.txt # requests @@ -87,7 +87,7 @@ coreschema==0.0.4 # via # -r requirements/base.txt # coreapi -cryptography==44.0.0 +cryptography==43.0.3 # via # -r requirements/base.txt # pyjwt @@ -99,7 +99,7 @@ defusedxml==0.8.0rc2 # -r requirements/base.txt # python3-openid # social-auth-core -django==4.2.17 +django==4.2.16 # via # -r requirements/base.txt # django-cors-headers @@ -124,7 +124,7 @@ django-extensions==3.2.3 # via -r requirements/base.txt django-rest-swagger==2.2.0 # via -r requirements/base.txt -django-waffle==4.2.0 +django-waffle==4.1.0 # via # -r requirements/base.txt # edx-django-utils @@ -149,7 +149,7 @@ edx-braze-client==0.2.5 # via -r requirements/base.txt edx-django-release-util==1.4.0 # via -r requirements/base.txt -edx-django-utils==7.1.0 +edx-django-utils==7.0.0 # via # -r requirements/base.txt # edx-drf-extensions @@ -162,7 +162,7 @@ edx-opaque-keys==2.11.0 # edx-drf-extensions edx-rest-api-client==6.0.0 # via -r requirements/base.txt -gevent==24.11.1 +gevent==24.10.3 # via -r requirements/production.in greenlet==3.1.1 # via gevent @@ -197,7 +197,7 @@ markupsafe==3.0.2 # -r requirements/base.txt # jinja2 # werkzeug -marshmallow==3.23.1 +marshmallow==3.23.0 # via # -r requirements/base.txt # commercetools @@ -208,13 +208,13 @@ marshmallow-enum==1.5.1 # commercetools msgpack==1.1.0 # via - # -r requirements/base.txt + # -r requirements/test.txt # cachecontrol -mysqlclient==2.2.6 +mysqlclient==2.2.5 # via # -r requirements/base.txt # -r requirements/production.in -newrelic==10.4.0 +newrelic==10.2.0 # via # -r requirements/base.txt # edx-django-utils @@ -227,9 +227,9 @@ openapi-codec==1.3.2 # via # -r requirements/base.txt # django-rest-swagger -openedx-filters==1.12.0 +openedx-filters==1.11.0 # via -r requirements/base.txt -packaging==24.2 +packaging==24.1 # via # -r requirements/base.txt # gunicorn @@ -254,7 +254,7 @@ pycparser==2.22 # via # -r requirements/base.txt # cffi -pyjwt[crypto]==2.10.1 +pyjwt[crypto]==2.9.0 # via # -r requirements/base.txt # drf-jwt @@ -276,7 +276,6 @@ pynacl==1.5.0 python-dateutil==2.9.0.post0 # via # -r requirements/base.txt - # apimatic-core # celery # segment-analytics-python python3-openid==3.2.0 @@ -292,16 +291,13 @@ pyyaml==6.0.2 # -r requirements/base.txt # -r requirements/production.in # edx-django-release-util -redis==5.2.1 +redis==5.2.0 # via # -r requirements/base.txt # celery requests==2.32.3 # via # -r requirements/base.txt - # apimatic-core - # apimatic-requests-client-adapter - # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -330,7 +326,7 @@ simplejson==3.19.3 # via # -r requirements/base.txt # django-rest-swagger -six==1.17.0 +six==1.16.0 # via # -r requirements/base.txt # edx-auth-backends @@ -345,16 +341,16 @@ social-auth-core==4.5.4 # -r requirements/base.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.3 +sqlparse==0.5.1 # via # -r requirements/base.txt # django -stevedore==5.4.0 +stevedore==5.3.0 # via # -r requirements/base.txt # edx-django-utils # edx-opaque-keys -stripe==11.3.0 +stripe==11.2.0 # via -r requirements/base.txt typing-extensions==4.12.2 # via @@ -388,17 +384,17 @@ webob==1.8.9 # via # -r requirements/base.txt # commercetools -werkzeug==3.1.3 +werkzeug==3.0.6 # via # -r requirements/base.txt # commercetools -wrapt==1.17.0 +wrapt==1.16.0 # via # -r requirements/base.txt # commercetools zope-event==5.0 # via gevent -zope-interface==7.2 +zope-interface==7.1.1 # via gevent # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/quality.txt b/requirements/quality.txt index cac6239b..6dca4f47 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -4,7 +4,7 @@ # # make upgrade # -amqp==5.3.1 +amqp==5.2.0 # via # -r requirements/test.txt # kombu @@ -27,12 +27,12 @@ asgiref==3.7.2 # -r requirements/test.txt # django # django-cors-headers -astroid==3.3.6 +astroid==3.3.5 # via # -r requirements/test.txt # pylint # pylint-celery -attrs==24.3.0 +attrs==24.2.0 # via -r requirements/test.txt backoff==2.2.1 # via @@ -52,7 +52,7 @@ cachetools==5.5.0 # tox celery[redis]==5.4.0 # via -r requirements/test.txt -certifi==2024.12.14 +certifi==2024.8.30 # via # -r requirements/test.txt # requests @@ -96,7 +96,7 @@ click-repl==0.3.0 # via # -r requirements/test.txt # celery -code-annotations==2.1.0 +code-annotations==1.8.0 # via # -r requirements/test.txt # edx-lint @@ -115,11 +115,11 @@ coreschema==0.0.4 # via # -r requirements/test.txt # coreapi -coverage[toml]==7.6.9 +coverage[toml]==7.6.4 # via # -r requirements/test.txt # pytest-cov -cryptography==44.0.0 +cryptography==43.0.3 # via # -r requirements/test.txt # pyjwt @@ -141,7 +141,7 @@ distlib==0.3.9 # via # -r requirements/test.txt # virtualenv -django==4.2.17 +django==4.2.16 # via # -c requirements/common_constraints.txt # -c requirements/constraints.txt @@ -173,7 +173,7 @@ django-extensions==3.2.3 # via -r requirements/test.txt django-rest-swagger==2.2.0 # via -r requirements/test.txt -django-waffle==4.2.0 +django-waffle==4.1.0 # via # -r requirements/test.txt # edx-django-utils @@ -200,7 +200,7 @@ edx-braze-client==0.2.5 # via -r requirements/test.txt edx-django-release-util==1.4.0 # via -r requirements/test.txt -edx-django-utils==7.1.0 +edx-django-utils==7.0.0 # via # -r requirements/test.txt # edx-drf-extensions @@ -226,6 +226,8 @@ idna==3.10 # via # -r requirements/test.txt # requests +importlib-metadata==8.5.0 + # via twine iniconfig==2.0.0 # via # -r requirements/test.txt @@ -271,7 +273,7 @@ markupsafe==3.0.2 # -r requirements/test.txt # jinja2 # werkzeug -marshmallow==3.23.1 +marshmallow==3.23.0 # via # -r requirements/test.txt # commercetools @@ -296,13 +298,13 @@ msgpack==1.1.0 # via # -r requirements/test.txt # cachecontrol -mysqlclient==2.2.6 +mysqlclient==2.2.5 # via -r requirements/test.txt -newrelic==10.4.0 +newrelic==10.2.0 # via # -r requirements/test.txt # edx-django-utils -nh3==0.2.20 +nh3==0.2.18 # via readme-renderer oauthlib==3.2.2 # via @@ -313,16 +315,15 @@ openapi-codec==1.3.2 # via # -r requirements/test.txt # django-rest-swagger -openedx-filters==1.12.0 +openedx-filters==1.11.0 # via -r requirements/test.txt -packaging==24.2 +packaging==24.1 # via # -r requirements/test.txt # marshmallow # pyproject-api # pytest # tox - # twine paypal-server-sdk==0.5.1 # via -r requirements/test.txt pbr==6.1.0 @@ -331,7 +332,7 @@ pbr==6.1.0 # stevedore pillow==11.0.0 # via -r requirements/test.txt -pkginfo==1.12.0 +pkginfo==1.10.0 # via twine platformdirs==4.3.6 # via @@ -364,7 +365,7 @@ pygments==2.18.0 # via # readme-renderer # rich -pyjwt[crypto]==2.10.1 +pyjwt[crypto]==2.9.0 # via # -r requirements/test.txt # drf-jwt @@ -373,7 +374,7 @@ pyjwt[crypto]==2.10.1 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.2 +pylint==3.3.1 # via # -r requirements/test.txt # edx-lint @@ -405,7 +406,7 @@ pyproject-api==1.8.0 # via # -r requirements/test.txt # tox -pytest==8.3.4 +pytest==8.3.3 # via # -r requirements/test.txt # pytest-cov @@ -417,7 +418,6 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/test.txt - # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -440,16 +440,13 @@ pyyaml==6.0.2 # responses readme-renderer==44.0 # via twine -redis==5.2.1 +redis==5.2.0 # via # -r requirements/test.txt # celery requests==2.32.3 # via # -r requirements/test.txt - # apimatic-core - # apimatic-requests-client-adapter - # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -477,7 +474,7 @@ responses==0.25.3 # via -r requirements/test.txt rfc3986==2.0.0 # via twine -rich==13.9.4 +rich==13.9.3 # via twine segment-analytics-python==2.3.3 # via -r requirements/test.txt @@ -489,7 +486,7 @@ simplejson==3.19.3 # via # -r requirements/test.txt # django-rest-swagger -six==1.17.0 +six==1.16.0 # via # -r requirements/test.txt # edx-auth-backends @@ -507,18 +504,18 @@ social-auth-core==4.5.4 # -r requirements/test.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.3 +sqlparse==0.5.1 # via # -r requirements/test.txt # django # django-debug-toolbar -stevedore==5.4.0 +stevedore==5.3.0 # via # -r requirements/test.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.3.0 +stripe==11.2.0 # via -r requirements/test.txt testfixtures==8.3.0 # via -r requirements/test.txt @@ -532,7 +529,7 @@ tomlkit==0.13.2 # pylint tox==4.23.2 # via -r requirements/test.txt -twine==6.0.1 +twine==5.1.1 # via -r requirements/quality.in typing-extensions==4.12.2 # via @@ -560,7 +557,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.28.0 +virtualenv==20.27.1 # via # -r requirements/test.txt # tox @@ -572,14 +569,13 @@ webob==1.8.9 # via # -r requirements/test.txt # commercetools -werkzeug==3.1.3 +werkzeug==3.0.6 # via # -r requirements/test.txt # commercetools -wrapt==1.17.0 +wrapt==1.16.0 # via # -r requirements/test.txt # commercetools - -# The following packages are considered to be unsafe in a requirements file: -# setuptools +zipp==3.20.2 + # via importlib-metadata diff --git a/requirements/test.txt b/requirements/test.txt index e0b04297..6cbdd8ea 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -4,7 +4,7 @@ # # make upgrade # -amqp==5.3.1 +amqp==5.2.0 # via # -r requirements/base.txt # kombu @@ -27,11 +27,11 @@ asgiref==3.7.2 # -r requirements/base.txt # django # django-cors-headers -astroid==3.3.6 +astroid==3.3.5 # via # pylint # pylint-celery -attrs==24.3.0 +attrs==24.2.0 # via -r requirements/base.txt backoff==2.2.1 # via @@ -49,7 +49,7 @@ cachetools==5.5.0 # via tox celery[redis]==5.4.0 # via -r requirements/base.txt -certifi==2024.12.14 +certifi==2024.8.30 # via # -r requirements/base.txt # requests @@ -89,7 +89,7 @@ click-repl==0.3.0 # via # -r requirements/base.txt # celery -code-annotations==2.1.0 +code-annotations==1.8.0 # via # -r requirements/test.in # edx-lint @@ -106,11 +106,11 @@ coreschema==0.0.4 # via # -r requirements/base.txt # coreapi -coverage[toml]==7.6.9 +coverage[toml]==7.6.4 # via # -r requirements/test.in # pytest-cov -cryptography==44.0.0 +cryptography==43.0.3 # via # -r requirements/base.txt # pyjwt @@ -156,7 +156,7 @@ django-extensions==3.2.3 # via -r requirements/base.txt django-rest-swagger==2.2.0 # via -r requirements/base.txt -django-waffle==4.2.0 +django-waffle==4.1.0 # via # -r requirements/base.txt # edx-django-utils @@ -181,7 +181,7 @@ edx-braze-client==0.2.5 # via -r requirements/base.txt edx-django-release-util==1.4.0 # via -r requirements/base.txt -edx-django-utils==7.1.0 +edx-django-utils==7.0.0 # via # -r requirements/base.txt # edx-drf-extensions @@ -234,7 +234,7 @@ markupsafe==3.0.2 # -r requirements/base.txt # jinja2 # werkzeug -marshmallow==3.23.1 +marshmallow==3.23.0 # via # -r requirements/base.txt # commercetools @@ -251,9 +251,9 @@ msgpack==1.1.0 # via # -r requirements/base.txt # cachecontrol -mysqlclient==2.2.6 +mysqlclient==2.2.5 # via -r requirements/base.txt -newrelic==10.4.0 +newrelic==10.2.0 # via # -r requirements/base.txt # edx-django-utils @@ -266,9 +266,9 @@ openapi-codec==1.3.2 # via # -r requirements/base.txt # django-rest-swagger -openedx-filters==1.12.0 +openedx-filters==1.11.0 # via -r requirements/base.txt -packaging==24.2 +packaging==24.1 # via # -r requirements/base.txt # marshmallow @@ -304,7 +304,7 @@ pycparser==2.22 # via # -r requirements/base.txt # cffi -pyjwt[crypto]==2.10.1 +pyjwt[crypto]==2.9.0 # via # -r requirements/base.txt # drf-jwt @@ -313,7 +313,7 @@ pyjwt[crypto]==2.10.1 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.2 +pylint==3.3.1 # via # edx-lint # pylint-celery @@ -337,7 +337,7 @@ pynacl==1.5.0 # edx-django-utils pyproject-api==1.8.0 # via tox -pytest==8.3.4 +pytest==8.3.3 # via # -r requirements/test.in # pytest-cov @@ -349,7 +349,6 @@ pytest-django==4.9.0 python-dateutil==2.9.0.post0 # via # -r requirements/base.txt - # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -368,16 +367,13 @@ pyyaml==6.0.2 # code-annotations # edx-django-release-util # responses -redis==5.2.1 +redis==5.2.0 # via # -r requirements/base.txt # celery requests==2.32.3 # via # -r requirements/base.txt - # apimatic-core - # apimatic-requests-client-adapter - # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -409,7 +405,7 @@ simplejson==3.19.3 # via # -r requirements/base.txt # django-rest-swagger -six==1.17.0 +six==1.16.0 # via # -r requirements/base.txt # edx-auth-backends @@ -425,17 +421,17 @@ social-auth-core==4.5.4 # -r requirements/base.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.3 +sqlparse==0.5.1 # via # -r requirements/base.txt # django -stevedore==5.4.0 +stevedore==5.3.0 # via # -r requirements/base.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.3.0 +stripe==11.2.0 # via -r requirements/base.txt testfixtures==8.3.0 # via -r requirements/test.in @@ -470,7 +466,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.28.0 +virtualenv==20.27.1 # via tox wcwidth==0.2.13 # via @@ -480,14 +476,11 @@ webob==1.8.9 # via # -r requirements/base.txt # commercetools -werkzeug==3.1.3 +werkzeug==3.0.6 # via # -r requirements/base.txt # commercetools -wrapt==1.17.0 +wrapt==1.16.0 # via # -r requirements/base.txt # commercetools - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/requirements/validation.txt b/requirements/validation.txt index d3f2de07..0a4dd42d 100644 --- a/requirements/validation.txt +++ b/requirements/validation.txt @@ -4,7 +4,7 @@ # # make upgrade # -amqp==5.3.1 +amqp==5.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -32,13 +32,13 @@ asgiref==3.7.2 # -r requirements/test.txt # django # django-cors-headers -astroid==3.3.6 +astroid==3.3.5 # via # -r requirements/quality.txt # -r requirements/test.txt # pylint # pylint-celery -attrs==24.3.0 +attrs==24.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -66,7 +66,7 @@ celery[redis]==5.4.0 # via # -r requirements/quality.txt # -r requirements/test.txt -certifi==2024.12.14 +certifi==2024.8.30 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -119,7 +119,7 @@ click-repl==0.3.0 # -r requirements/quality.txt # -r requirements/test.txt # celery -code-annotations==2.1.0 +code-annotations==1.8.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -144,12 +144,12 @@ coreschema==0.0.4 # -r requirements/quality.txt # -r requirements/test.txt # coreapi -coverage[toml]==7.6.9 +coverage[toml]==7.6.4 # via # -r requirements/quality.txt # -r requirements/test.txt # pytest-cov -cryptography==44.0.0 +cryptography==43.0.3 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -179,7 +179,7 @@ distlib==0.3.9 # -r requirements/quality.txt # -r requirements/test.txt # virtualenv -django==4.2.17 +django==4.2.16 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -219,7 +219,7 @@ django-rest-swagger==2.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt -django-waffle==4.2.0 +django-waffle==4.1.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -258,7 +258,7 @@ edx-django-release-util==1.4.0 # via # -r requirements/quality.txt # -r requirements/test.txt -edx-django-utils==7.1.0 +edx-django-utils==7.0.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -292,6 +292,10 @@ idna==3.10 # -r requirements/quality.txt # -r requirements/test.txt # requests +importlib-metadata==8.5.0 + # via + # -r requirements/quality.txt + # twine iniconfig==2.0.0 # via # -r requirements/quality.txt @@ -354,7 +358,7 @@ markupsafe==3.0.2 # -r requirements/test.txt # jinja2 # werkzeug -marshmallow==3.23.1 +marshmallow==3.23.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -388,16 +392,16 @@ msgpack==1.1.0 # -r requirements/quality.txt # -r requirements/test.txt # cachecontrol -mysqlclient==2.2.6 +mysqlclient==2.2.5 # via # -r requirements/quality.txt # -r requirements/test.txt -newrelic==10.4.0 +newrelic==10.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt # edx-django-utils -nh3==0.2.20 +nh3==0.2.18 # via # -r requirements/quality.txt # readme-renderer @@ -412,11 +416,11 @@ openapi-codec==1.3.2 # -r requirements/quality.txt # -r requirements/test.txt # django-rest-swagger -openedx-filters==1.12.0 +openedx-filters==1.11.0 # via # -r requirements/quality.txt # -r requirements/test.txt -packaging==24.2 +packaging==24.1 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -424,7 +428,6 @@ packaging==24.2 # pyproject-api # pytest # tox - # twine paypal-server-sdk==0.5.1 # via # -r requirements/quality.txt @@ -438,7 +441,7 @@ pillow==11.0.0 # via # -r requirements/quality.txt # -r requirements/test.txt -pkginfo==1.12.0 +pkginfo==1.10.0 # via # -r requirements/quality.txt # twine @@ -479,7 +482,7 @@ pygments==2.18.0 # -r requirements/quality.txt # readme-renderer # rich -pyjwt[crypto]==2.10.1 +pyjwt[crypto]==2.9.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -489,7 +492,7 @@ pyjwt[crypto]==2.10.1 # edx-rest-api-client # segment-analytics-python # social-auth-core -pylint==3.3.2 +pylint==3.3.1 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -528,7 +531,7 @@ pyproject-api==1.8.0 # -r requirements/quality.txt # -r requirements/test.txt # tox -pytest==8.3.4 +pytest==8.3.3 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -546,7 +549,6 @@ python-dateutil==2.9.0.post0 # via # -r requirements/quality.txt # -r requirements/test.txt - # apimatic-core # celery # segment-analytics-python python-slugify==8.0.4 @@ -575,7 +577,7 @@ readme-renderer==44.0 # via # -r requirements/quality.txt # twine -redis==5.2.1 +redis==5.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -584,9 +586,6 @@ requests==2.32.3 # via # -r requirements/quality.txt # -r requirements/test.txt - # apimatic-core - # apimatic-requests-client-adapter - # cachecontrol # commercetools # coreapi # edx-drf-extensions @@ -622,7 +621,7 @@ rfc3986==2.0.0 # via # -r requirements/quality.txt # twine -rich==13.9.4 +rich==13.9.3 # via # -r requirements/quality.txt # twine @@ -640,7 +639,7 @@ simplejson==3.19.3 # -r requirements/quality.txt # -r requirements/test.txt # django-rest-swagger -six==1.17.0 +six==1.16.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -663,20 +662,20 @@ social-auth-core==4.5.4 # -r requirements/test.txt # edx-auth-backends # social-auth-app-django -sqlparse==0.5.3 +sqlparse==0.5.1 # via # -r requirements/quality.txt # -r requirements/test.txt # django # django-debug-toolbar -stevedore==5.4.0 +stevedore==5.3.0 # via # -r requirements/quality.txt # -r requirements/test.txt # code-annotations # edx-django-utils # edx-opaque-keys -stripe==11.3.0 +stripe==11.2.0 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -698,7 +697,7 @@ tox==4.23.2 # via # -r requirements/quality.txt # -r requirements/test.txt -twine==6.0.1 +twine==5.1.1 # via -r requirements/quality.txt typing-extensions==4.12.2 # via @@ -731,7 +730,7 @@ vine==5.1.0 # amqp # celery # kombu -virtualenv==20.28.0 +virtualenv==20.27.1 # via # -r requirements/quality.txt # -r requirements/test.txt @@ -746,16 +745,17 @@ webob==1.8.9 # -r requirements/quality.txt # -r requirements/test.txt # commercetools -werkzeug==3.1.3 +werkzeug==3.0.6 # via # -r requirements/quality.txt # -r requirements/test.txt # commercetools -wrapt==1.17.0 +wrapt==1.16.0 # via # -r requirements/quality.txt # -r requirements/test.txt # commercetools - -# The following packages are considered to be unsafe in a requirements file: -# setuptools +zipp==3.20.2 + # via + # -r requirements/quality.txt + # importlib-metadata From f93f73a69d26b5ddbd8b8ee100a01830f66e359d Mon Sep 17 00:00:00 2001 From: Shafqat Farhan Date: Wed, 18 Dec 2024 21:38:30 +0500 Subject: [PATCH 09/11] fix: fixed tests --- .../apps/commercetools/tests/sub_messages/test_tasks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py index 93c2f359..5f87aa8d 100644 --- a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py +++ b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py @@ -294,9 +294,11 @@ def test_correct_arguments_passed_already_refunded_doest_break( mock_values.order_mock.assert_has_calls([call(mock_values.order_id), call(order_id=mock_values.order_id)]) mock_values.customer_mock.assert_called_once_with(mock_values.customer_id) + # TODO: Fix this test. It is failing because of the way the mock is set up. @patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order') @patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient') @patch('commerce_coordinator.apps.commercetools.clients.CommercetoolsAPIClient.create_return_for_order') + @skip(reason="It is failing because of the way the mock is set up.") def test_correct_arguments_passed_valid_stripe_refund( self, _return_order_mock: MagicMock, From 5871d379238a4870fc511c694492b8ab49268f3f Mon Sep 17 00:00:00 2001 From: Shafqat Farhan Date: Wed, 18 Dec 2024 21:42:53 +0500 Subject: [PATCH 10/11] fix: fixed tests --- .../apps/commercetools/tests/sub_messages/test_tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py index 5f87aa8d..dc2a10ab 100644 --- a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py +++ b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py @@ -1,6 +1,6 @@ """Commercetools Task Tests""" import logging -from unittest import skip, TestCase +from unittest import TestCase, skip from unittest.mock import MagicMock, call, patch from commercetools.platform.models import Order as CTOrder From a38dabb40a3f6758a8cc04901edbbb6bcfcfca0b Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Thu, 19 Dec 2024 02:27:46 +0500 Subject: [PATCH 11/11] fix: update payment object mock --- .../commercetools/catalog_info/edx_utils.py | 5 +++- .../tests/sub_messages/test_tasks.py | 30 ++++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py index 5ce6948b..6a3144ff 100644 --- a/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py +++ b/commerce_coordinator/apps/commercetools/catalog_info/edx_utils.py @@ -51,10 +51,13 @@ def get_edx_successful_payment_info(order: CTOrder): for pr in order.payment_info.payments: pmt = pr.obj if pmt.payment_status.interface_code == PAYMENT_STATUS_INTERFACE_CODE_SUCCEEDED and pmt.interface_id: - return pmt, pmt.payment_method_info.payment_interface + ct_payment_provider_id = pmt.payment_method_info.payment_interface + return pmt, ct_payment_provider_id return None, None +# TODO update function and its return value name +# the return value could be either stripe payment intent id or PayPal order ID def get_edx_payment_intent_id(order: CTOrder) -> Union[str, None]: pmt, _ = get_edx_successful_payment_info(order) if pmt: diff --git a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py index dc2a10ab..d8e3163c 100644 --- a/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py +++ b/commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py @@ -1,11 +1,13 @@ """Commercetools Task Tests""" import logging -from unittest import TestCase, skip +from unittest import TestCase from unittest.mock import MagicMock, call, patch +from commercetools.platform.models import MoneyType as CTMoneyType from commercetools.platform.models import Order as CTOrder from commercetools.platform.models import ReturnInfo as CTReturnInfo from commercetools.platform.models import ReturnPaymentState as CTReturnPaymentState +from commercetools.platform.models import TypedMoney as CTTypedMoney from edx_django_utils.cache import TieredCache from commerce_coordinator.apps.commercetools.clients import CommercetoolsAPIClient @@ -252,6 +254,18 @@ def setUp(self): self.mock.update_return_payment_state_after_successful_refund } ) + # TODO: Properly mock the Payment object. + payment = self.mock.get_payment_by_key.return_value + amount = CTTypedMoney( + currency_code='USD', + cent_amount=1000, + type=CTMoneyType.CENT_PRECISION, + fraction_digits=2, + ) + for transaction in payment.transactions: + transaction.amount = amount + + self.payment_mock = payment def tearDown(self): MonkeyPatch.unmonkey(CommercetoolsAPIClient) @@ -270,35 +284,23 @@ def unpack_for_uut(values): def get_uut(): return fulfill_order_returned_uut - # TODO: Fix this test. It is failing because of the way the mock is set up. @patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order') @patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient') - @patch.object(CommercetoolsAPIClientMock, 'payment_mock', new_callable=MagicMock) - @skip(reason="It is failing because of the way the mock is set up.") - def test_correct_arguments_passed_already_refunded_doest_break( - self, - _stripe_api_mock, - _lms_signal, - custom_payment_mock - ): + def test_correct_arguments_passed_already_refunded_doest_break(self, _stripe_api_mock, _lms_signal): """ Check calling uut with mock_parameters yields call to client with expected_data. """ mock_values = self.mock - custom_payment_mock.return_value = CTPaymentByKey() - ret_val = self.get_uut()(*self.unpack_for_uut(self.mock.example_payload)) self.assertTrue(ret_val) mock_values.order_mock.assert_has_calls([call(mock_values.order_id), call(order_id=mock_values.order_id)]) mock_values.customer_mock.assert_called_once_with(mock_values.customer_id) - # TODO: Fix this test. It is failing because of the way the mock is set up. @patch('commerce_coordinator.apps.commercetools.sub_messages.tasks.is_edx_lms_order') @patch('commerce_coordinator.apps.stripe.pipeline.StripeAPIClient') @patch('commerce_coordinator.apps.commercetools.clients.CommercetoolsAPIClient.create_return_for_order') - @skip(reason="It is failing because of the way the mock is set up.") def test_correct_arguments_passed_valid_stripe_refund( self, _return_order_mock: MagicMock,