offsite_payments 2.7.4 → 2.7.5

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: fca5c3503aa8268bc5f0b3495a8b610bd79ff955
4
- data.tar.gz: 95634ae04ab55cf706721238b0e30fff074fa4d5
3
+ metadata.gz: b9952e1ee49372892fbb3f4b7f3114f58b857fcb
4
+ data.tar.gz: 10aa54a2d1b8b5041bd362955c5ab88ea3dffe32
5
5
  SHA512:
6
- metadata.gz: fe7b2ecbef11e6580b9ba736f92a402d8f8b8270c2b6a76a5192075d31a76757eb92b9d5f8bc340ff236eeb805560a7d5bc5d8bdf76c4a7f56c45d8cd9afa815
7
- data.tar.gz: 4d3377a975972d0255d054749dcd8cbadb54decbd7fe76ebf6ff9fec8a797ed42ad341ca48e28ee1cc0ab227a7103c0552234d2e0722a82c7ed50ad1c60e9d93
6
+ metadata.gz: 5669f57fb9e86bcdcd691dd837a7dcf70a8b44fd4a07da2f30e607412c6fffb840cceb6fba5b07274eced324e7d7fbdabf6de387baabbfbee8e919455f41b4f5
7
+ data.tar.gz: 6d4feddce25300c3c5a04665e23794b12c8db4905b8b28c55e1e2f1c21e8ecc3f25e740851db762bdbce82cd85240920e4381f84e1f2981b4cec0628049ee46a
@@ -4,16 +4,18 @@ module OffsitePayments #:nodoc:
4
4
  mattr_accessor :production_url
5
5
  self.production_url = 'https://pay.skrill.com'
6
6
 
7
- def self.service_url
8
- self.production_url
9
- end
7
+ class << self
8
+ def service_url
9
+ production_url
10
+ end
10
11
 
11
- def self.notification(post, options)
12
- Notification.new(post, options)
13
- end
12
+ def notification(post, options)
13
+ Notification.new(post, options)
14
+ end
14
15
 
15
- def self.return(post, options = {})
16
- Return.new(post, options)
16
+ def return(post, options = {})
17
+ Return.new(post, options)
18
+ end
17
19
  end
18
20
 
19
21
  class Helper < OffsitePayments::Helper
@@ -44,13 +46,11 @@ module OffsitePayments #:nodoc:
44
46
  MAPPED_COUNTRY_CODES = {
45
47
  'SE' => 'SV',
46
48
  'DK' => 'DA'
47
- }
49
+ }.freeze
48
50
 
49
- SUPPORTED_COUNTRY_CODES = [
50
- 'FI', 'DE', 'ES', 'FR',
51
- 'IT','PL', 'GR', 'RO',
52
- 'RU', 'TR', 'CN', 'CZ', 'NL'
53
- ]
51
+ SUPPORTED_COUNTRY_CODES = %w[
52
+ FI DE ES FR IT PL GR RO RU TR CN CZ NL
53
+ ].freeze
54
54
 
55
55
  def initialize(order, account, options = {})
56
56
  super
@@ -85,6 +85,34 @@ module OffsitePayments #:nodoc:
85
85
  end
86
86
 
87
87
  class Notification < OffsitePayments::Notification
88
+ FAILED_REASON_CODES = {
89
+ '1' => "Referred by card issuer",
90
+ '2' => "Invalid Merchant",
91
+ '3' => "Stolen card",
92
+ '4' => "Declined by customer's Card Issuer",
93
+ '5' => "Insufficient funds",
94
+ '8' => "PIN tries exceed - card blocked",
95
+ '9' => "Invalid Transaction",
96
+ '10' => "Transaction frequency limit exceeded",
97
+ '12' => "Invalid credit card or bank account",
98
+ '15' => "Duplicate transaction",
99
+ '19' => "Unknown failure reason. Try again",
100
+ '24' => "Card expired",
101
+ '28' => "Lost/Stolen card",
102
+ '32' => "Card Security Code check failed",
103
+ '37' => "Card restricted by card issuer",
104
+ '38' => "Security violation",
105
+ '42' => "Card blocked by card issuer",
106
+ '44' => "Customer's issuing bank not available",
107
+ '51' => "Processing system error",
108
+ '63' => "Transaction not permitted to cardholder",
109
+ '70' => "Customer failed to complete 3DS",
110
+ '71' => "Customer failed SMS verification",
111
+ '80' => "Fraud engine declined",
112
+ '98' => "Error in communication with provider",
113
+ '99' => "Failure reason not specified"
114
+ }.freeze
115
+
88
116
  def complete?
89
117
  status == 'Completed'
90
118
  end
@@ -115,6 +143,15 @@ module OffsitePayments #:nodoc:
115
143
  params['status']
116
144
  end
117
145
 
146
+ def message
147
+ return unless failed_reason_code
148
+ FAILED_REASON_CODES[failed_reason_code]
149
+ end
150
+
151
+ def failed_reason_code
152
+ params['failed_reason_code']
153
+ end
154
+
118
155
  def item_id
119
156
  params['transaction_id']
120
157
  end
@@ -1,3 +1,3 @@
1
1
  module OffsitePayments
2
- VERSION = "2.7.4"
2
+ VERSION = "2.7.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: offsite_payments
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-13 00:00:00.000000000 Z
11
+ date: 2018-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport