Class: Gateway::KomojuKonbini

Inherits:
KomojuGateway
  • Object
show all
Defined in:
app/models/spree/gateway/komoju_konbini.rb

Instance Method Summary collapse

Instance Method Details

#authorize(money, source, options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/spree/gateway/komoju_konbini.rb', line 3

def authorize(money, source, options)
  details = {
    type:  "konbini",
    store: source.convenience,
    phone: options[:billing_address][:phone],
    email: options[:email]
  }
  options = change_options_to_dollar(options) if options[:currency] == "JPY"

  response = provider.purchase(money - options[:tax], details, options)

  source.update!(
    expires_at:        response.params["payment_deadline"].to_time,
    receipt:           response.params["payment_details"]["receipt"],
    instructions_url:  response.params["payment_details"]["instructions_url"],
    confirmation_code: response.params["payment_details"]["confirmation_code"]
  ) if response.success?
  response
end

#reusable_sources(*args) ⇒ Object



23
24
25
# File 'app/models/spree/gateway/komoju_konbini.rb', line 23

def reusable_sources(*args)
  []
end