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:
@@ -20,18 +20,34 @@ module ClubBillingProfile
|
||||
billing_profile_errors.empty?
|
||||
end
|
||||
|
||||
# Campi minimi per intestazione fattura e invio (email PDF + SDI/PEC).
|
||||
def billing_profile_errors
|
||||
errors = []
|
||||
errors << "Tipo intestatario" if billing_entity_type.blank?
|
||||
errors << "Ragione sociale o nome intestatario" if billing_legal_name.blank?
|
||||
errors << "Email di fatturazione" if billing_email.blank?
|
||||
errors << "Indirizzo" if billing_address_line.blank?
|
||||
errors << "Città" if billing_city.blank?
|
||||
errors << "Provincia (sigla 2 lettere)" if billing_province.blank? || billing_province.to_s.length != 2
|
||||
errors << "CAP" if billing_postal_code.blank?
|
||||
errors << "P.IVA o Codice Fiscale" if billing_vat_number.blank? && billing_fiscal_code.blank?
|
||||
errors << "Codice destinatario SDI o PEC" if billing_recipient_code.blank? && billing_pec.blank?
|
||||
errors << "Paese (ISO)" if billing_country.blank? || billing_country.to_s.length != 2
|
||||
errors.concat(billing_tax_id_errors)
|
||||
errors << "Codice destinatario SDI (7 caratteri) o PEC" if billing_recipient_code.blank? && billing_pec.blank?
|
||||
errors << "Codice destinatario SDI (7 caratteri)" if billing_recipient_code.present? && billing_recipient_code.length != 7
|
||||
errors
|
||||
end
|
||||
|
||||
def billing_tax_id_errors
|
||||
case billing_entity_type
|
||||
when "company"
|
||||
billing_vat_number.blank? ? ["Partita IVA"] : []
|
||||
when "individual"
|
||||
billing_fiscal_code.blank? ? ["Codice Fiscale"] : []
|
||||
else
|
||||
billing_vat_number.blank? && billing_fiscal_code.blank? ? ["P.IVA o Codice Fiscale"] : []
|
||||
end
|
||||
end
|
||||
|
||||
def billing_profile_summary
|
||||
parts = [billing_legal_name.presence, billing_vat_number.presence && "P.IVA #{billing_vat_number}"]
|
||||
parts.compact.join(" · ")
|
||||
|
||||
Reference in New Issue
Block a user