class BankCheck

Public Class Methods

new(member, order, bank) click to toggle source

this method initialises the bank_data confirmation details from the applicaton controller parameter and initialises the available products

# File lib/payment_help.rb, line 5
def initialize(member, order, bank)
@order_price_1 = order
@customer_bank_data = []
@member = member
@bank = bank
end

Public Instance Methods

check_bank_details() click to toggle source

this method provides the logic of suggesting the users with high bank_data conditions by comparing the products specifications and the bank_data databases

# File lib/payment_help.rb, line 13
def check_bank_details
    #@order_price = bank_data.@mallergic
    #@customer_bank_data = bank_data.@customer
    #@bankical_confirmation = bank_data.@mconfirmation
    
  if(@member)
    @bankical_confirmation = @bank.find_by idProof: @member.idProof
   if(@bankical_confirmation)
    @customer_bank_data = "Hi, we have analysed your bank and card details to help you. "
    if (@bankical_confirmation.accountBalance > @order_price_1)
       @customer_bank_data << " Looks like you have sufficient balance in your account to pay. Please go ahead to transfer from your bank account number." 
    else
        @customer_bank_data << " Notice: your bank balance is very less "
        if (@bankical_confirmation.cardNumber)
            if (@bankical_confirmation.creditBalance > @order_price_1) #&& @bankical_confirmation.userName == @user_bank_data_check.firstName)
                @customer_bank_data << " But you have enough balance to buy in your card" 
            else
                @customer_bank_data << " And you're card balance is also insufficient. Please pay with any other card"
            end
        else
            @customer_bank_data << " Regret!, we couldn't find card details from the universal bank databases" 
        end
    end
   else
    @customer_bank_data = " We couildn't find any of your bank details suggest. Sorry for the inconvience"
   end
  else
    @customer_bank_data = " Pleaser fill you profile details from profile button to use our special services"
  end
  return @customer_bank_data
end