Skip to content

Commit

Permalink
remove webhook that is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
lovrocolic committed Aug 29, 2024
1 parent 620a9d3 commit d1e3c90
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
17 changes: 0 additions & 17 deletions app/services/fees/create_pay_in_advance_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down Expand Up @@ -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

Expand Down
28 changes: 0 additions & 28 deletions spec/services/fees/create_pay_in_advance_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand All @@ -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
Expand Down

0 comments on commit d1e3c90

Please sign in to comment.