New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gmo_payment_gem

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gmo_payment_gem

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

gmo_payment_gem

Github
Unofficial wrapper for GMO Payment Gateway API
Easy to make request to GMO Payment Gateway

Background

  • Need a simple scenario about payment, eg: Register member and credit card info, then execute monthly payment
  • Do not want to know others api with a ton of documents
  • Lightweight library with no dependency, simple configurations, and extend easily

Install

  • In Gemfile: gem 'gmo_payment_gem' then $bundle install
  • Or directly with: $gem install gmo_payment_gem

Configuration

  • For rails app: In config/environment.rb, insert: require 'gmo_payment' unless defined?(GmoPayment)
    then in config/environments/env_file.rb (Eg: config/environments/development.rb):
   config.after_initialize do
       GmoPayment::Configurations.all = {
         site_id: ENV['DEV_PAYMENT_SITE_ID'],
         site_pass: ENV['DEV_PAYMENT_SITE_PASS'],
         shop_id: ENV['DEV_PAYMENT_SHOP_ID'],
         shop_pass: ENV['DEV_PAYMENT_SHOP_PASS'],
         log_path: "#{Rails.root.to_s}/log/dev.log",
         base_url: ENV['DEV_PAYMENT_BASE_URL'],
         more_urls: {},
         more_errors: {}
       }
       GmoPayment::Configurations.check_valid!
   end
  • For other apps/libs:
require 'gmo_payment'

then fill above config to where init your app.

  • Configurations description
KeyRequired?Value formatDescription
site_idYesString
site_passYesString
shop_idYesString
shop_passYesString
log_pathYesStringUse for log file
base_urlYesStringUse for base url of request endpoint.
Eg: With endpoint: https://pt01.mul-pay.jp/payment/SaveCard.idPass
then base_url is https://pt01.mul-pay.jp/payment
more_urlsNoHashUse for extend/overwrite existing api urls endpoint
more_errorsNoHashUse for extend/overwrite existing api errors

Usage

Wherever you need to execute a request to GMO Payment

# options = {}, type_site = true, logger = nil is default params
gmo_payment = GmoPayment.new
# Prepare your params here
params = {}
#List support_request see as bellow
response = gmo_payment.support_request(params)
if response.success?
  # Do your stuff here
end
  • List support_request :register_member
    :delete_member
    :search_member
    :save_card
    :delete_card
    :register_transaction
    :submit_transaction
    :confirm_transaction
    :transaction_status

Extend

If you don't see what request you need in list support_request, you can define your request with simple code as below:

class YourPayment < GmoPayment
  def request_your_api(params = {})
    # You can define request url to above config in more_urls hash
    api_url = GmoPayment::ApiUrls.fetch('YOUR_API_REQUEST_KEY')
    call_api(api_url, params)
  end
end

then

your_payment = YourPayment.new
params = {} # Define your request params here
response = your_payment.request_your_api(params)
response.success do |api_url, response_http_code, response_body, response_body_parsed|
 # Your code to define how is success
end

Development

All PR are welcome. Make sure all test cases are passed by command: $rake test

TODO

  • RDoc
  • validate request params base on each type of request

License

MIT.

FAQs

Package last updated on 13 Jan 2017

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