diff --git a/commerce_coordinator/apps/commercetools/utils.py b/commerce_coordinator/apps/commercetools/utils.py index c6e5fc15..95557128 100644 --- a/commerce_coordinator/apps/commercetools/utils.py +++ b/commerce_coordinator/apps/commercetools/utils.py @@ -209,7 +209,7 @@ def translate_refund_status_to_transaction_status(refund_status: str): 'failed': TransactionState.FAILURE, 'canceled': TransactionState.FAILURE, } - return translations.get(refund_status.lower(), refund_status) + return translations.get(refund_status.lower(), TransactionState.SUCCESS) def _create_retired_hash_withsalt(value_to_retire, salt): diff --git a/commerce_coordinator/apps/paypal/views.py b/commerce_coordinator/apps/paypal/views.py index ad474eee..dd35b606 100644 --- a/commerce_coordinator/apps/paypal/views.py +++ b/commerce_coordinator/apps/paypal/views.py @@ -75,18 +75,14 @@ def post(self, request): crc = zlib.crc32(body) message = f"{transmission_id}|{timestamp}|{webhook_id}|{crc}" - signature = base64.b64decode(request.headers.get("paypal-transmission-sig")) - certificate = self._get_certificate(request.headers.get("paypal-cert-url")) - cert = x509.load_pem_x509_certificate( certificate.encode("utf-8"), default_backend() ) public_key = cert.public_key() try: - # TODO: In future we can move this logic over to redis to avoid hitting the database public_key.verify( signature, message.encode("utf-8"), padding.PKCS1v15(), hashes.SHA256() ) diff --git a/commerce_coordinator/settings/base.py b/commerce_coordinator/settings/base.py index 46751645..2efc0676 100644 --- a/commerce_coordinator/settings/base.py +++ b/commerce_coordinator/settings/base.py @@ -419,7 +419,7 @@ def root(*path_fragments): } STRIPE_WEBHOOK_ENDPOINT_SECRET = 'SET-ME-PLEASE' -PAYPAL_WEBHOOK_ID="SET-ME-PLEASE" +PAYPAL_WEBHOOK_ID = 'SET-ME-PLEASE' # PAYMENT PROCESSING PAYMENT_PROCESSOR_CONFIG = {