module SkroutzPay::Gateways::Visa

Public Instance Methods

capture(ccn, year, month, cvv2, amount) click to toggle source

Captures a payment by charging actual money

@param [String] ccn, the credit card number @param [Integer] year (expiration year) @param [Integer] month (expiration month) @param [String] cvv2 @param [Float] amount to preauth in euros

# File lib/skroutz_pay/gateways/visa.rb, line 26
def capture(ccn, year, month, cvv2, amount)
  request(ccn, year, month, cvv2, amount, :capture)
end
preauth(ccn, year, month, cvv2, amount) click to toggle source

Preauthorizes a payment The preauth sequence will approve or not the payment for this credit card but will not make any actual transation.

@param [String] ccn, the credit card number @param [Integer] year (expiration year) @param [Integer] month (expiration month) @param [String] cvv2 @param [Float] amount to preauth in euros

# File lib/skroutz_pay/gateways/visa.rb, line 15
def preauth(ccn, year, month, cvv2, amount)
  request(ccn, year, month, cvv2, amount)
end

Private Instance Methods

request(ccn, year, month, cvv2, amount, type = :preauth) click to toggle source
# File lib/skroutz_pay/gateways/visa.rb, line 32
def request(ccn, year, month, cvv2, amount, type = :preauth)
  if year < Time.now.year
    raise SkroutzPay::InvalidCreditCardData
  end

  if type == :preauth
    # actual code should be here
    rand(100) % 8 != 0
  else type == :capture
    # actual code should be here
    rand(100) % 8 != 0
  end
end