solidus_payu_latam 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +1 -0
- data/.rubocop.yml +236 -0
- data/.travis.yml +8 -0
- data/Gemfile +19 -0
- data/LICENSE +19 -0
- data/README.md +45 -0
- data/Rakefile +30 -0
- data/app/models/concerns/solidus_payu_latam/inject_customer_document_concern.rb +17 -0
- data/app/models/concerns/solidus_payu_latam/permitted_attributes_concern.rb +7 -0
- data/app/models/order_decorator.rb +15 -0
- data/app/models/payment_decorator.rb +1 -0
- data/app/models/permitted_attributes_decorator.rb +1 -0
- data/app/models/solidus/gateway/payu_latam_gateway.rb +70 -0
- data/app/views/spree/admin/payments/source_forms/_payu_latam.html.erb +1 -0
- data/app/views/spree/checkout/payment/_payu_latam.html.erb +7 -0
- data/bin/rails +7 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20170916072806_add_customer_document_to_orders.rb +5 -0
- data/lib/generators/solidus_payu_latam/install/install_generator.rb +20 -0
- data/lib/solidus_payu_latam.rb +3 -0
- data/lib/solidus_payu_latam/engine.rb +17 -0
- data/lib/solidus_payu_latam/factories.rb +6 -0
- data/lib/solidus_payu_latam/version.rb +3 -0
- data/solidus_payu_latam.gemspec +31 -0
- data/spec/cassettes/Payu_Latam_checkout/with_autocapture/can_process_a_valid_payment.yml +43 -0
- data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/can_process.yml +43 -0
- data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/capture_payment.yml +80 -0
- data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/voids_a_payment.yml +80 -0
- data/spec/features/payu_latam_checkout_spec.rb +82 -0
- data/spec/models/spree/order_spec.rb +29 -0
- data/spec/models/spree/permitted_attributes_spec.rb +11 -0
- data/spec/spec_helper.rb +107 -0
- data/spec/support/payu_latam_helper.rb +31 -0
- metadata +232 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
module Solidus
|
2
|
+
class Gateway::PayuLatamGateway < ::Spree::Gateway
|
3
|
+
preference :merchant_id, :string
|
4
|
+
preference :account_id, :string
|
5
|
+
preference :api_login, :string
|
6
|
+
preference :api_key, :string
|
7
|
+
preference :account_country, :string, default: 'PE'
|
8
|
+
|
9
|
+
def provider_class
|
10
|
+
ActiveMerchant::Billing::PayuLatamGateway
|
11
|
+
end
|
12
|
+
|
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
|
21
|
+
end
|
22
|
+
|
23
|
+
def authorize(amount, credit_card, gateway_options)
|
24
|
+
cvv = credit_card.verification_value
|
25
|
+
options = add_missing_fields(gateway_options, cvv)
|
26
|
+
provider.authorize(amount, credit_card, options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def capture(amount, authorization, gateway_options)
|
30
|
+
options = add_payment_country(gateway_options, preferred_account_country)
|
31
|
+
provider.capture(amount, authorization, options)
|
32
|
+
end
|
33
|
+
|
34
|
+
def void(authorization, gateway_options)
|
35
|
+
options = add_payment_country(gateway_options, preferred_account_country)
|
36
|
+
provider.void(authorization, options)
|
37
|
+
end
|
38
|
+
|
39
|
+
def purchase(amount, credit_card, gateway_options)
|
40
|
+
cvv = credit_card.verification_value
|
41
|
+
options = add_missing_fields(gateway_options, cvv)
|
42
|
+
provider.purchase(amount, credit_card, options)
|
43
|
+
end
|
44
|
+
|
45
|
+
def credit(amount, authorization, gateway_options)
|
46
|
+
options = add_payment_country(gateway_options, preferred_account_country)
|
47
|
+
provider.refund(amount, authorization, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def add_missing_fields(options, cvv)
|
53
|
+
dni_number = options[:customer_document]
|
54
|
+
options.merge(
|
55
|
+
buyer_email: options[:email],
|
56
|
+
buyer_name: options[:shipping_address][:name],
|
57
|
+
buyer_dni_number: dni_number,
|
58
|
+
dni_number: dni_number,
|
59
|
+
payment_country: preferred_account_country,
|
60
|
+
cvv: cvv
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_payment_country(options, payment_country)
|
65
|
+
options.merge(
|
66
|
+
payment_country: payment_country
|
67
|
+
)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "spree/admin/payments/source_forms/gateway", payment_method: payment_method, previous_cards: payment_method.reusable_sources(@order) %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%= render "spree/checkout/payment/gateway", payment_method: payment_method %>
|
2
|
+
<% param_prefix = "payment_source[#{payment_method.id}]" %>
|
3
|
+
|
4
|
+
<p class="field">
|
5
|
+
<%= label_tag "document", Spree.t(:document) %><span class="required">*</span><br />
|
6
|
+
<%= text_field_tag '[order][customer_document]', '', id: 'customer_document', class: "required customerDocument", "payu-content": "document" %>
|
7
|
+
</p>
|
data/bin/rails
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
2
|
+
|
3
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
4
|
+
ENGINE_PATH = File.expand_path('../../lib/solidus_payu_latam/engine', __FILE__)
|
5
|
+
|
6
|
+
require 'rails/all'
|
7
|
+
require 'rails/engine/commands'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module SolidusPayuLatam
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
class_option :auto_run_migrations, type: :boolean, default: false
|
5
|
+
|
6
|
+
def add_migrations
|
7
|
+
run 'bundle exec rake railties:install:migrations FROM=solidus_payu_latam'
|
8
|
+
end
|
9
|
+
|
10
|
+
def run_migrations
|
11
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
|
12
|
+
if run_migrations
|
13
|
+
run 'bundle exec rake db:migrate'
|
14
|
+
else
|
15
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SolidusPayuLatam
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
engine_name 'solidus_payu_latam'
|
4
|
+
|
5
|
+
initializer 'spree.gateway.payment_methods', after: 'spree.register.payment_methods' do |app|
|
6
|
+
app.config.spree.payment_methods << Solidus::Gateway::PayuLatamGateway
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.activate
|
10
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
11
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
config.to_prepare(&method(:activate).to_proc)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
|
3
|
+
#
|
4
|
+
# Example adding this to your spec_helper will load these Factories for use:
|
5
|
+
# require 'solidus_payu_latam/factories'
|
6
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'solidus_payu_latam/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'solidus_payu_latam'
|
7
|
+
s.version = SolidusPayuLatam::VERSION
|
8
|
+
s.summary = 'Adds Solidus support for Payu Latam Gateway'
|
9
|
+
s.description = s.summary
|
10
|
+
s.license = 'MIT'
|
11
|
+
|
12
|
+
s.author = 'César Carruitero'
|
13
|
+
s.email = 'ccarruitero@protonmail.com'
|
14
|
+
s.homepage = 'https://github.com/ccarruitero/solidus_payu_latam'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
|
19
|
+
s.add_dependency 'solidus_core'
|
20
|
+
s.add_dependency 'solidus_support'
|
21
|
+
s.add_dependency 'activemerchant'
|
22
|
+
|
23
|
+
s.add_development_dependency 'capybara'
|
24
|
+
s.add_development_dependency 'poltergeist'
|
25
|
+
s.add_development_dependency 'database_cleaner'
|
26
|
+
s.add_development_dependency 'factory_girl'
|
27
|
+
s.add_development_dependency 'rspec-rails'
|
28
|
+
s.add_development_dependency 'rubocop'
|
29
|
+
s.add_development_dependency 'rubocop-rspec'
|
30
|
+
s.add_development_dependency 'simplecov'
|
31
|
+
end
|
@@ -0,0 +1,43 @@
|
|
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_AND_CAPTURE","ipAddress":"127.0.0.1","order":{"accountId":"512323","referenceCode":"R877716727-HQ9T7TWE","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":"USD"}},"signature":"cb29d6aaa02622983790c12e39b54150"},"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:18:10 GMT
|
36
|
+
Server:
|
37
|
+
- PayU server
|
38
|
+
body:
|
39
|
+
encoding: UTF-8
|
40
|
+
string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":842702343,"transactionId":"d78e06e6-394a-45f2-96d2-67cff5c25d18","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1505747891366,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Mon, 18 Sep 2017 15:18:11 GMT
|
43
|
+
recorded_with: VCR 3.0.3
|
data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/can_process.yml
ADDED
@@ -0,0 +1,43 @@
|
|
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":"R730213982-C3W8HTYG","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":"8ffc7ec47eec0198066245857c1ced63"},"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:16:51 GMT
|
36
|
+
Server:
|
37
|
+
- PayU server
|
38
|
+
body:
|
39
|
+
encoding: UTF-8
|
40
|
+
string: '{"code":"SUCCESS","error":null,"transactionResponse":{"orderId":842702341,"transactionId":"386dfded-1f66-42fa-99e1-59b5b3344f53","state":"APPROVED","paymentNetworkResponseCode":null,"paymentNetworkResponseErrorMessage":null,"trazabilityCode":"00000000","authorizationCode":"00000000","pendingReason":null,"responseCode":"APPROVED","errorCode":null,"responseMessage":null,"transactionDate":null,"transactionTime":null,"operationDate":1505747811279,"referenceQuestionnaire":null,"extraParameters":null,"additionalInfo":null}}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Mon, 18 Sep 2017 15:16:51 GMT
|
43
|
+
recorded_with: VCR 3.0.3
|
data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/capture_payment.yml
ADDED
@@ -0,0 +1,80 @@
|
|
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
|
data/spec/cassettes/Payu_Latam_checkout/without_autocapture/with_valid_payment/voids_a_payment.yml
ADDED
@@ -0,0 +1,80 @@
|
|
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
|