vsafe-ruby 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +241 -0
  3. data/Rakefile +6 -0
  4. data/lib/vsafe.rb +14 -0
  5. data/lib/vsafe/auth_result.rb +11 -0
  6. data/lib/vsafe/avs_result.rb +24 -0
  7. data/lib/vsafe/card_type.rb +29 -0
  8. data/lib/vsafe/charge_source.rb +12 -0
  9. data/lib/vsafe/client.rb +101 -0
  10. data/lib/vsafe/client_error.rb +4 -0
  11. data/lib/vsafe/config.rb +22 -0
  12. data/lib/vsafe/cvn_result.rb +17 -0
  13. data/lib/vsafe/payment_status.rb +15 -0
  14. data/lib/vsafe/request_error.rb +11 -0
  15. data/lib/vsafe/response.rb +47 -0
  16. data/lib/vsafe/response_error.rb +36 -0
  17. data/lib/vsafe/responses/charge_account_to_temporary_token.rb +12 -0
  18. data/lib/vsafe/responses/charge_authorize.rb +19 -0
  19. data/lib/vsafe/responses/charge_confirm.rb +10 -0
  20. data/lib/vsafe/responses/charge_sale.rb +20 -0
  21. data/lib/vsafe/responses/get_session_tags.rb +10 -0
  22. data/lib/vsafe/responses/reverse_payment.rb +12 -0
  23. data/lib/vsafe/responses/validate_charge_account.rb +19 -0
  24. data/lib/vsafe/version.rb +3 -0
  25. data/spec/spec_helper.rb +17 -0
  26. data/spec/vsafe/auth_result_spec.rb +12 -0
  27. data/spec/vsafe/avs_result_spec.rb +12 -0
  28. data/spec/vsafe/card_type_spec.rb +44 -0
  29. data/spec/vsafe/charge_source_spec.rb +12 -0
  30. data/spec/vsafe/client_spec.rb +186 -0
  31. data/spec/vsafe/config_spec.rb +14 -0
  32. data/spec/vsafe/cvn_result_spec.rb +12 -0
  33. data/spec/vsafe/payment_status_spec.rb +12 -0
  34. data/spec/vsafe/request_error_spec.rb +12 -0
  35. data/spec/vsafe/response_error_spec.rb +37 -0
  36. data/spec/vsafe/response_spec.rb +161 -0
  37. data/spec/vsafe/responses/charge_account_to_temporary_token_spec.rb +27 -0
  38. data/spec/vsafe/responses/charge_authorize_spec.rb +61 -0
  39. data/spec/vsafe/responses/charge_confirm_spec.rb +18 -0
  40. data/spec/vsafe/responses/charge_sale_spec.rb +68 -0
  41. data/spec/vsafe/responses/get_session_tags_spec.rb +27 -0
  42. data/spec/vsafe/responses/reverse_payment_spec.rb +37 -0
  43. data/spec/vsafe/responses/validate_charge_account.rb +19 -0
  44. data/spec/vsafe/vsafe_spec.rb +12 -0
  45. metadata +174 -0
@@ -0,0 +1,37 @@
1
+ require "spec_helper"
2
+ require "vsafe/responses/reverse_payment"
3
+
4
+ RSpec.describe VSafe::Responses::ReversePayment do
5
+ let(:available_refund_amount) { "1.0" }
6
+ let(:payment_acquirer_name) { "payment_acquirer_name" }
7
+ let(:payment_id) { "payment_id" }
8
+ let(:payment_status) { "1" }
9
+ let(:success_body) {
10
+ {
11
+ "AvailableRefundAmount" => available_refund_amount,
12
+ "PaymentAcquirerName" => payment_acquirer_name,
13
+ "PaymentID" => payment_id,
14
+ "PaymentStatus" => payment_status
15
+ }
16
+ }
17
+ let(:http_response) { double(:response, success?: true, parsed_response: success_body) }
18
+ let(:response) { VSafe::Responses::ReversePayment.new(http_response) }
19
+
20
+ describe "#available_refund_amount" do
21
+ it "returns value" do
22
+ expect(response.available_refund_amount).to eq(available_refund_amount)
23
+ end
24
+ end
25
+
26
+ describe "#payment_acquirer_name" do
27
+ it "returns value" do
28
+ expect(response.payment_acquirer_name).to eq(payment_acquirer_name)
29
+ end
30
+ end
31
+
32
+ describe "#payment_id" do
33
+ it "returns value" do
34
+ expect(response.payment_id).to eq(payment_id)
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,19 @@
1
+ require "vsafe/response"
2
+ require "vsafe/avs_result"
3
+ require "vsafe/auth_result"
4
+ require "vsafe/cvn_result"
5
+ require "vsafe/payment_status"
6
+
7
+ module VSafe
8
+ module Responses
9
+ class ValidateChargeAccount < Response
10
+ define_attribute_mapping(:avs_result, "AVSResultCode", AvsResult)
11
+ define_attribute_mapping(:auth_result, "AuthResultCode", AuthResult)
12
+ define_attribute_mapping(:cvn_result, "CVNResultCode", CvnResult)
13
+ define_attribute_mapping(:charge_permanent_token, "ChargePermanentToken")
14
+ define_attribute_mapping(:payment_acquirer_name, "PaymentAcquirerName")
15
+ define_attribute_mapping(:payment_id, "PaymentID")
16
+ define_attribute_mapping(:payment_status, "PaymentStatus", PaymentStatus)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ require "spec_helper"
2
+ require "vsafe"
3
+
4
+ describe VSafe do
5
+ context ".configure" do
6
+ it "yields config" do
7
+ VSafe.configure do |config|
8
+ expect(config).to be_an_instance_of(VSafe::Config)
9
+ end
10
+ end
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vsafe-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ platform: ruby
6
+ authors:
7
+ - Xiaoming Lu
8
+ - Ngan Pham
9
+ - Xenor Chang
10
+ autorequire:
11
+ bindir: exe
12
+ cert_chain: []
13
+ date: 2016-06-30 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.13'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: '0.13'
29
+ - !ruby/object:Gem::Dependency
30
+ name: bundler
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: '1.9'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ version: '1.9'
43
+ - !ruby/object:Gem::Dependency
44
+ name: rake
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: '10.0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: '10.0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: rspec
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: '3.4'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: '3.4'
71
+ - !ruby/object:Gem::Dependency
72
+ name: webmock
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.24'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ~>
83
+ - !ruby/object:Gem::Version
84
+ version: '1.24'
85
+ - !ruby/object:Gem::Dependency
86
+ name: byebug
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ description: Ruby API Library for Vesta's vSafe Payment Gateway.
100
+ email:
101
+ - xlu@listia.com
102
+ - ngan@listia.com
103
+ - xenor@listia.com
104
+ executables: []
105
+ extensions: []
106
+ extra_rdoc_files: []
107
+ files:
108
+ - README.md
109
+ - Rakefile
110
+ - lib/vsafe.rb
111
+ - lib/vsafe/auth_result.rb
112
+ - lib/vsafe/avs_result.rb
113
+ - lib/vsafe/card_type.rb
114
+ - lib/vsafe/charge_source.rb
115
+ - lib/vsafe/client.rb
116
+ - lib/vsafe/client_error.rb
117
+ - lib/vsafe/config.rb
118
+ - lib/vsafe/cvn_result.rb
119
+ - lib/vsafe/payment_status.rb
120
+ - lib/vsafe/request_error.rb
121
+ - lib/vsafe/response.rb
122
+ - lib/vsafe/response_error.rb
123
+ - lib/vsafe/responses/charge_account_to_temporary_token.rb
124
+ - lib/vsafe/responses/charge_authorize.rb
125
+ - lib/vsafe/responses/charge_confirm.rb
126
+ - lib/vsafe/responses/charge_sale.rb
127
+ - lib/vsafe/responses/get_session_tags.rb
128
+ - lib/vsafe/responses/reverse_payment.rb
129
+ - lib/vsafe/responses/validate_charge_account.rb
130
+ - lib/vsafe/version.rb
131
+ - spec/spec_helper.rb
132
+ - spec/vsafe/auth_result_spec.rb
133
+ - spec/vsafe/avs_result_spec.rb
134
+ - spec/vsafe/card_type_spec.rb
135
+ - spec/vsafe/charge_source_spec.rb
136
+ - spec/vsafe/client_spec.rb
137
+ - spec/vsafe/config_spec.rb
138
+ - spec/vsafe/cvn_result_spec.rb
139
+ - spec/vsafe/payment_status_spec.rb
140
+ - spec/vsafe/request_error_spec.rb
141
+ - spec/vsafe/response_error_spec.rb
142
+ - spec/vsafe/response_spec.rb
143
+ - spec/vsafe/responses/charge_account_to_temporary_token_spec.rb
144
+ - spec/vsafe/responses/charge_authorize_spec.rb
145
+ - spec/vsafe/responses/charge_confirm_spec.rb
146
+ - spec/vsafe/responses/charge_sale_spec.rb
147
+ - spec/vsafe/responses/get_session_tags_spec.rb
148
+ - spec/vsafe/responses/reverse_payment_spec.rb
149
+ - spec/vsafe/responses/validate_charge_account.rb
150
+ - spec/vsafe/vsafe_spec.rb
151
+ homepage: https://github.com/listia/vsafe-ruby
152
+ licenses: []
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - '>='
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - '>='
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.4.8
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Ruby API Library for Vesta's vSafe Payment Gateway.
174
+ test_files: []