spree_zaez_komerci 3.0.4.1 → 3.0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7baaad9a6dc5f9df3d63eadbfa573bc34c8c6acf
4
- data.tar.gz: 398a83a721e1b6484a0d3c646cc6ad6b19cbd6ce
3
+ metadata.gz: 8d31d4ce12b9ba636700d1e1ce9ec14165f5b06f
4
+ data.tar.gz: 21ccb85d06dc3359d2833231cf8df31dac60ece2
5
5
  SHA512:
6
- metadata.gz: 2272303003383c4e4d16898e333ed9fbe37e7d6d45fa89e6bc8365c03a78ae7b79f694636a0ce7a16a6d6c94f40d27038247298461e0ab572ef5096a0d5e9372
7
- data.tar.gz: a5387af08ce6b85da5a1e01679a6ddff0cd1352e0d122c8166d4ac29827edf70f2befc6504c501a6c5ca830c8e2230628d86cb2515c6828ed99fad3848a9af59
6
+ metadata.gz: 47189b339539dedaa0d0ce8097ad5904248cd7551506cced22a1cad828c335f5a1b529e32ffef46e903ea07e17b08c7cb3bcb468944e33177ed395147107e080
7
+ data.tar.gz: 8d873c7056e3df9a2bbf6f41b7a4742cbd047d8428231f4941558f3e28e03390c8e862531d585a61c2ed7c31cccca218b815267bac593cfee51546c186f56c8f
@@ -56,7 +56,7 @@ class Spree::KomerciConfiguration < Spree::Preferences::Configuration
56
56
  success: false,
57
57
  data: {
58
58
  error_number: authorization[:codret],
59
- error_message: authorization[:msgret]
59
+ error_message: format_response(authorization[:msgret], authorization[:codret])
60
60
  }
61
61
  }
62
62
  end
@@ -64,7 +64,7 @@ class Spree::KomerciConfiguration < Spree::Preferences::Configuration
64
64
  {
65
65
  success: false,
66
66
  data: {
67
- error_message: response_xml.body.gsub("\r\n", '')
67
+ error_message: format_response(response_xml.body.gsub("\r\n", ''))
68
68
  }
69
69
  }
70
70
  end
@@ -82,7 +82,7 @@ class Spree::KomerciConfiguration < Spree::Preferences::Configuration
82
82
  success: false,
83
83
  data: {
84
84
  error_number: confirmation[:codret],
85
- error_message: confirmation[:msgret]
85
+ error_message: format_response(confirmation[:msgret], confirmation[:codret])
86
86
  }
87
87
  }
88
88
  end
@@ -90,7 +90,7 @@ class Spree::KomerciConfiguration < Spree::Preferences::Configuration
90
90
  {
91
91
  success: false,
92
92
  data: {
93
- error_message: response_xml.body.gsub("\r\n", '')
93
+ error_message: format_response(response_xml.body.gsub("\r\n", ''))
94
94
  }
95
95
  }
96
96
  end
@@ -108,7 +108,7 @@ class Spree::KomerciConfiguration < Spree::Preferences::Configuration
108
108
  success: false,
109
109
  data: {
110
110
  error_number: confirmation[:codret],
111
- error_message: confirmation[:msgret]
111
+ error_message: format_response(confirmation[:msgret], confirmation[:codret])
112
112
  }
113
113
  }
114
114
  end
@@ -116,7 +116,7 @@ class Spree::KomerciConfiguration < Spree::Preferences::Configuration
116
116
  {
117
117
  success: false,
118
118
  data: {
119
- error_message: response_xml.body.gsub("\r\n", '')
119
+ error_message: format_response(response_xml.body.gsub("\r\n", ''))
120
120
  }
121
121
  }
122
122
  end
@@ -187,4 +187,19 @@ class Spree::KomerciConfiguration < Spree::Preferences::Configuration
187
187
  }
188
188
  end
189
189
 
190
+ def format_response(message, code = nil)
191
+ if code
192
+ case code.to_s
193
+ when '77'
194
+ return 'Problemas com o cartão. Por favor, verifique os dados de seu cartão. Caso o erro persista, entre em contato com a central de atendimento de seu cartão.'
195
+ when '27'
196
+ return 'Cartão inválido. Tente novamente.'
197
+ else
198
+ return message.force_encoding('UTF-8')
199
+ end
200
+ else
201
+ return message.force_encoding('UTF-8')
202
+ end
203
+ end
204
+
190
205
  end
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_zaez_komerci'
5
- s.version = '3.0.4.1'
5
+ s.version = '3.0.4.2'
6
6
  s.summary = 'Adds Komerci as a Payment Method to Spree Commerce'
7
7
  s.description = s.summary
8
8
  s.required_ruby_version = '>= 2.0.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_zaez_komerci
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4.1
4
+ version: 3.0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaez Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core