solidus_payu_latam 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +56 -56
  3. data/.rvmrc +1 -1
  4. data/.travis.yml +16 -17
  5. data/Gemfile +9 -11
  6. data/Rakefile +2 -0
  7. data/app/models/concerns/solidus_payu_latam/inject_customer_document_concern.rb +2 -0
  8. data/app/models/concerns/solidus_payu_latam/permitted_attributes_concern.rb +2 -0
  9. data/app/models/order_decorator.rb +15 -11
  10. data/app/models/payment_decorator.rb +5 -1
  11. data/app/models/permitted_attributes_decorator.rb +5 -1
  12. data/app/models/solidus/gateway/payu_latam_gateway.rb +11 -15
  13. data/app/views/spree/checkout/payment/_payu_latam.html.erb +1 -1
  14. data/config/routes.rb +2 -0
  15. data/db/migrate/20170916072806_add_customer_document_to_orders.rb +2 -0
  16. data/lib/generators/solidus_payu_latam/install/install_generator.rb +2 -0
  17. data/lib/solidus_payu_latam.rb +2 -0
  18. data/lib/solidus_payu_latam/engine.rb +3 -1
  19. data/lib/solidus_payu_latam/factories.rb +2 -0
  20. data/lib/solidus_payu_latam/version.rb +3 -1
  21. data/solidus_payu_latam.gemspec +4 -1
  22. data/spec/cassettes/Payu_Latam_checkout/with_autocapture/can_process_a_valid_payment.yml +12 -8
  23. data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/can_process.yml +12 -10
  24. data/spec/features/payu_latam_checkout_spec.rb +13 -2
  25. data/spec/models/spree/order_spec.rb +5 -3
  26. data/spec/models/spree/permitted_attributes_spec.rb +2 -0
  27. data/spec/spec_helper.rb +16 -7
  28. data/spec/support/payu_latam_helper.rb +14 -4
  29. metadata +18 -7
  30. data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/capture_payment.yml +0 -80
  31. data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/voids_a_payment.yml +0 -80
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dab536e982e292446f937b981452c0c40f5b8690
4
- data.tar.gz: 1f388ad3d392de85218c18f69157a6dea14186cc
2
+ SHA256:
3
+ metadata.gz: f90803a1d0f5400180d91aba421c09a04e067e2107b13d2588403dd4ab8ebdae
4
+ data.tar.gz: 400b967e48b7c32667b7f5a6a391e29404d14da8252c579664d1d8078263b0ba
5
5
  SHA512:
6
- metadata.gz: 78cb8ae483068ff2d62a68636c47af6e7511ee950560a3e0ab3179b8113e7394b190ad6d8664d3466d5f89da5c9a2b0d486ec2332aa23dec43474fdf5e08449f
7
- data.tar.gz: 820a0b6f637329cb274236dd8648d182bb1acaafe37b2774d075ccafdd7baee10060e0c999a0d3af8dc6ac1cd0a469ce9afd9d9202aaba85b614f0aa7b954bd7
6
+ metadata.gz: bb1d2690bdf90af6eaec1052668b28c8b56f1844f00a81097f541098f9952271c755d7c1807876a17f986452b7b4a605d2ae7ce40a2a4d532089494162252993
7
+ data.tar.gz: c34f3c448335036a03686229ad24a6b6f23b52ea33258d1174b18255d25b0f0cecead594de322775e9e6a671d7b659d219f85d30e543368b7587af4734aa64e2
data/.rubocop.yml CHANGED
@@ -5,24 +5,12 @@ AllCops:
5
5
  Exclude:
6
6
  - 'spec/dummy/**/*'
7
7
  - 'vendor/bundle/**/*'
8
- TargetRubyVersion: 2.1
9
-
10
- # Sometimes I believe this reads better
11
- # This also causes spacing issues on multi-line fixes
12
- Style/BracesAroundHashParameters:
13
- Enabled: false
8
+ TargetRubyVersion: 2.6
14
9
 
15
10
  # We use class vars and will have to continue doing so for compatability
16
11
  Style/ClassVars:
17
12
  Enabled: false
18
13
 
19
- # We need these names for backwards compatability
20
- Style/PredicateName:
21
- Enabled: false
22
-
23
- Style/AccessorMethodName:
24
- Enabled: false
25
-
26
14
  # This has been used for customization
27
15
  Style/MutableConstant:
28
16
  Enabled: false
@@ -39,9 +27,6 @@ Style/WordArray:
39
27
  Style/ConditionalAssignment:
40
28
  Enabled: false
41
29
 
42
- Performance/Count:
43
- Enabled: false
44
-
45
30
  Style/RaiseArgs:
46
31
  Enabled: false
47
32
 
@@ -53,33 +38,6 @@ Style/RegexpLiteral:
53
38
  Style/AsciiComments:
54
39
  Enabled: false
55
40
 
56
- Lint/EndAlignment:
57
- Enabled: false
58
-
59
- Style/ElseAlignment:
60
- Enabled: false
61
-
62
- Style/IndentationWidth:
63
- Enabled: false
64
-
65
- Style/AlignParameters:
66
- Enabled: false
67
-
68
- Style/ClosingParenthesisIndentation:
69
- Enabled: false
70
-
71
- Style/MultilineMethodCallIndentation:
72
- Enabled: false
73
-
74
- Style/IndentArray:
75
- Enabled: false
76
-
77
- Style/IndentHash:
78
- Enabled: false
79
-
80
- Style/AlignHash:
81
- Enabled: false
82
-
83
41
  # From http://relaxed.ruby.style/
84
42
 
85
43
  Style/Alias:
@@ -98,10 +56,6 @@ Style/Documentation:
98
56
  Enabled: false
99
57
  StyleGuide: http://relaxed.ruby.style/#styledocumentation
100
58
 
101
- Style/DotPosition:
102
- Enabled: false
103
- StyleGuide: http://relaxed.ruby.style/#styledotposition
104
-
105
59
  Style/DoubleNegation:
106
60
  Enabled: false
107
61
  StyleGuide: http://relaxed.ruby.style/#styledoublenegation
@@ -166,14 +120,6 @@ Style/SingleLineMethods:
166
120
  Enabled: false
167
121
  StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
168
122
 
169
- Style/SpaceBeforeBlockBraces:
170
- Enabled: false
171
- StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
172
-
173
- Style/SpaceInsideParens:
174
- Enabled: false
175
- StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
176
-
177
123
  Style/SpecialGlobalVars:
178
124
  Enabled: false
179
125
  StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars
@@ -189,6 +135,15 @@ Style/WhileUntilModifier:
189
135
  Enabled: false
190
136
  StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier
191
137
 
138
+ Style/HashEachMethods:
139
+ Enabled: true
140
+
141
+ Style/HashTransformKeys:
142
+ Enabled: true
143
+
144
+ Style/HashTransformValues:
145
+ Enabled: true
146
+
192
147
  Lint/AmbiguousRegexpLiteral:
193
148
  Enabled: false
194
149
  StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
@@ -197,7 +152,7 @@ Lint/AssignmentInCondition:
197
152
  Enabled: false
198
153
  StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
199
154
 
200
- Lint/HandleExceptions:
155
+ Lint/SuppressedException:
201
156
  Exclude:
202
157
  - 'Rakefile'
203
158
 
@@ -234,3 +189,48 @@ Metrics/PerceivedComplexity:
234
189
 
235
190
  Naming/BinaryOperatorParameterName:
236
191
  Enabled: false
192
+
193
+ Naming/PredicateName:
194
+ Enabled: false
195
+
196
+ Naming/AccessorMethodName:
197
+ Enabled: false
198
+
199
+ Layout/EndAlignment:
200
+ Enabled: false
201
+
202
+ Layout/ElseAlignment:
203
+ Enabled: false
204
+
205
+ Layout/IndentationWidth:
206
+ Enabled: false
207
+
208
+ Layout/ParameterAlignment:
209
+ Enabled: false
210
+
211
+ Layout/ClosingParenthesisIndentation:
212
+ Enabled: false
213
+
214
+ Layout/MultilineMethodCallIndentation:
215
+ Enabled: false
216
+
217
+ Layout/FirstArrayElementIndentation:
218
+ Enabled: false
219
+
220
+ Layout/FirstHashElementIndentation:
221
+ Enabled: false
222
+
223
+ Layout/HashAlignment:
224
+ Enabled: false
225
+
226
+ Layout/DotPosition:
227
+ Enabled: false
228
+ StyleGuide: http://relaxed.ruby.style/#styledotposition
229
+
230
+ Layout/SpaceBeforeBlockBraces:
231
+ Enabled: false
232
+ StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
233
+
234
+ Layout/SpaceInsideParens:
235
+ Enabled: false
236
+ StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm --create use 2.4.1@solidus_payu_latam
1
+ rvm --create use 2.6.5@solidus_payu_latam
data/.travis.yml CHANGED
@@ -2,27 +2,26 @@ sudo: false
2
2
  cache: bundler
3
3
  language: ruby
4
4
  bundler_args: --quiet
5
+ before_install:
6
+ - wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
7
+ - tar -xzf geckodriver-v0.24.0-linux64.tar.gz
8
+ - export DRIVER_PATH=$PWD/geckodriver
5
9
  script:
6
10
  - bundle exec rake
7
11
  rvm:
8
- - 2.4.1
12
+ - 2.6.0
9
13
  env:
10
14
  matrix:
11
- - SOLIDUS_BRANCH=v1.3 DB=postgres
12
- - SOLIDUS_BRANCH=v1.4 DB=postgres
13
- - SOLIDUS_BRANCH=v2.0 DB=postgres
14
- - SOLIDUS_BRANCH=v2.1 DB=postgres
15
- - SOLIDUS_BRANCH=v2.2 DB=postgres
16
- - SOLIDUS_BRANCH=v2.3 DB=postgres
17
- - SOLIDUS_BRANCH=v2.4 DB=postgres
18
- - SOLIDUS_BRANCH=v2.5 DB=postgres
15
+ - SOLIDUS_BRANCH=v2.7 DB=postgres
16
+ - SOLIDUS_BRANCH=v2.8 DB=postgres
17
+ - SOLIDUS_BRANCH=v2.9 DB=postgres
18
+ - SOLIDUS_BRANCH=v2.10 DB=postgres
19
19
  - SOLIDUS_BRANCH=master DB=postgres
20
- - SOLIDUS_BRANCH=v1.3 DB=mysql
21
- - SOLIDUS_BRANCH=v1.4 DB=mysql
22
- - SOLIDUS_BRANCH=v2.0 DB=mysql
23
- - SOLIDUS_BRANCH=v2.1 DB=mysql
24
- - SOLIDUS_BRANCH=v2.2 DB=mysql
25
- - SOLIDUS_BRANCH=v2.3 DB=mysql
26
- - SOLIDUS_BRANCH=v2.4 DB=mysql
27
- - SOLIDUS_BRANCH=v2.5 DB=mysql
20
+ - SOLIDUS_BRANCH=v2.7 DB=mysql
21
+ - SOLIDUS_BRANCH=v2.8 DB=mysql
22
+ - SOLIDUS_BRANCH=v2.9 DB=mysql
23
+ - SOLIDUS_BRANCH=v2.10 DB=mysql
28
24
  - SOLIDUS_BRANCH=master DB=mysql
25
+ services:
26
+ - mysql
27
+ - postgresql
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
@@ -7,16 +9,12 @@ gem 'solidus', github: 'solidusio/solidus', branch: branch
7
9
 
8
10
  gemspec
9
11
 
10
- gem 'pry'
11
-
12
- group :test do
13
- gem 'ffaker'
14
- gem 'mysql2', '0.4.10'
15
- gem 'pg', '~> 0.15'
16
- gem 'puma'
17
- gem 'sqlite3'
18
- gem 'vcr'
19
- gem 'webmock'
20
- end
12
+ gem 'ffaker'
13
+ gem 'mysql2', '~> 0.5'
14
+ gem 'pg', '~> 1.1'
15
+ gem 'puma'
16
+ gem 'sqlite3'
17
+ gem 'vcr'
18
+ gem 'webmock'
21
19
 
22
20
  gem 'activemerchant', github: 'activemerchant/active_merchant'
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
 
3
5
  Bundler::GemHelper.install_tasks
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SolidusPayuLatam
2
4
  module InjectCustomerDocumentConcern
3
5
  extend ActiveSupport::Concern
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SolidusPayuLatam
2
4
  module PermittedAttributesConcern
3
5
  def checkout_attributes
@@ -1,15 +1,19 @@
1
- Spree::Order.class_eval do
2
- checkout_flow do
3
- go_to_state :address
4
- go_to_state :delivery
5
- go_to_state :payment
6
- go_to_state :complete
7
- end
1
+ # frozen_string_literal: true
2
+
3
+ module OrderDecorator
4
+ Spree::Order.class_eval do
5
+ checkout_flow do
6
+ go_to_state :address
7
+ go_to_state :delivery
8
+ go_to_state :payment
9
+ go_to_state :complete
10
+ end
8
11
 
9
- state_machine do
10
- event :payment_failed do
11
- reset
12
- transition payment: :payment
12
+ state_machine do
13
+ event :payment_failed do
14
+ reset
15
+ transition payment: :payment
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1 +1,5 @@
1
- Spree::Payment.include SolidusPayuLatam::InjectCustomerDocumentConcern
1
+ # frozen_string_literal: true
2
+
3
+ module PaymentDecorator
4
+ Spree::Payment.include SolidusPayuLatam::InjectCustomerDocumentConcern
5
+ end
@@ -1 +1,5 @@
1
- Spree::PermittedAttributes.singleton_class.prepend SolidusPayuLatam::PermittedAttributesConcern
1
+ # frozen_string_literal: true
2
+
3
+ module PermittedAttributesDecorator
4
+ Spree::PermittedAttributes.singleton_class.prepend SolidusPayuLatam::PermittedAttributesConcern
5
+ end
@@ -1,47 +1,43 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Solidus
2
- class Gateway::PayuLatamGateway < ::Spree::Gateway
4
+ class Gateway::PayuLatamGateway < ::Spree::PaymentMethod::CreditCard
3
5
  preference :merchant_id, :string
4
6
  preference :account_id, :string
5
7
  preference :api_login, :string
6
8
  preference :api_key, :string
7
9
  preference :payment_country, :string, default: 'PE'
8
10
 
9
- def provider_class
11
+ def gateway_class
10
12
  ActiveMerchant::Billing::PayuLatamGateway
11
13
  end
12
14
 
13
- if SolidusSupport.solidus_gem_version < Gem::Version.new('2.3.x')
14
- def method_type
15
- 'payu_latam'
16
- end
17
- else
18
- def partial_name
19
- 'payu_latam'
20
- end
15
+ def partial_name
16
+ 'payu_latam'
21
17
  end
22
18
 
23
19
  def authorize(amount, credit_card, gateway_options)
24
20
  cvv = credit_card.verification_value
25
21
  options = add_missing_fields(gateway_options, cvv)
26
- provider.authorize(amount, credit_card, options)
22
+ gateway.authorize(amount, credit_card, options)
27
23
  end
28
24
 
29
25
  def capture(amount, authorization, gateway_options)
30
- provider.capture(amount, authorization, gateway_options)
26
+ gateway.capture(amount, authorization, gateway_options)
31
27
  end
32
28
 
33
29
  def void(authorization, gateway_options)
34
- provider.void(authorization, gateway_options)
30
+ gateway.void(authorization, gateway_options)
35
31
  end
36
32
 
37
33
  def purchase(amount, credit_card, gateway_options)
38
34
  cvv = credit_card.verification_value
39
35
  options = add_missing_fields(gateway_options, cvv)
40
- provider.purchase(amount, credit_card, options)
36
+ gateway.purchase(amount, credit_card, options)
41
37
  end
42
38
 
43
39
  def credit(amount, authorization, gateway_options)
44
- provider.refund(amount, authorization, gateway_options)
40
+ gateway.refund(amount, authorization, gateway_options)
45
41
  end
46
42
 
47
43
  private
@@ -2,6 +2,6 @@
2
2
  <% param_prefix = "payment_source[#{payment_method.id}]" %>
3
3
 
4
4
  <p class="field">
5
- <%= label_tag "document", Spree.t(:document) %><span class="required">*</span><br />
5
+ <%= label_tag "document", I18n.t('spree.document') %><span class="required">*</span><br />
6
6
  <%= text_field_tag '[order][customer_document]', '', id: 'customer_document', class: "required customerDocument", "payu-content": "document" %>
7
7
  </p>
data/config/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Spree::Core::Engine.routes.draw do
2
4
  # Add your extension routes here
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddCustomerDocumentToOrders < SolidusSupport::Migration[4.2]
2
4
  def change
3
5
  add_column :spree_orders, :customer_document, :string
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SolidusPayuLatam
2
4
  module Generators
3
5
  class InstallGenerator < Rails::Generators::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'solidus_core'
2
4
  require 'solidus_support'
3
5
  require 'solidus_payu_latam/engine'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SolidusPayuLatam
2
4
  class Engine < Rails::Engine
3
5
  engine_name 'solidus_payu_latam'
@@ -7,7 +9,7 @@ module SolidusPayuLatam
7
9
  end
8
10
 
9
11
  def self.activate
10
- Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
12
+ Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')).sort.map do |c|
11
13
  Rails.configuration.cache_classes ? require(c) : load(c)
12
14
  end
13
15
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  FactoryBot.define do
2
4
  # Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SolidusPayuLatam
2
- VERSION = '0.0.2'
4
+ VERSION = '0.1.0'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $:.push File.expand_path('lib', __dir__)
2
4
 
3
5
  require 'solidus_payu_latam/version'
@@ -23,9 +25,10 @@ Gem::Specification.new do |s|
23
25
  s.add_development_dependency 'capybara'
24
26
  s.add_development_dependency 'database_cleaner'
25
27
  s.add_development_dependency 'factory_bot'
26
- s.add_development_dependency 'poltergeist'
28
+ s.add_development_dependency 'pry'
27
29
  s.add_development_dependency 'rspec-rails'
28
30
  s.add_development_dependency 'rubocop'
29
31
  s.add_development_dependency 'rubocop-rspec'
32
+ s.add_development_dependency 'selenium-webdriver'
30
33
  s.add_development_dependency 'simplecov'
31
34
  end
@@ -5,12 +5,12 @@ http_interactions:
5
5
  uri: https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"AUTHORIZATION_AND_CAPTURE","ipAddress":"127.0.0.1","order":{"accountId":"512323","referenceCode":"R637264834-2RY4LX4V","description":"Compra
8
+ string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"AUTHORIZATION_AND_CAPTURE","ipAddress":"127.0.0.1","order":{"accountId":"512323","referenceCode":"R437146780-5RBJ3PHC","description":"Compra
9
9
  en 508029","language":"en","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
10
10
  Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"},"buyer":{"fullName":"APPROVED
11
- .","dniNumber":"32144457","dniType":null,"emailAddress":"han@example.com","contactPhone":"(555)
11
+ .","dniNumber":"32144457","dniType":null,"merchantBuyerId":null,"emailAddress":"han@example.com","contactPhone":"(555)
12
12
  555-5555","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
13
- Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"}},"additionalValues":{"TX_VALUE":{"value":"19.99","currency":"USD"}},"signature":"7adf0fa0c92d660d225f4b54bb1ec2ce"},"creditCard":{"number":"4111111111111111","securityCode":"123","expirationDate":"2019/01","name":"APPROVED
13
+ Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"}},"additionalValues":{"TX_VALUE":{"value":"19.99","currency":"USD"}},"signature":"560141dc21d554e9623dc3b9d695e15c"},"creditCard":{"number":"4111111111111111","securityCode":"123","expirationDate":"2021/09","name":"APPROVED
14
14
  ."},"paymentMethod":"VISA","payer":{"fullName":"APPROVED .","contactPhone":"(555)
15
15
  555-5555","dniNumber":"32144457","emailAddress":"han@example.com","billingAddress":{"street1":"YT-1300","street2":"","city":"Mos
16
16
  Eisley","state":"AL","country":"US","phone":"(555) 555-5555"}},"extraParameters":{"INSTALLMENTS_NUMBER":1}}}'
@@ -19,6 +19,8 @@ http_interactions:
19
19
  - application/json
20
20
  Accept:
21
21
  - application/json
22
+ Connection:
23
+ - close
22
24
  Accept-Encoding:
23
25
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
24
26
  User-Agent:
@@ -35,12 +37,14 @@ http_interactions:
35
37
  Transfer-Encoding:
36
38
  - chunked
37
39
  Date:
38
- - Tue, 15 May 2018 00:38:09 GMT
40
+ - Mon, 23 Mar 2020 15:13:42 GMT
41
+ Connection:
42
+ - close
39
43
  Server:
40
44
  - PayU server
41
45
  body:
42
46
  encoding: UTF-8
43
- string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":844152680,"transactionId":"350f7e42-5a18-4ddc-a3bb-7e2ce16bcb4f","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1526344688778,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
44
- http_version:
45
- recorded_at: Tue, 15 May 2018 00:38:09 GMT
46
- recorded_with: VCR 3.0.3
47
+ string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":849192154,"transactionId":"29c7e530-5b2c-4ac3-bfea-d458bfd4d3b0","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1584976421737,"referenceQuestionnaire":null,"extraParameters":{"PAYMENT_WAY_ID":"4","BANK_REFERENCED_CODE":"CREDIT"},"additionalInfo":null}}'
48
+ http_version: null
49
+ recorded_at: Mon, 23 Mar 2020 15:13:42 GMT
50
+ recorded_with: VCR 5.1.0
@@ -5,13 +5,11 @@ http_interactions:
5
5
  uri: https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"AUTHORIZATION","ipAddress":"127.0.0.1","order":{"accountId":"512323","referenceCode":"R308229857-MLKZE7X3","description":"Compra
8
+ string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"AUTHORIZATION","ipAddress":"127.0.0.1","order":{"accountId":"512323","referenceCode":"R469552768-EWTKMWVF","description":"Compra
9
9
  en 508029","language":"en","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
10
- Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"},"buyer":{"fullName":"APPROVED
11
- .","dniNumber":"32144457","dniType":null,"emailAddress":"han@example.com","contactPhone":"(555)
10
+ Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"},"buyer":{"fullName":"APPROVED","dniNumber":"32144457","dniType":null,"merchantBuyerId":null,"emailAddress":"han@example.com","contactPhone":"(555)
12
11
  555-5555","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
13
- Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"}},"additionalValues":{"TX_VALUE":{"value":"19.99","currency":"PEN"}},"signature":"71ec020380212939c6e26536149521b8"},"creditCard":{"number":"4111111111111111","securityCode":"123","expirationDate":"2019/01","name":"APPROVED
14
- ."},"paymentMethod":"VISA","payer":{"fullName":"APPROVED .","contactPhone":"(555)
12
+ Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"}},"additionalValues":{"TX_VALUE":{"value":"19.99","currency":"PEN"}},"signature":"f309f4aab68be826534c7f08418499a2"},"creditCard":{"number":"4111111111111111","securityCode":"123","expirationDate":"2021/09","name":"APPROVED"},"paymentMethod":"VISA","payer":{"fullName":"APPROVED","contactPhone":"(555)
15
13
  555-5555","dniNumber":"32144457","emailAddress":"han@example.com","billingAddress":{"street1":"YT-1300","street2":"","city":"Mos
16
14
  Eisley","state":"AL","country":"US","phone":"(555) 555-5555"}},"extraParameters":{"INSTALLMENTS_NUMBER":1}}}'
17
15
  headers:
@@ -19,6 +17,8 @@ http_interactions:
19
17
  - application/json
20
18
  Accept:
21
19
  - application/json
20
+ Connection:
21
+ - close
22
22
  Accept-Encoding:
23
23
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
24
24
  User-Agent:
@@ -35,12 +35,14 @@ http_interactions:
35
35
  Transfer-Encoding:
36
36
  - chunked
37
37
  Date:
38
- - Tue, 15 May 2018 00:37:41 GMT
38
+ - Mon, 23 Mar 2020 17:01:16 GMT
39
+ Connection:
40
+ - close
39
41
  Server:
40
42
  - PayU server
41
43
  body:
42
44
  encoding: UTF-8
43
- string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":844152679,"transactionId":"0363c07c-2dbf-4445-a217-c083721e17d6","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1526344660595,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
44
- http_version:
45
- recorded_at: Tue, 15 May 2018 00:37:41 GMT
46
- recorded_with: VCR 3.0.3
45
+ string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":849193435,"transactionId":"ca0188be-2e5a-4d4e-a096-42ef800e3fdb","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1584982876132,"referenceQuestionnaire":null,"extraParameters":{"PAYMENT_WAY_ID":"4","BANK_REFERENCED_CODE":"CREDIT"},"additionalInfo":null}}'
46
+ http_version: null
47
+ recorded_at: Mon, 23 Mar 2020 17:01:16 GMT
48
+ recorded_with: VCR 5.1.0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'Payu Latam checkout', :vcr, type: :feature do
@@ -5,9 +7,19 @@ describe 'Payu Latam checkout', :vcr, type: :feature do
5
7
  let(:country) { create(:country) }
6
8
  let(:product) { create(:product) }
7
9
 
10
+ before do
11
+ config = { currency: 'PEN' }
12
+
13
+ if Spree.solidus_gem_version >= Gem::Version.new('2.9')
14
+ config.merge!(use_combined_first_and_last_name_in_address: false)
15
+ end
16
+
17
+ stub_preferences(config)
18
+ end
19
+
8
20
  context 'with autocapture' do
9
21
  before do
10
- Spree::Config.set(auto_capture: true)
22
+ stub_preferences(auto_capture: true)
11
23
  setup_payu_latam_gateway
12
24
  zone.members << Spree::ZoneMember.create!(zoneable: country)
13
25
  create(:store)
@@ -31,7 +43,6 @@ describe 'Payu Latam checkout', :vcr, type: :feature do
31
43
 
32
44
  context 'without autocapture' do
33
45
  before do
34
- Spree::Config.set(currency: 'PEN')
35
46
  setup_payu_latam_gateway
36
47
  zone.members << Spree::ZoneMember.create!(zoneable: country)
37
48
  create(:store)
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Spree::Order, type: :model do
4
- let(:order) { Spree::Order.new }
6
+ let(:order) { described_class.new }
5
7
 
6
8
  it 'has customer document attribute' do
7
9
  document = '43920390'
@@ -11,11 +13,11 @@ describe Spree::Order, type: :model do
11
13
 
12
14
  describe 'state_machine' do
13
15
  it 'dont have confirm state' do
14
- expect(Spree::Order.checkout_steps.key?(:confirm)).to be(false)
16
+ expect(described_class.checkout_steps.key?(:confirm)).to be(false)
15
17
  end
16
18
 
17
19
  context 'with payment_failed event' do
18
- let(:event) { Spree::Order.state_machine.events[:payment_failed] }
20
+ let(:event) { described_class.state_machine.events[:payment_failed] }
19
21
 
20
22
  it 'not have confirm state' do
21
23
  expect(event.known_states.include?(:confirm)).to be(false)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Spree::PermittedAttributes do
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Run Coverage report
2
4
  require 'simplecov'
3
5
  SimpleCov.start do
@@ -21,16 +23,24 @@ require 'ffaker'
21
23
  require 'vcr'
22
24
  require 'webmock'
23
25
  require 'capybara/rspec'
24
- require 'capybara/poltergeist'
25
- Capybara.register_driver(:poltergeist) do |app|
26
- Capybara::Poltergeist::Driver.new app, timeout: 90
26
+ require 'selenium-webdriver'
27
+ require 'pry'
28
+
29
+ Capybara.register_driver :geckodriver do |app|
30
+ ::Selenium::WebDriver::Firefox::Service.driver_path = ENV['DRIVER_PATH']
31
+ options = ::Selenium::WebDriver::Firefox::Options.new
32
+ options.args << '--headless'
33
+
34
+ Capybara::Selenium::Driver.new(app,
35
+ browser: :firefox,
36
+ options: options)
27
37
  end
28
- Capybara.javascript_driver = :poltergeist
29
- Capybara.default_max_wait_time = 10
38
+
39
+ Capybara.javascript_driver = :geckodriver
30
40
 
31
41
  # Requires supporting ruby files with custom matchers and macros, etc,
32
42
  # in spec/support/ and its subdirectories.
33
- Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
43
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].sort.each { |f| require f }
34
44
 
35
45
  # Requires factories and other useful helpers defined in spree_core.
36
46
  require 'spree/testing_support/authorization_helpers'
@@ -87,7 +97,6 @@ RSpec.configure do |config|
87
97
  config.before do
88
98
  DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
89
99
  DatabaseCleaner.start
90
- reset_spree_preferences
91
100
  end
92
101
 
93
102
  # After each spec clean the database.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PayuLatamHelper
2
4
  def setup_payu_latam_gateway
3
5
  Solidus::Gateway::PayuLatamGateway.create!(
@@ -10,11 +12,11 @@ module PayuLatamHelper
10
12
  end
11
13
 
12
14
  def fill_credit_card(number, document)
13
- fill_in 'Card Number', with: number, visible: false
15
+ page.execute_script("$('#card_number').val('#{number}')")
14
16
  # Otherwise ccType field does not get updated correctly
15
- page.execute_script("$('.cardNumber').trigger('change')")
17
+ page.execute_script("$('#card_number').trigger('change')")
16
18
  fill_in 'Card Code', with: '123'
17
- fill_in 'Expiration', with: "01 / #{Time.now.year + 1}"
19
+ page.execute_script("$('#card_expiry').val('09 / #{Time.now.year + 1}')")
18
20
  fill_in 'customer_document', with: document
19
21
  end
20
22
 
@@ -24,8 +26,16 @@ module PayuLatamHelper
24
26
  fill_in 'Street Address', with: 'YT-1300'
25
27
  fill_in 'City', with: 'Mos Eisley'
26
28
  select 'United States of America', from: 'Country'
27
- select country.states.first, from: 'order_bill_address_attributes_state_id'
29
+ select country.states.first.name, from: 'order_bill_address_attributes_state_id'
28
30
  fill_in 'Zip', with: '12010'
29
31
  fill_in 'Phone', with: '(555) 555-5555'
30
32
  end
33
+
34
+ def stub_preferences(preferences)
35
+ if Spree.solidus_gem_version >= Gem::Version.new('2.9')
36
+ stub_spree_preferences(preferences)
37
+ else
38
+ Spree::Config.set(preferences)
39
+ end
40
+ end
31
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_payu_latam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - César Carruitero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-17 00:00:00.000000000 Z
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: poltergeist
98
+ name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: selenium-webdriver
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: simplecov
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -199,8 +213,6 @@ files:
199
213
  - solidus_payu_latam.gemspec
200
214
  - spec/cassettes/Payu_Latam_checkout/with_autocapture/can_process_a_valid_payment.yml
201
215
  - spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/can_process.yml
202
- - spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/capture_payment.yml
203
- - spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/voids_a_payment.yml
204
216
  - spec/features/payu_latam_checkout_spec.rb
205
217
  - spec/models/spree/order_spec.rb
206
218
  - spec/models/spree/permitted_attributes_spec.rb
@@ -225,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
237
  - !ruby/object:Gem::Version
226
238
  version: '0'
227
239
  requirements: []
228
- rubyforge_project:
229
- rubygems_version: 2.6.13
240
+ rubygems_version: 3.0.6
230
241
  signing_key:
231
242
  specification_version: 4
232
243
  summary: Adds Solidus support for payments with Payu Latam Gateway
@@ -1,80 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi
6
- body:
7
- encoding: UTF-8
8
- string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"AUTHORIZATION","ipAddress":"127.0.0.1","order":{"accountId":"512323","referenceCode":"R580361650-9J9EPCMW","description":"unspecified","language":"en","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
9
- Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"},"buyer":{"fullName":"APPROVED","dniNumber":"32144457","dniType":null,"emailAddress":"han@example.com","contactPhone":"(555)
10
- 555-5555","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
11
- Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"}},"additionalValues":{"TX_VALUE":{"value":"19.99","currency":"PEN"}},"signature":"2540f234baa26bc8cdfa55b5c3f55955"},"creditCard":{"number":"4111111111111111","securityCode":"123","expirationDate":"2018/01","name":"APPROVED"},"paymentMethod":"VISA","payer":{"fullName":"APPROVED","contactPhone":"(555)
12
- 555-5555","dniNumber":"32144457","emailAddress":"han@example.com","billingAddress":{"street1":"YT-1300","street2":"","city":"Mos
13
- Eisley","state":"AL","country":"US","phone":"(555) 555-5555"}},"extraParameters":{"INSTALLMENTS_NUMBER":1}}}'
14
- headers:
15
- Content-Type:
16
- - application/json
17
- Accept:
18
- - application/json
19
- Accept-Encoding:
20
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
21
- User-Agent:
22
- - Ruby
23
- response:
24
- status:
25
- code: 200
26
- message: OK
27
- headers:
28
- X-Frame-Options:
29
- - sameorigin
30
- Content-Type:
31
- - application/json
32
- Transfer-Encoding:
33
- - chunked
34
- Date:
35
- - Mon, 18 Sep 2017 15:14:00 GMT
36
- Server:
37
- - PayU server
38
- body:
39
- encoding: UTF-8
40
- string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":842702277,"transactionId":"1d87ac8a-ff5a-4a6f-a449-5f733d532852","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1505747640647,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
41
- http_version:
42
- recorded_at: Mon, 18 Sep 2017 15:14:00 GMT
43
- - request:
44
- method: post
45
- uri: https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi
46
- body:
47
- encoding: UTF-8
48
- string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"CAPTURE","ipAddress":"127.0.0.1","order":{"id":"842702277"},"parentTransactionId":"1d87ac8a-ff5a-4a6f-a449-5f733d532852","reason":"n/a"}}'
49
- headers:
50
- Content-Type:
51
- - application/json
52
- Accept:
53
- - application/json
54
- Accept-Encoding:
55
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
56
- User-Agent:
57
- - Ruby
58
- response:
59
- status:
60
- code: 200
61
- message: OK
62
- headers:
63
- X-Frame-Options:
64
- - sameorigin
65
- Content-Type:
66
- - application/json
67
- Transfer-Encoding:
68
- - chunked
69
- Date:
70
- - Mon, 18 Sep 2017 15:14:13 GMT
71
- Server:
72
- - PayU server
73
- body:
74
- encoding: UTF-8
75
- string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":842702277,"transactionId":"ccea3589-968f-41d3-a32b-157eebd688b2","state":"ERROR","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":null,"authorizationCode":null,"pendingReason":null,"responseCode":"INTERNAL_PAYMENT_PROVIDER_ERROR","errorCode":"INTERNAL_ERROR","responseMessage":"Internal
76
- payment provider error. ORDER_NUMBER: The value of the parameter can not be
77
- null","transactionDate":null,"transactionTime":null,"operationDate":1505747653795,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
78
- http_version:
79
- recorded_at: Mon, 18 Sep 2017 15:14:14 GMT
80
- recorded_with: VCR 3.0.3
@@ -1,80 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi
6
- body:
7
- encoding: UTF-8
8
- string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"AUTHORIZATION","ipAddress":"127.0.0.1","order":{"accountId":"512323","referenceCode":"R459186849-JENBQPMM","description":"unspecified","language":"en","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
9
- Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"},"buyer":{"fullName":"APPROVED","dniNumber":"32144457","dniType":null,"emailAddress":"han@example.com","contactPhone":"(555)
10
- 555-5555","shippingAddress":{"street1":"YT-1300","street2":"","city":"Mos
11
- Eisley","state":"AL","country":"US","postalCode":"12010","phone":"(555) 555-5555"}},"additionalValues":{"TX_VALUE":{"value":"19.99","currency":"PEN"}},"signature":"4528350329f3f6a61818064a85b45977"},"creditCard":{"number":"4111111111111111","securityCode":"123","expirationDate":"2018/01","name":"APPROVED"},"paymentMethod":"VISA","payer":{"fullName":"APPROVED","contactPhone":"(555)
12
- 555-5555","dniNumber":"32144457","emailAddress":"han@example.com","billingAddress":{"street1":"YT-1300","street2":"","city":"Mos
13
- Eisley","state":"AL","country":"US","phone":"(555) 555-5555"}},"extraParameters":{"INSTALLMENTS_NUMBER":1}}}'
14
- headers:
15
- Content-Type:
16
- - application/json
17
- Accept:
18
- - application/json
19
- Accept-Encoding:
20
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
21
- User-Agent:
22
- - Ruby
23
- response:
24
- status:
25
- code: 200
26
- message: OK
27
- headers:
28
- X-Frame-Options:
29
- - sameorigin
30
- Content-Type:
31
- - application/json
32
- Transfer-Encoding:
33
- - chunked
34
- Date:
35
- - Mon, 18 Sep 2017 15:15:59 GMT
36
- Server:
37
- - PayU server
38
- body:
39
- encoding: UTF-8
40
- string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":842702339,"transactionId":"a2bb75ff-fcac-4a4e-95ae-348688b291dc","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1505747759446,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
41
- http_version:
42
- recorded_at: Mon, 18 Sep 2017 15:15:59 GMT
43
- - request:
44
- method: post
45
- uri: https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi
46
- body:
47
- encoding: UTF-8
48
- string: '{"test":true,"language":"en","command":"SUBMIT_TRANSACTION","merchant":{"apiLogin":"pRRXKOl8ikMmt9u","apiKey":"4Vj8eK4rloUd272L48hsrarnUA"},"transaction":{"paymentCountry":"PE","type":"VOID","ipAddress":"127.0.0.1","order":{"id":"842702339"},"parentTransactionId":"a2bb75ff-fcac-4a4e-95ae-348688b291dc","reason":"n/a"}}'
49
- headers:
50
- Content-Type:
51
- - application/json
52
- Accept:
53
- - application/json
54
- Accept-Encoding:
55
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
56
- User-Agent:
57
- - Ruby
58
- response:
59
- status:
60
- code: 200
61
- message: OK
62
- headers:
63
- X-Frame-Options:
64
- - sameorigin
65
- Content-Type:
66
- - application/json
67
- Transfer-Encoding:
68
- - chunked
69
- Date:
70
- - Mon, 18 Sep 2017 15:16:12 GMT
71
- Server:
72
- - PayU server
73
- body:
74
- encoding: UTF-8
75
- string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":842702339,"transactionId":"6cd96801-a802-4803-ac79-0edc661c58c9","state":"ERROR","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":null,"authorizationCode":null,"pendingReason":null,"responseCode":"INTERNAL_PAYMENT_PROVIDER_ERROR","errorCode":"INTERNAL_ERROR","responseMessage":"Internal
76
- payment provider error. ORDER_NUMBER: The value of the parameter can not be
77
- null","transactionDate":null,"transactionTime":null,"operationDate":1505747772620,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
78
- http_version:
79
- recorded_at: Mon, 18 Sep 2017 15:16:12 GMT
80
- recorded_with: VCR 3.0.3