diff --git a/README.md b/README.md index 3c03585..98f4bbc 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ print(response.text) ### Verify webhook We will notify you each time there is be an update about your payments at the condition that your Organization supports the webhook feature (check on your organization's dashboard if you wan't to activate it) and that you provided a webhook url at which we can send the datas when sending the payment request. This will help you to automatically get an update without having to periodically send GET requests to our API. -But before you process the payload of a Webhook request, you must first verify that it is coming from Transfa and not from an unknown server acting like Transfa's server. Each webhook request will come with a parameter in the headers named `X-Webhook-Transfa-Signature`. You'll use that signature to make sure that the request is coming from us. +But before you process the payload of a Webhook request, you must first verify that it is coming from Transfa and not from an unknown server acting like Transfa's server. Each webhook request will come with a parameter in the headers named `X-Webhook-Optimus-Signature`. You'll use that signature to make sure that the request is coming from us. We provided you with a class called `Webhook` that will handle the whole verification underneath. All you have to do is creating an instance of the class with the required parameters. Here is an example of how you would do it with Django Rest Framework. diff --git a/tests/test_webhook.py b/tests/test_webhook.py index 9e529f5..be48a81 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -29,7 +29,7 @@ def test_valid_webhook_signature(valid_webhook_payload): signature = webhook_data.generate_signature(valid_webhook_payload, webhook_data.valid_webhook_token) webhook = Webhook(webhook_token=webhook_data.valid_webhook_token, body=valid_webhook_payload, headers={ - "X-Webhook-Transfa-Signature": signature + "X-Webhook-Optimus-Signature": signature }) verified = webhook.verify() @@ -42,7 +42,7 @@ def test_invalid_webhook_signature(valid_webhook_payload, invalid_webhook_payloa invalid_signature = webhook_data.generate_signature(invalid_webhook_payload, webhook_data.valid_webhook_token) webhook = Webhook(webhook_token=webhook_data.valid_webhook_token, body=valid_webhook_payload, headers={ - "X-Webhook-Transfa-Signature": invalid_signature + "X-Webhook-Optimus-Signature": invalid_signature }) verified = webhook.verify() @@ -55,7 +55,7 @@ def test_valid_webhook_token(valid_webhook_payload): valid_signature = webhook_data.generate_signature(valid_webhook_payload, webhook_data.valid_webhook_token) webhook = Webhook(webhook_token=webhook_data.valid_webhook_token, body=valid_webhook_payload, headers={ - "X-Webhook-Transfa-Signature": valid_signature + "X-Webhook-Optimus-Signature": valid_signature }) verified = webhook.verify() @@ -68,7 +68,7 @@ def test_invalid_webhook_token(valid_webhook_payload): valid_signature = webhook_data.generate_signature(valid_webhook_payload, webhook_data.valid_webhook_token) webhook = Webhook(webhook_token=webhook_data.invalid_webhook_token, body=valid_webhook_payload, headers={ - "X-Webhook-Transfa-Signature": valid_signature + "X-Webhook-Optimus-Signature": valid_signature }) verified = webhook.verify() diff --git a/transfa/enums.py b/transfa/enums.py index 5634498..36a88a4 100644 --- a/transfa/enums.py +++ b/transfa/enums.py @@ -33,4 +33,4 @@ class PrivateSecretPrefix(Enum): class TransfaHeadersIdentifiers(Enum): - webhook_signature = "X-Webhook-Transfa-Signature" + webhook_signature = "X-Webhook-Optimus-Signature"