active_merchant-epsilon 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6859dadedea47fb86e3a1230339fa85ba79e498
4
- data.tar.gz: 6ab7a7857e323876014c07d16b28aa4811155d3c
3
+ metadata.gz: 75138bb18726ef3140954a16bb725c7171b7a05c
4
+ data.tar.gz: 386ca212536ebd8d1838977127ab2a9948dafbfb
5
5
  SHA512:
6
- metadata.gz: d0483a5f5153af6f6d52921ed28e4e7e6768d6168e47c328ff5a8048b840697c9ff9e434a16f30e198c04e14dc7beb692ec7fd260fe1f3fb171016567806185a
7
- data.tar.gz: 6b7440f5543d497283b6b874359ac35ff3dd2bb686692cc734eb5f1a4ecb1841ae7a29eafa1a48e2110c04885dd95bd1ee82af08ee21c8229e3ec4004378076d
6
+ metadata.gz: 0d55045bfdd9012f0ecff2f1bab04137f54af0e95d6e851e54f9c7ccba2b23e815401f2357185831bcee30a02f2f7aa6aac7abc349ccef504bf9e4d6667546a8
7
+ data.tar.gz: d6b5677122f08f140dd1f981760caa6f7ec7a9f4179471550f170ea8d4e5f748c685a83366d473a2e776378dde13d38e38182296e36a155046fd040c26446b45
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'tapp'
29
29
  spec.add_development_dependency 'webmock'
30
30
  spec.add_development_dependency 'vcr'
31
+ spec.add_development_dependency 'mocha'
31
32
  end
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
 
30
30
  self.abstract_class = true
31
31
 
32
- cattr_accessor :contract_code, :proxy_address, :proxy_port
32
+ cattr_accessor :contract_code, :proxy_address, :proxy_port, :encoding
33
33
 
34
34
  self.test_url = 'https://beta.epsilon.jp/cgi-bin/order/'
35
35
  self.live_url = 'https://secure.epsilon.jp/cgi-bin/order/'
@@ -68,7 +68,12 @@ module ActiveMerchant #:nodoc:
68
68
  end
69
69
 
70
70
  def post_data(parameters = {})
71
- parameters.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
71
+ parameters.map { |k, v| "#{k}=#{CGI.escape(encode_value(v.to_s))}" }.join('&')
72
+ end
73
+
74
+ def encode_value(value)
75
+ return value unless encoding
76
+ value.encode(encoding, invalid: :replace, undef: :replace)
72
77
  end
73
78
 
74
79
  def message_from(response)
@@ -1,5 +1,5 @@
1
1
  module ActiveMerchant
2
2
  module Epsilon
3
- VERSION = "0.5.7"
3
+ VERSION = "0.5.8"
4
4
  end
5
5
  end
data/test/test_helper.rb CHANGED
@@ -9,6 +9,7 @@ require 'tapp'
9
9
  require 'vcr'
10
10
 
11
11
  require 'webmock/minitest'
12
+ require 'mocha/mini_test'
12
13
 
13
14
  Dotenv.load
14
15
 
@@ -1,6 +1,8 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class EpsilonGatewayTest < MiniTest::Test
4
+ include SamplePaymentMethods
5
+
4
6
  def test_set_proxy_address_and_port
5
7
  ActiveMerchant::Billing::EpsilonGateway.proxy_address = 'http://myproxy.dev'
6
8
  ActiveMerchant::Billing::EpsilonGateway.proxy_port = 1234
@@ -8,4 +10,25 @@ class EpsilonGatewayTest < MiniTest::Test
8
10
  assert_equal(gateway.proxy_address, 'http://myproxy.dev')
9
11
  assert_equal(gateway.proxy_port, 1234)
10
12
  end
13
+
14
+ def test_purchase_post_data_encoding_eucjp
15
+ ActiveMerchant::Billing::EpsilonBaseGateway.encoding = Encoding::EUC_JP
16
+ gateway = ActiveMerchant::Billing::EpsilonGateway.new
17
+ fixture = YAML.load_file('test/fixtures/vcr_cassettes/purchase_successful.yml')
18
+ response_body = fixture['http_interactions'][0]['response']['body']['string']
19
+ detail = {
20
+ user_name: '山田太郎',
21
+ item_name: 'すごい商品',
22
+ order_number: '12345678',
23
+ }
24
+ gateway.expects(:ssl_post).with(
25
+ instance_of(String),
26
+ all_of(
27
+ includes('user_name=%BB%B3%C5%C4%C2%C0%CF%BA'),
28
+ includes('item_name=%A4%B9%A4%B4%A4%A4%BE%A6%C9%CA'),
29
+ includes('order_number=12345678'),
30
+ )
31
+ ).returns(response_body)
32
+ gateway.purchase(100, valid_credit_card, detail)
33
+ end
11
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_merchant-epsilon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi TAKAHASHI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: mocha
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description: Epsilon integration for ActiveMerchant.
140
154
  email:
141
155
  - kenichi.taka@gmail.com
@@ -212,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
226
  version: '0'
213
227
  requirements: []
214
228
  rubyforge_project:
215
- rubygems_version: 2.5.1
229
+ rubygems_version: 2.6.6
216
230
  signing_key:
217
231
  specification_version: 4
218
232
  summary: Epsilon integration for ActiveMerchant.