gmo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +22 -0
  3. data/README.ja.md +54 -0
  4. data/README.md +54 -0
  5. data/Rakefile +15 -0
  6. data/autotest/discover.rb +1 -0
  7. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_change_order_auth_to_sale.yml +90 -0
  8. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_gets_data_about_order.yml +90 -0
  9. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_got_error_if_missing_options.yml +32 -0
  10. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_gets_data_about_order.yml +90 -0
  11. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_got_error_if_missing_options.yml +32 -0
  12. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml +32 -0
  13. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml +32 -0
  14. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml +32 -0
  15. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml +32 -0
  16. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_gets_data_about_order.yml +32 -0
  17. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_got_error_if_missing_options.yml +32 -0
  18. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_gets_data_about_order.yml +34 -0
  19. data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_got_error_if_missing_options.yml +34 -0
  20. data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_error_if_missing_options.yml +32 -0
  21. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_card_gets_data_about_a_card.yml +34 -0
  22. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_member_gets_data_about_a_member.yml +34 -0
  23. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_gets_data_about_a_card.yml +34 -0
  24. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_gets_data_about_a_transaction.yml +32 -0
  25. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_got_error_if_missing_options.yml +32 -0
  26. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_gets_data_about_a_card.yml +65 -0
  27. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_member_gets_data_about_a_member.yml +65 -0
  28. data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_update_member_gets_data_about_a_transaction.yml +32 -0
  29. data/gmo.gemspec +30 -0
  30. data/lib/gmo.rb +99 -0
  31. data/lib/gmo/errors.rb +51 -0
  32. data/lib/gmo/http_services.rb +77 -0
  33. data/lib/gmo/shop_and_site_api.rb +56 -0
  34. data/lib/gmo/shop_api.rb +218 -0
  35. data/lib/gmo/site_api.rb +146 -0
  36. data/lib/gmo/version.rb +3 -0
  37. data/spec/gmo/api_spec.rb +32 -0
  38. data/spec/gmo/error_spec.rb +25 -0
  39. data/spec/gmo/http_service_spec.rb +23 -0
  40. data/spec/gmo/shop_and_site_api_spec.rb +45 -0
  41. data/spec/gmo/shop_api_spec.rb +261 -0
  42. data/spec/gmo/site_api_spec.rb +140 -0
  43. data/spec/spec_helper.rb +21 -0
  44. data/spec/support/config.example.yml +4 -0
  45. data/spec/support/config.yml +4 -0
  46. data/spec/support/config_loader.rb +2 -0
  47. data/spec/support/factory.rb +8 -0
  48. data/spec/support/vcr.rb +21 -0
  49. data/travis.yml +11 -0
  50. metadata +202 -0
@@ -0,0 +1,8 @@
1
+ pkg
2
+ .project
3
+ Gemfile.lock
4
+ .rvmrc
5
+ *.rbc
6
+ *~
7
+ .yardoc/
8
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source :rubygems
2
+
3
+ group :development do
4
+ gem "yard"
5
+ end
6
+
7
+ group :development, :test do
8
+ gem 'guard'
9
+ gem 'guard-rspec'
10
+ gem 'simplecov'
11
+
12
+ if RUBY_PLATFORM =~ /darwin/
13
+ gem "ruby_gntp"
14
+ gem "rb-fsevent"
15
+ end
16
+ if RUBY_PLATFORM =~ /linux/
17
+ gem 'libnotify'
18
+ gem 'rb-inotify'
19
+ end
20
+ end
21
+
22
+ gemspec
@@ -0,0 +1,54 @@
1
+ GMO
2
+ ====
3
+ [![Build Status](https://travis-ci.org/t-k/gmo-payment-ruby.png)](https://travis-ci.org/t-k/gmo-payment-ruby)
4
+
5
+ GMO is a Ruby client library for the GMO Payment Platform, supporting the PG Multi Payment API, exec transactions, register users, and so on.
6
+
7
+ Installation
8
+ ---
9
+
10
+ Install GMO as a gem:
11
+ ```bash
12
+ gem install gmo
13
+ ```
14
+
15
+ or add to your Gemfile:
16
+ ```ruby
17
+ # Gemfile
18
+ gem "gmo"
19
+ ```
20
+ and run bundle install to install the dependency.
21
+
22
+ Overview
23
+ ---
24
+
25
+ TODO
26
+ ---
27
+ * add tests
28
+ * set production server
29
+ * improve docs
30
+
31
+ Issues
32
+ ---
33
+
34
+ Usage
35
+ ---
36
+ ```ruby
37
+ require 'gmo'
38
+ # setup
39
+ gmo = GMO::Payment::ShopAPI.new({:shop_id => "SHOP_ID", :shop_pass => "SHOP_PASS"})
40
+ #
41
+ option = {
42
+ :order_id => 1,
43
+ :job_cd => "AUTH",
44
+ :amount => 100
45
+ }
46
+ result = gmo.entry_tran(option)
47
+ ```
48
+
49
+ Authors and Contributors
50
+ ---
51
+ * [Tatsuo Kaniwa](https://github.com/t-k) - Creator of the project
52
+
53
+ Copyright
54
+ ---
@@ -0,0 +1,54 @@
1
+ GMO
2
+ ====
3
+ [![Build Status](https://travis-ci.org/t-k/gmo-payment-ruby.png)](https://travis-ci.org/t-k/gmo-payment-ruby)
4
+
5
+ GMO is a Ruby client library for the GMO Payment Platform, supporting the PG Multi Payment API, exec transactions, register users, and so on.
6
+
7
+ Installation
8
+ ---
9
+
10
+ Install GMO as a gem:
11
+ ```bash
12
+ gem install gmo
13
+ ```
14
+
15
+ or add to your Gemfile:
16
+ ```ruby
17
+ # Gemfile
18
+ gem "gmo"
19
+ ```
20
+ and run bundle install to install the dependency.
21
+
22
+ Overview
23
+ ---
24
+
25
+ TODO
26
+ ---
27
+ * add tests
28
+ * set production server
29
+ * improve docs
30
+
31
+ Issues
32
+ ---
33
+
34
+ Usage
35
+ ---
36
+ ```ruby
37
+ require 'gmo'
38
+ # setup
39
+ gmo = GMO::Payment::ShopAPI.new({:shop_id => "SHOP_ID", :shop_pass => "SHOP_PASS"})
40
+ #
41
+ option = {
42
+ :order_id => 1,
43
+ :job_cd => "AUTH",
44
+ :amount => 100
45
+ }
46
+ result = gmo.entry_tran(option)
47
+ ```
48
+
49
+ Authors and Contributors
50
+ ---
51
+ * [Tatsuo Kaniwa](https://github.com/t-k) - Creator of the project
52
+
53
+ Copyright
54
+ ---
@@ -0,0 +1,15 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'bundler/setup'
5
+ Bundler::GemHelper.install_tasks
6
+ rescue LoadError
7
+ puts 'although not required, bundler is recommened for running the tests'
8
+ end
9
+
10
+ task :default => :spec
11
+
12
+ require 'rspec/core/rake_task'
13
+ RSpec::Core::RakeTask.new do |t|
14
+ t.rspec_opts = ["--color", '--format doc']
15
+ end
@@ -0,0 +1 @@
1
+ Autotest.add_discovery { "rspec2" }
@@ -0,0 +1,90 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://pt01.mul-pay.jp/payment/EntryTran.idPass
6
+ body:
7
+ encoding: UTF-8
8
+ string: OrderID=1002&JobCd=AUTH&Amount=100&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Sun, 17 Feb 2013 07:25:23 GMT
21
+ Connection:
22
+ - close
23
+ Content-Type:
24
+ - text/plain;charset=Windows-31J
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: US-ASCII
29
+ string: AccessID=b4cc1d826766a26bbcb89f8588efe6bf&AccessPass=62c3e482aae243e02de31c23c77a6c33
30
+ http_version:
31
+ recorded_at: Sun, 17 Feb 2013 07:25:23 GMT
32
+ - request:
33
+ method: post
34
+ uri: https://pt01.mul-pay.jp/payment/ExecTran.idPass
35
+ body:
36
+ encoding: UTF-8
37
+ string: AccessID=b4cc1d826766a26bbcb89f8588efe6bf&AccessPass=62c3e482aae243e02de31c23c77a6c33&OrderID=1002&Method=1&PayTimes=1&CardNo=4111111111111111&Expire=1405&HttpAccept=null&HttpUserAgent=null&DeviceCategory=0&ClientField1=null&ClientField2=null&ClientField3=null&ClientFieldFlag=0&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
38
+ headers:
39
+ Accept:
40
+ - ! '*/*'
41
+ User-Agent:
42
+ - Ruby
43
+ response:
44
+ status:
45
+ code: 200
46
+ message: OK
47
+ headers:
48
+ Date:
49
+ - Sun, 17 Feb 2013 07:25:23 GMT
50
+ Connection:
51
+ - close
52
+ Content-Type:
53
+ - text/plain;charset=Windows-31J
54
+ Transfer-Encoding:
55
+ - chunked
56
+ body:
57
+ encoding: US-ASCII
58
+ string: ACS=0&OrderID=1002&Forward=2a99662&Method=1&PayTimes=&Approve=6299684&TranID=1302171624111111111111197566&TranDate=20130217162524&CheckString=4fec41ca42b3b6bc17bfbabb30a0a68c
59
+ http_version:
60
+ recorded_at: Sun, 17 Feb 2013 07:25:24 GMT
61
+ - request:
62
+ method: post
63
+ uri: https://pt01.mul-pay.jp/payment/AlterTran.idPass
64
+ body:
65
+ encoding: UTF-8
66
+ string: AccessID=b4cc1d826766a26bbcb89f8588efe6bf&AccessPass=62c3e482aae243e02de31c23c77a6c33&JobCd=SALES&Amount=100&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
67
+ headers:
68
+ Accept:
69
+ - ! '*/*'
70
+ User-Agent:
71
+ - Ruby
72
+ response:
73
+ status:
74
+ code: 200
75
+ message: OK
76
+ headers:
77
+ Date:
78
+ - Sun, 17 Feb 2013 07:25:24 GMT
79
+ Connection:
80
+ - close
81
+ Content-Type:
82
+ - text/plain;charset=Windows-31J
83
+ Transfer-Encoding:
84
+ - chunked
85
+ body:
86
+ encoding: US-ASCII
87
+ string: AccessID=b4cc1d826766a26bbcb89f8588efe6bf&AccessPass=62c3e482aae243e02de31c23c77a6c33&Forward=2a99662&Approve=6299684&TranID=1302171624111111111111197566&TranDate=20130217162524
88
+ http_version:
89
+ recorded_at: Sun, 17 Feb 2013 07:25:24 GMT
90
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,90 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://pt01.mul-pay.jp/payment/EntryTran.idPass
6
+ body:
7
+ encoding: UTF-8
8
+ string: OrderID=1001&JobCd=AUTH&Amount=100&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Sun, 17 Feb 2013 07:22:25 GMT
21
+ Connection:
22
+ - close
23
+ Content-Type:
24
+ - text/plain;charset=Windows-31J
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: US-ASCII
29
+ string: AccessID=0aa795e42d4f39d7df543677991b3c06&AccessPass=7a82e5b97b43b618072ba70c6d47664e
30
+ http_version:
31
+ recorded_at: Sun, 17 Feb 2013 07:22:25 GMT
32
+ - request:
33
+ method: post
34
+ uri: https://pt01.mul-pay.jp/payment/ExecTran.idPass
35
+ body:
36
+ encoding: UTF-8
37
+ string: AccessID=0aa795e42d4f39d7df543677991b3c06&AccessPass=7a82e5b97b43b618072ba70c6d47664e&OrderID=1001&Method=1&PayTimes=1&CardNo=4111111111111111&Expire=1405&HttpAccept=null&HttpUserAgent=null&DeviceCategory=0&ClientField1=null&ClientField2=null&ClientField3=null&ClientFieldFlag=0&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
38
+ headers:
39
+ Accept:
40
+ - ! '*/*'
41
+ User-Agent:
42
+ - Ruby
43
+ response:
44
+ status:
45
+ code: 200
46
+ message: OK
47
+ headers:
48
+ Date:
49
+ - Sun, 17 Feb 2013 07:22:25 GMT
50
+ Connection:
51
+ - close
52
+ Content-Type:
53
+ - text/plain;charset=Windows-31J
54
+ Transfer-Encoding:
55
+ - chunked
56
+ body:
57
+ encoding: US-ASCII
58
+ string: ACS=0&OrderID=1001&Forward=2a99662&Method=1&PayTimes=&Approve=6299679&TranID=1302171621111111111111197561&TranDate=20130217162226&CheckString=4bd26fe8586fdd2c0d3f1aeb88a8bc8b
59
+ http_version:
60
+ recorded_at: Sun, 17 Feb 2013 07:22:26 GMT
61
+ - request:
62
+ method: post
63
+ uri: https://pt01.mul-pay.jp/payment/AlterTran.idPass
64
+ body:
65
+ encoding: UTF-8
66
+ string: AccessID=0aa795e42d4f39d7df543677991b3c06&AccessPass=7a82e5b97b43b618072ba70c6d47664e&JobCd=RETURN&Amount=100&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
67
+ headers:
68
+ Accept:
69
+ - ! '*/*'
70
+ User-Agent:
71
+ - Ruby
72
+ response:
73
+ status:
74
+ code: 200
75
+ message: OK
76
+ headers:
77
+ Date:
78
+ - Sun, 17 Feb 2013 07:22:26 GMT
79
+ Connection:
80
+ - close
81
+ Content-Type:
82
+ - text/plain;charset=Windows-31J
83
+ Transfer-Encoding:
84
+ - chunked
85
+ body:
86
+ encoding: US-ASCII
87
+ string: AccessID=0aa795e42d4f39d7df543677991b3c06&AccessPass=7a82e5b97b43b618072ba70c6d47664e&Forward=2a99662&Approve=6299680&TranID=1302171621111111111111197562&TranDate=20130217162227
88
+ http_version:
89
+ recorded_at: Sun, 17 Feb 2013 07:22:27 GMT
90
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,32 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://pt01.mul-pay.jp/payment/AlterTran.idPass
6
+ body:
7
+ encoding: UTF-8
8
+ string: AccessID=null&AccessPass=null&JobCd=SALES&Amount=null&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Sun, 17 Feb 2013 07:19:20 GMT
21
+ Connection:
22
+ - close
23
+ Content-Type:
24
+ - text/plain;charset=Windows-31J
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: US-ASCII
29
+ string: ErrCode=E01|E01|E01&ErrInfo=E01090008|E01100008|E01110002
30
+ http_version:
31
+ recorded_at: Sun, 17 Feb 2013 07:19:21 GMT
32
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,90 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://pt01.mul-pay.jp/payment/EntryTran.idPass
6
+ body:
7
+ encoding: UTF-8
8
+ string: OrderID=1003&JobCd=AUTH&Amount=100&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Sun, 17 Feb 2013 07:29:35 GMT
21
+ Connection:
22
+ - close
23
+ Content-Type:
24
+ - text/plain;charset=Windows-31J
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: US-ASCII
29
+ string: AccessID=781aaf3823503b49950d7da8952bd50f&AccessPass=e12780a4480ddde5b4e9e054759ee327
30
+ http_version:
31
+ recorded_at: Sun, 17 Feb 2013 07:29:35 GMT
32
+ - request:
33
+ method: post
34
+ uri: https://pt01.mul-pay.jp/payment/ExecTran.idPass
35
+ body:
36
+ encoding: UTF-8
37
+ string: AccessID=781aaf3823503b49950d7da8952bd50f&AccessPass=e12780a4480ddde5b4e9e054759ee327&OrderID=1003&Method=1&PayTimes=1&CardNo=4111111111111111&Expire=1405&HttpAccept=null&HttpUserAgent=null&DeviceCategory=0&ClientField1=null&ClientField2=null&ClientField3=null&ClientFieldFlag=0&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
38
+ headers:
39
+ Accept:
40
+ - ! '*/*'
41
+ User-Agent:
42
+ - Ruby
43
+ response:
44
+ status:
45
+ code: 200
46
+ message: OK
47
+ headers:
48
+ Date:
49
+ - Sun, 17 Feb 2013 07:29:35 GMT
50
+ Connection:
51
+ - close
52
+ Content-Type:
53
+ - text/plain;charset=Windows-31J
54
+ Transfer-Encoding:
55
+ - chunked
56
+ body:
57
+ encoding: US-ASCII
58
+ string: ACS=0&OrderID=1003&Forward=2a99662&Method=1&PayTimes=&Approve=6299691&TranID=1302171629111111111111197573&TranDate=20130217162935&CheckString=7a8aba1d8dbf2207721a9e9bfdc3df57
59
+ http_version:
60
+ recorded_at: Sun, 17 Feb 2013 07:29:35 GMT
61
+ - request:
62
+ method: post
63
+ uri: https://pt01.mul-pay.jp/payment/ChangeTran.idPass
64
+ body:
65
+ encoding: UTF-8
66
+ string: AccessID=781aaf3823503b49950d7da8952bd50f&AccessPass=e12780a4480ddde5b4e9e054759ee327&JobCd=AUTH&Amount=1000&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>
67
+ headers:
68
+ Accept:
69
+ - ! '*/*'
70
+ User-Agent:
71
+ - Ruby
72
+ response:
73
+ status:
74
+ code: 200
75
+ message: OK
76
+ headers:
77
+ Date:
78
+ - Sun, 17 Feb 2013 07:29:35 GMT
79
+ Connection:
80
+ - close
81
+ Content-Type:
82
+ - text/plain;charset=Windows-31J
83
+ Transfer-Encoding:
84
+ - chunked
85
+ body:
86
+ encoding: US-ASCII
87
+ string: AccessID=781aaf3823503b49950d7da8952bd50f&AccessPass=e12780a4480ddde5b4e9e054759ee327&Forward=2a99662&Approve=6299693&TranID=1302171629111111111111197575&TranDate=20130217162936
88
+ http_version:
89
+ recorded_at: Sun, 17 Feb 2013 07:29:37 GMT
90
+ recorded_with: VCR 2.4.0