class JeraPayment::Services::Iugu::Withdrawals::Create

Public Instance Methods

call() click to toggle source
# File lib/jera_payment/services/iugu/withdrawals/create.rb, line 6
def call
  iugu_withdrawal = JeraPayment::Api::Iugu::Withdrawal.request_withdrawal(@resource&.sub_account&.account_id, @attributes,
                                                                          @resource&.sub_account&.api_token)

  if iugu_withdrawal[:errors].present?
    add_error(iugu_withdrawal[:errors])
  else
    set_api_attributes(iugu_withdrawal)
  end

  @resource.errors.blank?
end

Private Instance Methods

set_api_attributes(attributes) click to toggle source
# File lib/jera_payment/services/iugu/withdrawals/create.rb, line 20
def set_api_attributes(attributes)
  @resource.api_id = attributes[:id]
end