Class: Iugu::HandleCallbacks::Referrals::Verification

Inherits:
Base
  • Object
show all
Defined in:
lib/jera_payment/services/iugu/handle_callbacks/referrals/verification.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Iugu::HandleCallbacks::Referrals::Base

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/jera_payment/services/iugu/handle_callbacks/referrals/verification.rb', line 5

def call
  super
  @sub_account = JeraPayment::SubAccount.find_by(account_id: @params["data"]["id"])

  return 404 unless @sub_account.present?

  if @params["data"]["status"] == 'accepted'
    @sub_account.update_columns(can_receive?: true, is_verified?: true)
    @sub_account.households.last.update(status: :accepted)
  else
    @sub_account.update_columns(last_verification_request_feedback: @params["data"]["feedback"])
  end

  return 200
end