Sha256: 69ca22f4dc1db6f42a67568262b4c23981640d0dfc70b1773412e0e088d11fc5
Contents?: true
Size: 1.04 KB
Versions: 9
Compression:
Stored size: 1.04 KB
Contents
module Braintree class WebhookTestingGateway # :nodoc: def initialize(gateway) @gateway = gateway @config = gateway.config end def sample_notification(kind, id) payload = Base64.encode64(_sample_xml(kind, id)) signature_string = "#{Braintree::Configuration.public_key}|#{Braintree::Digest.hexdigest(Braintree::Configuration.private_key, payload)}" return signature_string, payload end def _sample_xml(kind, id) <<-XML <notification> <timestamp type="datetime">#{Time.now.utc.iso8601}</timestamp> <kind>#{kind}</kind> <subject> #{_subscription_sample_xml(id)} </subject> </notification> XML end def _subscription_sample_xml(id) <<-XML <subscription> <id>#{id}</id> <transactions type="array"> </transactions> <add_ons type="array"> </add_ons> <discounts type="array"> </discounts> </subscription> XML end end end
Version data entries
9 entries across 9 versions & 1 rubygems