judopay 2.0.0 → 2.0.1

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: adc77d2a9f1b25747948b90476f9b72610823d58
4
- data.tar.gz: 3747bc655c3d24a90883970037ce3f746f9a115d
3
+ metadata.gz: be5492295df9eda4aa30bdac5a083c8a3ed28475
4
+ data.tar.gz: 72ecefd096cb897e3ce5132e8a6860a3709701d6
5
5
  SHA512:
6
- metadata.gz: e75fa57d16570440e16117e37fb6a47fcb9b991c69970009f105efe0224ce225369eb5bcaaeff9f34b37777fe87ac742eba66c40653644385d5a4ab39abdea12
7
- data.tar.gz: af7d3f3ce3d06e1cd7942c28fdcfa257f61a9bb759de1be709a15b9e985db30974f86b314d736e6a09c75d607e49bb971f25d4df0b82091dbc0876f82ffbc9d2
6
+ metadata.gz: 4ca9fabba65770732d986a48bb427aeb9e3668d469befb0154cf8cde4ef2ea21726b120ff02a3a50ecef3eac08a3fc7f1d031f97bb7900ad1a9c606caf4f7137
7
+ data.tar.gz: 06e176695194f2280a216c1c86231381419f25ed51fdd9e687ab11fd741cc9f946d50ccbf74d65c76633aaa4c6b238b231ad11fa810924821df36c1d79e02ba5
@@ -44,4 +44,8 @@ Style/MethodLength:
44
44
 
45
45
  # Offense count: 2
46
46
  Style/RegexpLiteral:
47
- MaxSlashes: 0
47
+ MaxSlashes: 0
48
+
49
+ AllCops:
50
+ Exclude:
51
+ - 'judopay.gemspec'
@@ -1,3 +1,17 @@
1
- # Version 4.0.0
1
+ # Version 2.0.0
2
2
 
3
- First public release. Numbered to match current version of JudoPay API.
3
+ #### Modifications
4
+ In version 2.0 we changed error model and added couple of new models.
5
+
6
+ We decreased amount of Exceptions to two:
7
+ - Local validation error (ValidationError)
8
+ - ApiException which arise when Judo REST API returns error.
9
+
10
+ So at first you need to update your error handling principle. See example at [Error handling](https://github.com/JudoPay/RubySdk/wiki/Error-handling).
11
+
12
+ #### Additions
13
+ - ```validate``` method added to [Collect](https://github.com/JudoPay/RubySdk/wiki/Collecting-on-a-Pre-Authorization#validating-the-collection) and [Refund](https://github.com/JudoPay/PhpSdk/wiki/Refund-a-Payment#validating-the-refund) models so now you could check yours transactions.
14
+ - [Void model](https://github.com/JudoPay/RubySdk/wiki/Voiding-requests)
15
+ - [Register card model](https://github.com/JudoPay/RubySdk/wiki/Registering-a-Card)
16
+ - [Save card model](https://github.com/JudoPay/RubySdk/wiki/Saving-a-Card)
17
+ - Integration tests
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Judopay
1
+ Copyright (c) 2016 Alternative Payments Ltd
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
- # Judopay
1
+ # Judopay Ruby gem [![Build Status](https://travis-ci.org/JudoPay/Judo-Ruby.svg?branch=master)](https://travis-ci.org/JudoPay/Judo-Ruby)
2
+ The JudoPay gem provides you with ability to integrate card payments into your Ruby and Rails projects. Judo's SDK enables a faster, simpler and more secure payment experience within your app.
3
+ ##### **\*\*\*Due to industry-wide security updates, versions below 2.0 of this SDK will no longer be supported after 1st Oct 2016. For more information regarding these updates, please read our blog [here](http://hub.judopay.com/pci31-security-updates/).*****
2
4
 
5
+ ## Requirements
3
6
  The Judopay gem supports Ruby 1.9.3 and above (including 2.0.x and 2.1.x).
4
7
 
5
- [![Build Status](https://travis-ci.org/JudoPay/RubySdk.svg?branch=master)](https://travis-ci.org/JudoPay/RubySdk)
6
-
7
- ## Installation
8
-
8
+ ## Getting started
9
+ ##### 1. Integration
9
10
  Add this line to your application's Gemfile:
10
11
 
11
12
  gem 'judopay'
@@ -18,28 +19,76 @@ Or install it yourself as:
18
19
 
19
20
  $ gem install judopay
20
21
 
21
- ## Configuration
22
-
23
- You configure the Judopay gem by passing a block. For example:
24
-
25
- Judopay.configure do |config|
26
- config.judo_id = 12345
27
- end
28
-
29
- ## Authentication
30
- You can authenticate either with basic authentication by passing your login and password credentials or using an existing OAuth2 access token.
31
-
32
- ### Basic authentication
33
-
22
+ ##### 2. Setup
23
+ To start using the gem, you need to pass block with your API credentials:
24
+ ```ruby
34
25
  Judopay.configure do |config|
35
- config.judo_id = 12345
26
+ config.judo_id = 'your-judo-id'
36
27
  config.api_token = 'your-token'
37
28
  config.api_secret = 'your-secret'
29
+ config.use_production = false # set to true on production, defaults to false which is the sandbox
38
30
  end
39
-
40
- ### OAuth2 access token authentication
41
-
42
- Judopay.configure do |config|
43
- config.judo_id = 12345
44
- config.oauth_access_token = 'your-oauth-token'
45
- end
31
+ ```
32
+
33
+ ##### 3. Make a payment
34
+ To make a new payment with full card details:
35
+ ```ruby
36
+ payment = Judopay::CardPayment.new(
37
+ :judoId => 'your_judo_id',
38
+ :your_consumer_reference => 'xxxxxxxx',
39
+ :your_payment_reference => 'xxxxxxxx',
40
+ :amount => 5.01,
41
+ :currency => 'GBP',
42
+ :card_number => '4976000000003436',
43
+ :expiry_date => '12/20',
44
+ :cv2 => '452',
45
+ :card_address => {
46
+ :line1 => '32 Edward Street',
47
+ :town => 'Camborne',
48
+ :postcode => 'TR14 8PA'
49
+ },
50
+ :consumer_location => {
51
+ :latitude => 51.5033630,
52
+ :longitude => -0.1276250
53
+ }
54
+ )
55
+ ```
56
+ **Note:** Please make sure that you are using a unique Consumer Reference for each different consumer, and a unique Payment Reference for each transaction.
57
+
58
+ You can check on the required fields and the format of each field in the [Judopay REST API reference](https://www.judopay.com/docs/version-52/api/restful-api/#post-card-payment).
59
+
60
+ To send the request to the API, call:
61
+ ```ruby
62
+ payment_response = payment.create
63
+ ```
64
+
65
+ ##### 4. Check the payment result
66
+ If the payment is successful, you'll `payment_response` variable will contain Mash like this (see full response [here](https://www.judopay.com/docs/v5/api-reference/restful-api/#post-card-payment)):
67
+ ```ruby
68
+ {
69
+ "receipt_id"=>"xxxxxxx",
70
+ "type"=>"Payment",
71
+ "created_at"=>"2016-09-23T09:28:47.1207+01:00",
72
+ "result"=>"Success",
73
+ ...
74
+ "amount"=>"5.01",
75
+ "currency"=>"GBP",
76
+ ...
77
+ }
78
+ ```
79
+ So your check code might look like this:
80
+ ```ruby
81
+ if result_payment.result == 'Success'
82
+ puts 'Payment successful'
83
+ else
84
+ puts 'There were some problems while processing your payment'
85
+ end
86
+ ```
87
+
88
+ Also important to handle different exceptions in your code. See more details in our [error handling section](https://github.com/JudoPay/RubySdk/wiki/Error-handling).
89
+
90
+ ## Next steps
91
+ The Judopay gem supports a range of customization options. For more information on using judo see our [wiki documentation](https://github.com/JudoPay/RubySdk/wiki).
92
+
93
+ ## License
94
+ See the [LICENSE](https://github.com/JudoPay/RubySdk/blob/master/LICENSE.txt) file for license rights and limitations (MIT).
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'rake'
31
31
  spec.add_dependency 'virtus', '~> 1.0.2'
32
32
  spec.add_dependency 'httpclient', '~> 2.4.0'
33
- spec.add_dependency 'activemodel', '~> 4.1.1'
33
+ spec.add_dependency 'activemodel', ['~> 4.1', '~> 4.2']
34
34
  spec.add_dependency 'faraday', '~> 0.9.0'
35
35
  spec.add_dependency 'faraday_middleware', '~> 0.9.1'
36
- spec.add_dependency 'rash', '~> 0.4.0'
36
+ spec.add_dependency 'hashie', '~> 3.4.6'
37
37
  spec.add_dependency 'addressable', '~> 2.3.6'
38
38
  end
@@ -0,0 +1,49 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIElDCCA3ygAwIBAgIQAf2j627KdciIQ4tyS8+8kTANBgkqhkiG9w0BAQsFADBh
3
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
4
+ d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
5
+ QTAeFw0xMzAzMDgxMjAwMDBaFw0yMzAzMDgxMjAwMDBaME0xCzAJBgNVBAYTAlVT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BBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
39
+ T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
40
+ gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
41
+ BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
42
+ TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
43
+ DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
44
+ hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
45
+ 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
46
+ PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
47
+ YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
48
+ CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
49
+ -----END CERTIFICATE-----
@@ -1,12 +1,10 @@
1
- require 'faraday_middleware/response/rashify'
2
1
  require_relative '../judopay/mash'
3
2
 
4
3
  # @private
5
4
  module FaradayMiddleware
6
- # Convert parsed response bodies to a Hashie::Rash if they are a Hash or Array
7
- class JudoMashify < Rashify
5
+ # Convert parsed response bodies to a Hashie::Mash if they are a Hash or Array
6
+ class JudoMashify < Mashify
8
7
  dependency do
9
- require 'rash'
10
8
  self.mash_class = ::Judopay::Mash
11
9
  end
12
10
  end
@@ -56,8 +56,8 @@ module Judopay
56
56
  @user_agent = "Judopay Ruby (#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}) SDK gem v#{Judopay::SDK_VERSION}"
57
57
  @logger = Judopay::NullLogger.new
58
58
  @api_endpoints = {
59
- :sandbox => 'https://partnerapi.judopay-sandbox.com',
60
- :production => 'https://partnerapi.judopay.com'
59
+ :sandbox => 'https://gw1.judopay-sandbox.com',
60
+ :production => 'https://gw1.judopay.com'
61
61
  }.freeze
62
62
  @endpoint_url = @api_endpoints[:sandbox]
63
63
  end
@@ -1,7 +1,11 @@
1
1
  require 'hashie'
2
- require 'rash'
3
2
 
4
3
  module Judopay
5
- class Mash < ::Hashie::Rash
4
+ class Mash < ::Hashie::Mash
5
+ protected
6
+
7
+ def convert_key(key)
8
+ key.to_s.underscore
9
+ end
6
10
  end
7
11
  end
@@ -1,4 +1,4 @@
1
1
  module Judopay
2
- SDK_VERSION = '2.0.0'.freeze
2
+ SDK_VERSION = '2.0.1'.freeze
3
3
  API_VERSION = '5.2.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judopay
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - judoPay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-27 00:00:00.000000000 Z
11
+ date: 2016-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -170,14 +170,20 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 4.1.1
173
+ version: '4.1'
174
+ - - "~>"
175
+ - !ruby/object:Gem::Version
176
+ version: '4.2'
174
177
  type: :runtime
175
178
  prerelease: false
176
179
  version_requirements: !ruby/object:Gem::Requirement
177
180
  requirements:
178
181
  - - "~>"
179
182
  - !ruby/object:Gem::Version
180
- version: 4.1.1
183
+ version: '4.1'
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '4.2'
181
187
  - !ruby/object:Gem::Dependency
182
188
  name: faraday
183
189
  requirement: !ruby/object:Gem::Requirement
@@ -207,19 +213,19 @@ dependencies:
207
213
  - !ruby/object:Gem::Version
208
214
  version: 0.9.1
209
215
  - !ruby/object:Gem::Dependency
210
- name: rash
216
+ name: hashie
211
217
  requirement: !ruby/object:Gem::Requirement
212
218
  requirements:
213
219
  - - "~>"
214
220
  - !ruby/object:Gem::Version
215
- version: 0.4.0
221
+ version: 3.4.6
216
222
  type: :runtime
217
223
  prerelease: false
218
224
  version_requirements: !ruby/object:Gem::Requirement
219
225
  requirements:
220
226
  - - "~>"
221
227
  - !ruby/object:Gem::Version
222
- version: 0.4.0
228
+ version: 3.4.6
223
229
  - !ruby/object:Gem::Dependency
224
230
  name: addressable
225
231
  requirement: !ruby/object:Gem::Requirement
@@ -252,6 +258,7 @@ files:
252
258
  - README.md
253
259
  - Rakefile
254
260
  - judopay.gemspec
261
+ - lib/certs/digicert_sha256_ca.pem
255
262
  - lib/certs/rapidssl_ca.crt
256
263
  - lib/faraday/judo_mashify.rb
257
264
  - lib/faraday/raise_http_exception.rb