diff --git a/app/services/fees/create_pay_in_advance_service.rb b/app/services/fees/create_pay_in_advance_service.rb index 24c0dfbcf9b..8af16497714 100644 --- a/app/services/fees/create_pay_in_advance_service.rb +++ b/app/services/fees/create_pay_in_advance_service.rb @@ -27,8 +27,6 @@ def call fee_taxes_result = apply_provider_taxes(fees) unless fee_taxes_result.success? - deliver_tax_error_webhook(code: 'tax_error', message: fee_taxes_result.error.code) - result.validation_failure!(errors: {tax_error: [fee_taxes_result.error.code]}) result.raise_if_error! unless charge.invoiceable? @@ -201,21 +199,6 @@ def apply_provider_taxes(fees_result) taxes_result end - def deliver_tax_error_webhook(code:, message:) - return if charge.invoiceable? - - SendWebhookJob.perform_later( - 'fee.tax_provider_error', - integration_customer.integration, - event_transaction_id: event.transaction_id, - lago_charge_id: charge.id, - provider_error: { - message:, - error_code: code - } - ) - end - def invoice result.invoice_id = SecureRandom.uuid diff --git a/spec/services/fees/create_pay_in_advance_service_spec.rb b/spec/services/fees/create_pay_in_advance_service_spec.rb index 0750dc08bd7..be6084af96d 100644 --- a/spec/services/fees/create_pay_in_advance_service_spec.rb +++ b/spec/services/fees/create_pay_in_advance_service_spec.rb @@ -182,20 +182,6 @@ end end - it 'does not deliver tax error webhook' do - expect { fee_service.call }.not_to enqueue_job(SendWebhookJob) - .with( - 'fee.tax_provider_error', - customer.anrok_customer.integration, - event_transaction_id: event.transaction_id, - lago_charge_id: charge.id, - provider_error: { - message: 'taxDateTooFarInFuture', - error_code: 'tax_error' - } - ) - end - context 'when invoiceable is false' do let(:charge) { create(:standard_charge, :pay_in_advance, billable_metric:, plan:, invoiceable: false) } @@ -209,20 +195,6 @@ expect(charge.reload.fees.count).to eq(0) end end - - it 'delivers tax error webhook' do - expect { fee_service.call }.to enqueue_job(SendWebhookJob) - .with( - 'fee.tax_provider_error', - customer.anrok_customer.integration, - event_transaction_id: event.transaction_id, - lago_charge_id: charge.id, - provider_error: { - message: 'taxDateTooFarInFuture', - error_code: 'tax_error' - } - ) - end end end end