module GMO::Payment::ShopAndSiteAPIMethods

Attributes

host[R]
locale[R]
shop_id[R]
shop_pass[R]
site_id[R]
site_pass[R]

Public Class Methods

new(options = {}) click to toggle source
   # File lib/gmo/shop_and_site_api.rb
18 def initialize(options = {})
19   @shop_id   = options[:shop_id]
20   @shop_pass = options[:shop_pass]
21   @site_id   = options[:site_id]
22   @site_pass = options[:site_pass]
23   @host      = options[:host]
24   @locale    = options.fetch(:locale, GMO::Const::DEFAULT_LOCALE)
25   unless @site_id && @site_pass && @shop_id && @shop_pass && @host
26     raise ArgumentError, "Initialize must receive a hash with :site_id, :site_pass, :shop_id, :shop_pass and either :host! (received #{options.inspect})"
27   end
28 end

Public Instance Methods

exec_tran_brandtoken(options = {}) click to toggle source
@params ###

AccessID AccessPass OrderID TokenType Token MemberID SeqMode TokenSeq ClientField1 ClientField2 ClientField3

@return ###

Status OrderID Forward Approve TranID TranDate ClientField1 ClientField2 ClientField3

example ###

gmo.exec_tran_brandtoken({

order_id: "597ae8c36120b23a3c00014e",
access_id: "139f8ec33a07c55f406937c52ce4473d",
access_pass: "2689b204d2c17192fa35f9269fa7e744",
token_type: :apple_pay,
token: <Base64 encoded payment data>,
member_id: "mem10001"

})

> {“Status”=>“CAPTURE”, “OrderID”=>“597ae8c36120b23a3c00014e”, “Forward”=>“2a99663”, “Approve”=>“5487394”, “TranID”=>“1707281634111111111111771216”, “TranDate”=>“20170728163453”, “ClientField1”=>“Custom field value 1”, “ClientField2”=>“Custom field value 2”, “ClientField3”=>“Custom field value 3”}

    # File lib/gmo/shop_and_site_api.rb
 98 def exec_tran_brandtoken(options = {})
 99   name = "ExecTranBrandtoken.idPass"
100   options[:token_type] = GMO::Const::TOKEN_TYPES_MAP[options[:token_type]]
101   required = [:access_id, :access_pass, :member_id, :order_id]
102   assert_required_options(required, options)
103   post_request name, options
104 end
trade_brandtoken(options = {}) click to toggle source
@params ###

MemberID OrderID DefaultFlag SeqMode

@return ###

TokenSeq CardNoToken Forward

example ###

gmo.trade_brandtoken({

member_id: 'mem10001',
order_id: 'ord10001'

})

> {“TokenSeq”=>“0”, “CardNoToken”=>“*************111”, “Forward”=>“2a99663”}

   # File lib/gmo/shop_and_site_api.rb
59 def trade_brandtoken(options = {})
60   name = "TradedBrandtoken.idPass"
61   required = [:order_id, :member_id]
62   assert_required_options(required, options)
63   post_request name, options
64 end
trade_card(options = {}) click to toggle source

2.17.2.1.決済後カード登録 指定されたオーダーID の取引に使用したカードを登録します。

@return ###

CardSeq CardNo Forward

   # File lib/gmo/shop_and_site_api.rb
37 def trade_card(options = {})
38   name = "TradedCard.idPass"
39   required = [:order_id, :member_id]
40   assert_required_options(required, options)
41   post_request name, options
42 end

Private Instance Methods

api_call(name, args = {}, verb = "post", options = {}) click to toggle source
    # File lib/gmo/shop_and_site_api.rb
108 def api_call(name, args = {}, verb = "post", options = {})
109   args.merge!({
110     "ShopID"   => @shop_id,
111     "ShopPass" => @shop_pass,
112     "SiteID"   => @site_id,
113     "SitePass" => @site_pass
114   })
115   api(name, args, verb, options) do |response|
116     if response.is_a?(Hash) && !response["ErrInfo"].nil?
117       raise APIError.new(response, locale)
118     end
119   end
120 end