Module: Barion

Defined in:
lib/barion.rb,
lib/barion/config.rb,
lib/barion/engine.rb,
lib/barion/version.rb,
app/models/barion/item.rb,
app/models/barion/address.rb,
app/models/barion/payment.rb,
app/models/barion/purchase.rb,
app/helpers/barion/main_helper.rb,
app/helpers/barion/pixel_helper.rb,
app/models/barion/payer_account.rb,
app/models/barion/application_record.rb,
app/models/barion/gift_card_purchase.rb,
app/helpers/barion/application_helper.rb,
app/models/barion/payment_transaction.rb,
app/models/concerns/barion/currencies.rb,
app/controllers/barion/main_controller.rb,
app/models/concerns/barion/data_formats.rb,
app/models/concerns/barion/json_serializer.rb,
app/controllers/barion/application_controller.rb

Overview

Schema Information

Table name: barion_payment_transactions

id                    :integer          not null, primary key
comment               :string
currency              :string(3)
payee                 :string           not null
payer                 :string
status                :integer          default("prepared"), not null
total                 :decimal(, )      not null
transaction_time      :datetime
transaction_type      :integer
created_at            :datetime         not null
updated_at            :datetime         not null
payee_transactions_id :integer
payment_id            :integer
pos_transaction_id    :string           not null
related_id            :string
transaction_id        :string

Indexes

index_barion_payment_transactions_on_payee                  (payee)
index_barion_payment_transactions_on_payee_transactions_id  (payee_transactions_id)
index_barion_payment_transactions_on_payment_id             (payment_id)
index_barion_payment_transactions_on_pos_transaction_id     (pos_transaction_id)
index_barion_payment_transactions_on_status                 (status)
index_barion_payment_transactions_on_transaction_id         (transaction_id)

Foreign Keys

payee_transactions_id  (payee_transactions_id => barion_payment_transactions.id)
payment_id             (payment_id => barion_payments.id)

Defined Under Namespace

Modules: ApplicationHelper, Currencies, DataFormats, JsonSerializer, MainHelper, PixelHelper Classes: Address, ApplicationController, ApplicationRecord, Config, Engine, Error, GiftCardPurchase, Item, MainController, PayerAccount, Payment, PaymentTransaction, Purchase, TamperedData

Constant Summary collapse

BASE_URL =
{
  test: 'https://api.test.barion.com',
  prod: 'https://api.barion.com'
}.freeze
PIXELID_PATTERN =
::Regexp.new('BP-.{10}-\d{2}').freeze
VERSION =
'0.5.4'

Class Method Summary collapse

Class Method Details

.acronymString

Returns the current acronym for Barion.

Returns:

  • (String)

    the current acronym setting, empty string by default



128
129
130
131
132
133
134
# File 'lib/barion.rb', line 128

def self.acronym
  config.acronym
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.acronym=(val) ⇒ Object

Sets the acronym for Barion.

Parameters:

  • val (String)

    the desired acronym, empty string by default



139
140
141
142
143
144
145
# File 'lib/barion.rb', line 139

def self.acronym=(val)
  config.acronym = val
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.config {|Barion::Config.instance| ... } ⇒ Object

Configure the Barion engine

Examples:

::Barion.config do |conf|
  conf.poskey = 'test'
  conf.sandbox = true
end

Yields:



33
34
35
36
37
# File 'lib/barion.rb', line 33

def self.config(&_block)
  return Barion::Config.instance unless block_given?

  yield(Barion::Config.instance)
end

.default_payeeString

Deprecated.

Use ::Barion.config.default_payee instead

Returns the current default payee for Barion.

The default payee is the default email address to which the payment confirmation email is sent.

Returns:

  • (String)

    the current default payee setting, empty string by default



183
184
185
186
187
188
189
# File 'lib/barion.rb', line 183

def self.default_payee
  config.default_payee
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.default_payee=(val) ⇒ Object

Deprecated.

Use ::Barion.config.default_payee= instead

Sets the default payee for Barion.

Updates the Barion configuration with the provided default payee. This method is deprecated and it is recommended to use ‘::Barion.config.default_payee=` instead.

Parameters:

  • val (String)

    the default payee to set



199
200
201
202
203
204
205
# File 'lib/barion.rb', line 199

def self.default_payee=(val)
  config.default_payee = val
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.deprecatorActiveSupport::Deprecation

Returns the deprecator instance for the Barion module.

This is a singleton method that initializes the deprecator if it hasn’t been initialized yet, using ActiveSupport::Deprecation.

Returns:

  • (ActiveSupport::Deprecation)

    the deprecator instance



22
23
24
# File 'lib/barion.rb', line 22

def self.deprecator
  @deprecator ||= ActiveSupport::Deprecation.new('1.0', 'Barion')
end

.item_classClass

Deprecated.

Use ::Barion.config.item_class instead

Returns the class used for item representation.

This method is deprecated and it is recommended to use ‘::Barion.config.item_class` instead.

Returns:

  • (Class)

    the class used for item representation



243
244
245
246
247
248
249
# File 'lib/barion.rb', line 243

def self.item_class
  config.item_class
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.item_class=(val) ⇒ Object

Deprecated.

Use ::Barion.config.item_class= instead

Sets the class used for item representation.

Updates the Barion configuration with the provided item class. This method is deprecated and it is recommended to use ‘::Barion.config.item_class=` instead.

Parameters:

  • val (Class)

    the class to use for item representation



260
261
262
263
264
265
266
# File 'lib/barion.rb', line 260

def self.item_class=(val)
  config.item_class = val
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.pixel_idString?

Deprecated.

Use ::Barion.config.pixel_id instead.

Returns the current Barion Pixel ID.

The Pixel ID is used for tracking and analytics purposes.

Returns:

  • (String, nil)

    the current Pixel ID setting



153
154
155
156
157
158
159
# File 'lib/barion.rb', line 153

def self.pixel_id
  config.pixel_id
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.pixel_id=(val) ⇒ Object

Sets the Barion Pixel ID.

Updates the Barion configuration with the provided Pixel ID. This method is deprecated and it is recommended to use ‘::Barion.config.pixel_id=` instead.

Parameters:

  • val (String)

    the Pixel ID to set



168
169
170
171
172
173
174
# File 'lib/barion.rb', line 168

def self.pixel_id=(val)
  config.pixel_id = val
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.poskeyString?

Deprecated.

Use ::Barion.config.poskey instead.

Returns the current POSKey setting.

Returns:

  • (String, nil)

    the current POSKey setting



83
84
85
86
87
88
89
# File 'lib/barion.rb', line 83

def self.poskey
  config.poskey
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.poskey=(val) ⇒ Object

Deprecated.

Use ::Barion.config.poskey= instead

Sets the POSKey for the shop.

Parameters:

  • val (String)

    the POSKey provided by Barion



95
96
97
98
99
100
101
# File 'lib/barion.rb', line 95

def self.poskey=(val)
  config.poskey = (val)
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.publickeyString?

Returns the current PublicKey setting.

Returns:

  • (String, nil)

    the current PublicKey setting



106
107
108
109
110
111
112
# File 'lib/barion.rb', line 106

def self.publickey
  config.publickey
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.publickey=(val) ⇒ Object

Sets the PublicKey for the shop.

Parameters:

  • val (String)

    the PublicKey provided by Barion



117
118
119
120
121
122
123
# File 'lib/barion.rb', line 117

def self.publickey=(val)
  config.publickey = (val)
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.rest_client_classClass

Deprecated.

Use ::Barion.config.rest_client_class instead

Returns the class used for making REST calls to the Barion API.

This method is deprecated and it is recommended to use ‘::Barion.config.rest_client_class` instead.

Returns:

  • (Class)

    the class used for making REST calls



274
275
276
277
278
279
280
# File 'lib/barion.rb', line 274

def self.rest_client_class
  config.rest_client_class
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.rest_client_class=(val) ⇒ Object

Deprecated.

Use ::Barion.config.rest_client_class= instead

Sets the class used for making REST calls to the Barion API.

Updates the Barion configuration with the provided REST client class. This method is deprecated and it is recommended to use ‘::Barion.config.rest_client_class=` instead.

Parameters:

  • val (Class)

    the class to use for making REST calls



290
291
292
293
294
295
296
# File 'lib/barion.rb', line 290

def self.rest_client_class=(val)
  config.rest_client_class = val
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.sandboxboolean

Deprecated.

Returns whether the Barion engine is in sandbox mode.

Returns:

  • (boolean)

    whether the engine is in sandbox mode



43
44
45
46
47
48
49
# File 'lib/barion.rb', line 43

def self.sandbox
  config.sandbox
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.sandbox=(val) ⇒ Object

Deprecated.

Use ::Barion.config.sandbox= instead

Sets whether the Barion engine is in sandbox mode.

Parameters:

  • val (boolean)

    the desired state for sandbox mode true to enable sandbox mode, false to disable it



56
57
58
59
60
61
62
# File 'lib/barion.rb', line 56

def self.sandbox=(val)
  config.sandbox = val
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.sandbox?Boolean

Deprecated.

Use ::Barion.config.sandbox? instead.

Returns whether the Barion engine is in sandbox mode.

This method delegates to the Barion::Config instance’s sandbox? method to determine the current sandbox mode setting.

Returns:

  • (Boolean)

    true if in sandbox mode, false otherwise



71
72
73
74
75
76
77
# File 'lib/barion.rb', line 71

def self.sandbox?
  config.sandbox?
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.user_classObject

Deprecated.

Use ::Barion.config.user_class instead

Returns the class used for user authentication.

This method is deprecated and it is recommended to use ‘::Barion.config.user_class` instead.



212
213
214
215
216
217
218
# File 'lib/barion.rb', line 212

def self.user_class
  config.user_class
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end

.user_class=(val) ⇒ Object

Deprecated.

Use ::Barion.config.user_class= instead

Sets the class used for user authentication.

Updates the Barion configuration with the provided user class. This method is deprecated and it is recommended to use ‘::Barion.config.user_class=` instead.

Parameters:

  • val (Class)

    the class to use for user authentication



228
229
230
231
232
233
234
# File 'lib/barion.rb', line 228

def self.user_class=(val)
  config.user_class = val
  deprecator.warn(
    "#{__method__} is deprecated. " \
    "Use ::Barion.config.#{__method__} instead."
  )
end