Billing: fatture manuali, profilo obbligatorio e piani Stripe mensile/annuale.
Rimuove link al portale Stripe in area cliente, aggiunge flusso admin per PDF fattura e email, blocca checkout senza dati di fatturazione, allinea prezzi a €4,90/€39,90 e €9,90/€69,90, locale italiano e documentazione deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
19
backend/spec/models/billing/invoice_display_spec.rb
Normal file
19
backend/spec/models/billing/invoice_display_spec.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Billing::Invoice do
|
||||
let(:club) { Club.create!(name: "Inv Club", sport: "volleyball", primary_color: "#e53935", secondary_color: "#ffffff") }
|
||||
|
||||
it "non mostra Aruba nel numero in UI" do
|
||||
invoice = club.billing_invoices.build(
|
||||
number: "ARUBA-RUNNER/2026",
|
||||
issued_on: Date.current,
|
||||
amount_cents: 5000,
|
||||
currency: "eur",
|
||||
status: "issued",
|
||||
source: "aruba"
|
||||
)
|
||||
|
||||
expect(invoice.display_number).to eq("RUNNER/2026")
|
||||
expect(invoice.display_number).not_to match(/aruba/i)
|
||||
end
|
||||
end
|
||||
@@ -7,11 +7,14 @@ RSpec.describe ClubBillingProfile do
|
||||
sport: "volleyball",
|
||||
primary_color: "#e53935",
|
||||
secondary_color: "#ffffff",
|
||||
billing_entity_type: "company",
|
||||
billing_legal_name: "ASD Test",
|
||||
billing_email: "billing@test.it",
|
||||
billing_address_line: "Via Roma 1",
|
||||
billing_city: "Milano",
|
||||
billing_province: "MI",
|
||||
billing_postal_code: "20100",
|
||||
billing_country: "IT",
|
||||
billing_vat_number: "12345678901",
|
||||
billing_recipient_code: "ABCDEFG"
|
||||
)
|
||||
@@ -26,4 +29,16 @@ RSpec.describe ClubBillingProfile do
|
||||
club.billing_pec = nil
|
||||
expect(club.billing_profile_complete?).to be false
|
||||
end
|
||||
|
||||
it "requires P.IVA for companies" do
|
||||
club.billing_vat_number = nil
|
||||
expect(club.billing_profile_complete?).to be false
|
||||
expect(club.billing_profile_errors).to include("Partita IVA")
|
||||
end
|
||||
|
||||
it "requires Codice Fiscale for individuals" do
|
||||
club.update!(billing_entity_type: "individual", billing_vat_number: nil, billing_fiscal_code: nil)
|
||||
club.billing_fiscal_code = "RSSMRA80A01H501U"
|
||||
expect(club.billing_profile_complete?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user