Files
MatchLiveTv/backend/spec/config/stripe_pci_guard_spec.rb
Emiliano Frascaro 148402a97c Fix PCI Stripe e anteprima regia; checkout sempre hosted.
Blocca l'invio di numeri carta dall'API server, usa Checkout anche per i cambi piano e nasconde correttamente il placeholder video in regia.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 08:00:28 +02:00

21 lines
686 B
Ruby

require "rails_helper"
RSpec.describe StripePciGuard do
it "rileva hash carta grezza" do
expect(described_class.raw_card_hash?({ number: "4242424242424242" })).to be true
expect(described_class.raw_card_hash?({ exp_month: 12 })).to be true
expect(described_class.raw_card_hash?({ token: "tok_visa" })).to be false
end
it "blocca PaymentMethod.create con numero carta" do
skip "Stripe gem non caricata" unless defined?(Stripe::PaymentMethod)
expect {
Stripe::PaymentMethod.create(
type: "card",
card: { number: "4242424242424242", exp_month: 12, exp_year: 2034, cvc: "123" }
)
}.to raise_error(SecurityError, /PCI/)
end
end