module AstroPay

Class of AstroPay Card

@author Luis Galaviz (galaviz.lm@gmail.com)

Class of AstroPay Direct

@author Luis Galaviz (galaviz.lm@gmail.com)

Constants

VERSION

Attributes

configuration[W]

Public Class Methods

card(*args) click to toggle source

Gets a new [AstroPay::Card] instance with the given arguments.

@params args [Array] (See AstroPay::Card#initialize). @return [AstroPay::Card] object.

# File lib/astro_pay.rb, line 50
def self.card(*args)
  Card.new(*args)
end
configuration() click to toggle source

Gets the configuration attribute.

@return [AstroPay::Configuration] object.

# File lib/astro_pay.rb, line 29
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source

Allows to set the configuration passing a block where the values are set.

# File lib/astro_pay.rb, line 34
def self.configure
  yield(configuration)
end
create_card(number, ccv, exp_date, amount, unique_id, invoice_num, additional_params={}) click to toggle source

Gets a new [AstroPay::Card] instance with the given arguments and some optional values. See the AstroPay Card Manual.

@param number [String] AstroPay Card number. @param ccv [Int] AstroPay Card security code. @param exp_date [String] expiration date of AstroPay Card. Format: MM/YYYY @param amount [Float] transaction amount. @param bank [String] bank code. @param unique_id [String] unique, anonymized identifier of users in the

merchant system.

@param invoice_num [String] unique identifier of merchant transaction. @param additional_params [Hash] other arguments. @return [AstroPay::Card] object.

# File lib/astro_pay.rb, line 91
def self.create_card(number, ccv, exp_date, amount, unique_id, invoice_num, additional_params={})
  card(
    number: number,
    ccv: ccv,
    exp_date: exp_date,
    amount: amount,
    unique_id: unique_id,
    invoice_num: invoice_num,
    additional_params: additional_params
  ).auth_capture_transaction
end
create_direct(invoice, amount, iduser, country, bank='', sub_code=1, args={}) click to toggle source

Gets a new [AstroPay::Direct] instance with the given arguments and some optional values. See the AstroPay Direct Manual.

@param invoice [String] unique transaction ID number at the merchant. @param amount [Float] the amount of the payment. @param iduser [String] user’s unique ID at the merchant / account number. @param country [String] country code. @param bank [String] bank code. @param sub_code [Int] mandatory parameter for PSPs. @param args [Hash] Other arguments. @return [AstroPay::Direct] object.

# File lib/astro_pay.rb, line 65
def self.create_direct(invoice, amount, iduser, country, bank='', sub_code=1, args={})
  direct(
    args.merge(
      invoice: invoice,
      amount: amount,
      iduser: iduser,
      bank: bank,
      country: country,
      sub_code: sub_code
    )
  ).create
end
direct(*args) click to toggle source

Gets a new [AstroPay::Direct] instance with the given arguments.

@param args [Array] (See AstroPay::Direct#initialize). @return [AstroPay::Direct] object.

# File lib/astro_pay.rb, line 42
def self.direct(*args)
  Direct.new(*args)
end