Class: DefraRubyGovpay::WebhookSanitizerService
- Inherits:
-
Object
- Object
- DefraRubyGovpay::WebhookSanitizerService
- Defined in:
- lib/defra_ruby_govpay/services/webhook_sanitizer_service.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(webhook_body) ⇒ Object
7 8 9 |
# File 'lib/defra_ruby_govpay/services/webhook_sanitizer_service.rb', line 7 def self.call(webhook_body) new.call(webhook_body) end |
Instance Method Details
#call(webhook_body) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/defra_ruby_govpay/services/webhook_sanitizer_service.rb', line 11 def call(webhook_body) return webhook_body unless webhook_body.is_a?(Hash) # Create a deep copy to avoid modifying the original hash sanitized = webhook_body.deep_dup if sanitized["resource"].is_a?(Hash) sanitized["resource"].delete("email") sanitized["resource"].delete("card_details") end sanitized end |