Non inviare in automatico le istruzioni di bonifico.
IBAN e causale restano da comunicare a mano dall'admin; la richiesta registra solo l'ordine in attesa. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -28,7 +28,6 @@ module Billing
|
||||
existing = @club.billing_transfer_orders.awaiting_payment.first
|
||||
if existing
|
||||
if existing.plan_slug == @plan_slug && existing.billing_interval == @interval && existing.amount_cents == amount_cents
|
||||
MatchLiveTv.deliver_mail(BankTransferMailer.with(order: existing).instructions)
|
||||
return existing
|
||||
end
|
||||
|
||||
@@ -59,7 +58,8 @@ module Billing
|
||||
)
|
||||
end
|
||||
|
||||
MatchLiveTv.deliver_mail(BankTransferMailer.with(order: order).instructions)
|
||||
# Le istruzioni (IBAN/causale) le manda a mano l'admin da /admin/billing.
|
||||
Rails.logger.info("[BankTransfer] ordine #{order.reference_code} in attesa, nessuna mail istruzioni")
|
||||
order
|
||||
end
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ RSpec.describe Billing::RequestBankTransfer do
|
||||
)
|
||||
end
|
||||
|
||||
it "crea l'ordine a listino e invia le istruzioni" do
|
||||
it "crea l'ordine a listino senza inviare le istruzioni" do
|
||||
expect {
|
||||
described_class.call(club: club, user: user, plan_slug: "premium_light", interval: "yearly")
|
||||
}.to change { club.billing_transfer_orders.count }.by(1)
|
||||
.and change { ActionMailer::Base.deliveries.size }.by(1)
|
||||
.and change { ActionMailer::Base.deliveries.size }.by(0)
|
||||
|
||||
order = club.billing_transfer_orders.last
|
||||
expect(order).to be_awaiting_payment
|
||||
@@ -41,16 +41,14 @@ RSpec.describe Billing::RequestBankTransfer do
|
||||
expect(club.reload.subscription.plan.slug).to eq("free")
|
||||
end
|
||||
|
||||
it "crea comunque l'ordine se in produzione manca SMTP" do
|
||||
allow(MatchLiveTv).to receive(:smtp_configured?).and_return(false)
|
||||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production"))
|
||||
it "non reinvia istruzioni se l'ordine è già in attesa" do
|
||||
first = described_class.call(club: club, user: user, plan_slug: "premium_light", interval: "yearly")
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
expect {
|
||||
described_class.call(club: club, user: user, plan_slug: "premium_light", interval: "yearly")
|
||||
}.to change { club.billing_transfer_orders.count }.by(1)
|
||||
.and change { ActionMailer::Base.deliveries.size }.by(0)
|
||||
|
||||
expect(club.billing_transfer_orders.last).to be_awaiting_payment
|
||||
second = described_class.call(club: club, user: user, plan_slug: "premium_light", interval: "yearly")
|
||||
expect(second.id).to eq(first.id)
|
||||
}.not_to change { ActionMailer::Base.deliveries.size }
|
||||
end
|
||||
|
||||
it "usa l'importo concordato se presente" do
|
||||
|
||||
Reference in New Issue
Block a user