This gem provides WebToPay (mokejimai.lt) Ruby API implementation with some useful Rails helpers
Add to your Gemfile:
gem 'webtopay', git: 'https://github.com/simonasdev/webtopay.git'
Run:b
bundle install
Create initializer config/initializers/webtopay.rb
WebToPay.configuredo |config|
config.project_id=00000config.sign_password='your sign password'endProtect accepturl, cancelurl, callbackurl actions in controllers:
includeWebToPay::ControllerHelperwebtopay:accept,:cancel,:callbackdefaccept# write here code which do some stuff# use instance variable "webtopay_data" to access data from mokejimai.ltrendertext: "Your payment #{webtopay_data[:orderid]} has been successfully received. Thank you!"enddefcallback# write here code which do some stuffrendertext: "OK"endYou can also use helper method to generate required form for MACRO payments in templates: app/helpers/application_helper.rb:
includeWebToPay::HelperAny template (please note that the form doesn't contain any submit button, it needs to be submitted with JS)
<%= webtopay_macro_formtest: 1,orderid: 123,amount: 2000,payment: 'vb',country: 'lt',paytext: "Billing for XX at the website XXX" %>=========== Copyright (c) 2013 Kristijonas Urbaitis, released under the MIT license