Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

platon.ua

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

platon.ua

  • 1.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Platon Ruby Gem

Gateway for Platon processing center (https://platon.ua/)

Installation

gem 'platon'

And then execute:

$ bundle

Or install it yourself as:

$ gem install platon

Usage as engine

/config/routes.rb
Rails.application.routes.draw do
  mount Platon::Engine => "/platon"
end
/config/initializer/platon.rb

Methods which called when something happen.

Platon::Callbacks.setup.success =->(_result) { puts 'success' }

Platon::Callbacks.setup.failed =->(_result) { puts 'failed' }

Platon::Callbacks.setup.error =->(_result) { puts 'error' }

Usage as service

create form
# product description (important keys)
data = {amount: '99.99', currency: 'USD', description: 'Show desciption less that 255 byte'} 

# product order id (important key)
order = 1892

# addition field in form :name, :value
ext = [{name: 'discont', value: 10}]

@service = Platon::FormService.call(data, order: order, extra_fields: ext)

# views/pay/index.html.erb
<form action="<%= @service.form_prop[:url] %>" method="<%= @service.form_prop[:method] %>">
  <% @service.fields.map do |field| %>
    <input type="<%= field[:type] %>" name="<%= field[:name] %>" value="<%= field[:value] %>">
  <% end %>
  <input type="submit" value="Pay">
</form>
parse response
# /app/controllers/callback_controller.rb

def create
    service = Platon::CallbackService.call(params)
    
    if service.success?
        head :ok
    else
        head :bad_request
    end
end    

General options

gem 'dotenv-rails'

# config/application.rb
Bundler.require(*Rails.groups)

Dotenv::Railtie.load
/.env
PLATON_KEY=XXXXXXXXXX
PLATON_PASSWORD=XXXXXXXXXX
PLATON_URL=https://secure.platononline.com/payment/auth
PLATON_CALLBACK_URL=http://localhost/platon
PLATON_PAYMENT_METHOD=CC

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 18 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc