Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changelog
[Unreleased]
------------

[v0.2.3] - 2023-04-21
------------------
- Fix Webhook's Header Identifier bug

[v0.2.2] - 2023-02-28
------------------
- Update Webhook's Header Identifier
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-Optimus-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-Transfa-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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ build-backend = "setuptools.build_meta"

[project]
name = "transfa"
version = "0.2.2"
version = "0.2.3"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.2
current_version = 0.2.3
commit = True
tag = True

Expand Down
8 changes: 4 additions & 4 deletions tests/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-Optimus-Signature": signature
"X-Webhook-Transfa-Signature": signature
})

verified = webhook.verify()
Expand All @@ -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-Optimus-Signature": invalid_signature
"X-Webhook-Transfa-Signature": invalid_signature
})

verified = webhook.verify()
Expand All @@ -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-Optimus-Signature": valid_signature
"X-Webhook-Transfa-Signature": valid_signature
})

verified = webhook.verify()
Expand All @@ -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-Optimus-Signature": valid_signature
"X-Webhook-Transfa-Signature": valid_signature
})

verified = webhook.verify()
Expand Down
2 changes: 1 addition & 1 deletion transfa/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ class PrivateSecretPrefix(Enum):


class TransfaHeadersIdentifiers(Enum):
webhook_signature = "X-Webhook-Optimus-Signature"
webhook_signature = "X-Webhook-Transfa-Signature"
2 changes: 1 addition & 1 deletion transfa/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.2.2"
VERSION = "0.2.3"