Sha256: f2860f2f2fb0ea5ec0bb42702355e0f8a4a6b60ea3062c6fbfa2472ffb33e464

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

module Spree
  class Gateway::KomojuPayEasy < KomojuGateway
    def authorize(money, source, options)
      details = {
        type:             "pay_easy",
        email:            source.email,
        phone:            source.phone,
        given_name:       source.given_name,
        family_name:      source.family_name,
        given_name_kana:  source.given_name_kana,
        family_name_kana: source.family_name_kana
      }
      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,
        bank_id:          response.params["payment_details"]["bank_id"],
        customer_id:      response.params["payment_details"]["customer_id"],
        confirmation_id:  response.params["payment_details"]["confirmation_id"],
        instructions_url: response.params["payment_details"]["instructions_url"]
      ) if response.success?

      response
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_komoju-0.1.4 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.1.3 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.1.2 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.1.1 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.1.0 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.0.9 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.0.8 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.0.7 app/models/spree/gateway/komoju_pay_easy.rb
spree_komoju-0.0.6 app/models/spree/gateway/komoju_pay_easy.rb