Class: BankCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/payment_help.rb

Instance Method Summary collapse

Constructor Details

#initialize(member, order, bank) ⇒ BankCheck

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



5
6
7
8
9
10
# File 'lib/payment_help.rb', line 5

def initialize(member, order, bank)
@order_price_1 = order
@customer_bank_data = []
@member = member
@bank = bank
end

Instance Method Details

#check_bank_detailsObject

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



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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