Class: PayPro::Webhook
- Includes:
- Operations::Deletable, Operations::Updatable
- Defined in:
- lib/pay_pro/entities/webhook.rb
Constant Summary collapse
- RESOURCE_PATH =
'webhooks'
Instance Attribute Summary
Attributes inherited from Entity
Class Method Summary collapse
Methods included from Operations::Updatable
Methods included from Operations::Deletable
Methods included from Operations::Requestable
Methods inherited from Entity
create_from_data, #initialize, #inspect
Constructor Details
This class inherits a constructor from PayPro::Entity
Class Method Details
.create_event(payload:, signature:, secret:, timestamp:, tolerance: PayPro::Signature::DEFAULT_TOLERANCE) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pay_pro/entities/webhook.rb', line 10 def self.create_event( payload:, signature:, secret:, timestamp:, tolerance: PayPro::Signature::DEFAULT_TOLERANCE ) signature_verifier = PayPro::Signature.new( payload: payload, timestamp: Time.at(), secret: secret, tolerance: tolerance ) return unless signature_verifier.verify(signature: signature) data = JSON.parse(payload) PayPro::Event.create_from_data(data, api_client: nil) end |