spree_komoju 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/app/models/spree/gateway/komoju_credit_card.rb +11 -0
- data/spec/models/spree/gateway/komoju_credit_card_spec.rb +18 -0
- data/spree_komoju.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4caf7c8b13c00f6893b7bc2af9a292cf25a867a8
|
4
|
+
data.tar.gz: e72a32999a83abfcd6db71cecd74a74e4a993be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ba55860027e52f8813c8eb1853ba8c603b09cbf03fb8a88e389e2d7d78a2edec94624e97874224d9d1086e5b54ebd2d4eeb190d070829c3dc8e68abdb3996e7
|
7
|
+
data.tar.gz: ed4021bfd231af61e80e834c073285c61c4b3fb66c909e3c1c72635f6812294a82e79177be855409476676c71cdb5c4b0690fa9a61ebd47caba4c325d04913c7
|
data/Gemfile
CHANGED
@@ -4,5 +4,7 @@ gem 'spree', github: 'spree/spree', branch: '3-0-stable'
|
|
4
4
|
gem 'activemerchant', github: "komoju/active_merchant", branch: "add-komoju-gateway"
|
5
5
|
# Provides basic authentication functionality for testing parts of your engine
|
6
6
|
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
|
7
|
+
gem 'guard'
|
8
|
+
gem 'guard-rspec'
|
7
9
|
|
8
10
|
gemspec
|
@@ -4,6 +4,11 @@ module Spree
|
|
4
4
|
true
|
5
5
|
end
|
6
6
|
|
7
|
+
def credit(money, source, response_code, gateway_options)
|
8
|
+
money = cents_to_dollar(money) if gateway_options[:currency] == "JPY"
|
9
|
+
provider.refund(money, response_code, {})
|
10
|
+
end
|
11
|
+
|
7
12
|
def purchase(money, source, options)
|
8
13
|
options = change_options_to_dollar(options) if options[:currency] == "JPY"
|
9
14
|
if profile_id = source.gateway_payment_profile_id || source.gateway_customer_profile_id
|
@@ -41,5 +46,11 @@ module Spree
|
|
41
46
|
def payment_profiles_supported?
|
42
47
|
true
|
43
48
|
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def cents_to_dollar(amount)
|
53
|
+
amount / 100.0
|
54
|
+
end
|
44
55
|
end
|
45
56
|
end
|
@@ -49,6 +49,24 @@ describe Spree::Gateway::KomojuCreditCard, type: :model do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
describe "#credit" do
|
53
|
+
let(:cent_amount) { 10000 }
|
54
|
+
let(:response_code) { "external_payment_id" }
|
55
|
+
let(:source) { double("credit card") }
|
56
|
+
|
57
|
+
it "receives cents amount" do
|
58
|
+
expect(komoju_gateway).to receive(:refund).with(cent_amount, response_code, {})
|
59
|
+
subject.credit(cent_amount, source, response_code, {})
|
60
|
+
end
|
61
|
+
|
62
|
+
context "when currency is JPY" do
|
63
|
+
it "receives dollar amount" do
|
64
|
+
expect(komoju_gateway).to receive(:refund).with(100.0, response_code, {})
|
65
|
+
subject.credit(cent_amount, source, response_code, {currency: "JPY"})
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
52
70
|
describe "#create_profile" do
|
53
71
|
let(:payment) { double("payment", source: source) }
|
54
72
|
let(:details) { double("payment details") }
|
data/spree_komoju.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_komoju'
|
5
|
-
s.version = '0.0.
|
5
|
+
s.version = '0.0.7'
|
6
6
|
s.summary = 'Spree Komoju Payment Gateway'
|
7
7
|
s.description = 'Spree Payment gateway for Komoju payment gateway'
|
8
8
|
s.authors = ['Masahiro Saito', 'Chris Salzberg', 'Richard Ramsden']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_komoju
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Saito
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-12-
|
13
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: spree_core
|