[Unoffical] Borica Ruby Gem for Payments
See Borica Bank webpage for Internet 3D Secure Payments
Getting started
Add the following line to your Gemfile:
gem 'borika'or
gem install borika
require 'borika'Here is a possible configuration for development config/environments/development.rb:
Borika.configure do |config|
config.private_key = File.binread "testPrivateKey.key"
config.private_key_password = "Password"
config.public_key = File.binread "testPublicKey.cer"
config.borika_terminal_id = "11111111" # Borika KEY
config.borika_url = "https://gatet.borica.bg/boreps/"
config.request_type = "registerTransaction"
endThis parameters are default but you can change it while using on the fly.
Note: You must send the signed CSR file to Borica BANK, otherwise you will get, certificate error.
Example Usage
Let's create a url
order_id = rand(1..200000) # Give your uniq order_id
amaount = rand(100..50000) # Integer with cents
Borika::Request.new(order_id, amount).urlYou can also give more parameters, copy the default initializer belowe and modify it.
Borika::Request.new(order_id, amount, order_summary: "Order #{order_id}",
time: Time.now, language: 'EN', protocol_version: '1.0', currency: 'EUR',
process_no: 10, request_type: Borika.config.request_type, terminal_id: Borika.config.borika_terminal_id,
one_time_ticket: nil).urlLets parse the response comes from callback, in your controller:
Borika::Response.new(params[:eBorica]).hash # returns hashTesting
Not tested. Works with default parameters. Welcome to pull request.
Contributors
This repository originally inspired from Genadi Samokovarov's Borica Gem
License
GPL Licence. Copyleft. You can copy and modify this software.