Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of how to use webhooks with payload signing is missing #10

Open
franck102 opened this issue Sep 26, 2024 · 3 comments
Open

Example of how to use webhooks with payload signing is missing #10

franck102 opened this issue Sep 26, 2024 · 3 comments

Comments

@franck102
Copy link

Despite searching through the entire documentation and SDK source code I cannot figure out how to enable payload signing for webhooks with the SDK?

There is a WebhookIdentity entity that we can configure on a webhook create request, but no API to create or retrieve it?
And the WebhookEncryptionService lets you retrieve a public key, but how do you create the key pair in the first place?

A complete example would be most useful...

@thibault-mambour
Copy link

hi @franck102 , thank you for your question but I am not sure we understand what is the problem you are running into or trying to achieve with it.

How the payload signing can be used is defined here https://github.com/wallee-payment/java-sdk?tab=readme-ov-file#integrating-webhook-payload-signing-mechanism-into-webhook-callback-handler

@franck102
Copy link
Author

franck102 commented Oct 16, 2024

Hi Thibault,

The sample you mention explains how to extract and verify the signature when receiving an event.
I am not receiving a signature, and the state is always null... because I haven't found how to enable signatures.

[EDIT]: I found WebhookListenerCreate.enablePayloadSignatureAndState(true) which does enable signatures & state, problem solved.

@franck102
Copy link
Author

So another issue, I have two problems after using this code to create my listener:

 WebhookListenerCreate listenerCreate = new WebhookListenerCreate();
        listenerCreate.entity(entity.id).url(urlId)
            .name("passmate-" + tenantId + "-" + entity.name() + "-" + deploymentId)
            .enablePayloadSignatureAndState(true)
            .notifyEveryChange(false);

        try {
            listenerService.create(spaceId, listenerCreate);
        }
        catch (IOException e) {
            _log.error("Could not create Wallee listener for " + entity.name(), e);
        }
  1. in my space UI if I check the created listener it says "Every change to Transaction entities will be reported." - so notifyEveryChange(false) apparently had no effect

  2. I am receiving lots of duplicate events, with distinct IDs and timestamps - e.g. below 2 CONFIRMED, 3 PROCESSING, ...

15:26:03  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373733, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:02+0000', state='CONFIRMED'}
15:26:03  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373745, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:03+0000', state='CONFIRMED'}
15:26:03  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373749, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:03+0000', state='PROCESSING'}
15:26:03  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373752, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:03+0000', state='PROCESSING'}
15:26:04  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373760, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:04+0000', state='PROCESSING'}
15:26:06  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373773, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:06+0000', state='AUTHORIZED'}
15:26:08  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373771, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:08+0000', state='AUTHORIZED'}
15:26:08  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373779, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:08+0000', state='COMPLETED'}
15:26:09  RCVD Wallee webhook event WebhookEvent{tenantId='totem', eventId=464373805, entityId=267689861, listenerEntityId=1472041829003, listenerEntityTechnicalName='Transaction', spaceId=68607, webhookListenerId=500513, timestamp='2024-10-16T13:26:09+0000', state='FULFILL'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants