diff --git a/app/serializers/v1/fee_serializer.rb b/app/serializers/v1/fee_serializer.rb index a2d7e69c6a3..5284554c3a0 100644 --- a/app/serializers/v1/fee_serializer.rb +++ b/app/serializers/v1/fee_serializer.rb @@ -102,12 +102,7 @@ def to_date def pay_in_advance_charge_attributes return {} unless model.pay_in_advance? - event = Event.find_by( - organization_id: model.subscription.organization, - id: model.pay_in_advance_event_id - ) - - {event_transaction_id: event&.transaction_id} + {event_transaction_id: model.pay_in_advance_event_transaction_id} end def applied_taxes diff --git a/spec/serializers/v1/fee_serializer_spec.rb b/spec/serializers/v1/fee_serializer_spec.rb index 8bd04b6547b..7c4f89fa85f 100644 --- a/spec/serializers/v1/fee_serializer_spec.rb +++ b/spec/serializers/v1/fee_serializer_spec.rb @@ -195,7 +195,7 @@ 'external_subscription_id' => subscription.external_id, 'lago_customer_id' => customer.id, 'external_customer_id' => customer.external_id, - 'event_transaction_id' => event.transaction_id, + 'event_transaction_id' => fee.pay_in_advance_event_transaction_id, 'pay_in_advance' => true, 'invoiceable' => true )