Sha256: 6e6e27f8129d1e01a11a7b7a52ba9e7cc3387714dfcced9642f75599f107bb7e

Contents?: true

Size: 825 Bytes

Versions: 3

Compression:

Stored size: 825 Bytes

Contents

module Spree
  class Gateway::KomojuKonbini < KomojuGateway
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_komoju-0.0.5 app/models/spree/gateway/komoju_konbini.rb
spree_komoju-0.0.4 app/models/spree/gateway/komoju_konbini.rb
spree_komoju-0.0.3 app/models/spree/gateway/komoju_konbini.rb