clearsaleID 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cc1529f424874987a753545de3db47dd4b7a47cc
4
+ data.tar.gz: 84859b5a282352294b9200398f043cd2179555e0
5
+ SHA512:
6
+ metadata.gz: 244a8d2c80ee9648194bc9454b87af6a473e6135c2e68b59cd29e43fe86371312f081551deec3f94732261ec88dd753d0cd8588acbfb69d8388a5ed0d8f20ba4
7
+ data.tar.gz: 2d6a600cf30838432c67de1efa8e9c7d713fdbb3328cbdbd629d3d5dc728143030ce85c666a4208d6b43abd72fbf1719ac478094cf50706b194fa54cb6532d51
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.sw*
2
+ tags
3
+ *.gem
4
+ bin
5
+ .bundle
6
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,10 @@
1
+ guard 'bundler' do
2
+ watch('Gemfile')
3
+ end
4
+
5
+ guard 'rspec', :version => 2, :bundler => false do
6
+ watch(%r{^spec/(.*)_spec\.rb$})
7
+ watch(%r{^lib/clearsale.rb$}) { "spec" }
8
+ watch(%r{^lib/clearsale/(.*)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
9
+ watch('spec/spec_helper.rb') { "spec" }
10
+ end
data/README.rdoc ADDED
@@ -0,0 +1,112 @@
1
+ = ClearsaleID
2
+
3
+ Esta gem foi inspirada na Gem https://github.com/Baby-com-br/clearsale, fiz apenas a mudança dos campos e URL conformo manual da clearsale, deixo um agradecimento ao Daniel Konishi, pelo esforço.
4
+
5
+ == Instalação
6
+ Defina a variavél de ambiente CLEARSALE_ENTITYCODE
7
+ Clearsale::Config.entity_code = '03524C82-F434-4A32-8D34-EFFF2023341B'
8
+
9
+ Defina a variavél de ambiente CLEARSALE_ENV
10
+ Clearsale::Config.env = 'production' ou 'holog'
11
+
12
+ Adicione no seu Gemfile
13
+ gem 'clearsaleID', :github => 'brunofrank/ClearSaleID'
14
+
15
+ Execute
16
+ bundle install
17
+
18
+ == Uso
19
+ require 'clearsale'
20
+
21
+ order = {
22
+ :order_id => 11989283922,
23
+ :session_id => '1l1j23lkj12lk3jl123',
24
+ :paid_at => 2.seconds.ago,
25
+ :billing_address => {
26
+ :street_name => 'Bla St',
27
+ :number => '123',
28
+ :complement => '',
29
+ :neighborhood => 'Rhode Island',
30
+ :city => 'Mayland',
31
+ :state => 'Maryland',
32
+ :postal_code => '00100-011'
33
+ },
34
+ :shipping_address => {
35
+ :street_name => 'Bla St',
36
+ :number => '123',
37
+ :complement => '',
38
+ :neighborhood => 'Rhode Island',
39
+ :city => 'Mayland',
40
+ :state => 'Maryland',
41
+ :postal_code => '00100-011'
42
+ },
43
+ :installments => 3,
44
+ :total_items => 150.00,
45
+ :total_order => 150.00,
46
+ :items_count => 2,
47
+ :created_at => Time.current,
48
+ :order_items => [
49
+ {
50
+ :product => {
51
+ :product_id => 5555,
52
+ :name => 'Pogobol',
53
+ :category => { :category_id => 7777, :name => 'Disney' }
54
+ },
55
+ :price => 75.00,
56
+ :quantity => 1,
57
+ },
58
+ {
59
+ :product => {
60
+ :product_id => 5555,
61
+ :name => 'Pogobol',
62
+ :category => { :category_id => 7777, :name => 'Disney' }
63
+ },
64
+ :price => 75.00,
65
+ :quantity => 1,
66
+ }
67
+ ],
68
+ }
69
+
70
+ payment = {
71
+ :card_holder => 'Papai Noel',
72
+ :card_number => '1234432111112222',
73
+ :card_expiration => '05/2012',
74
+ :card_security_code => '123',
75
+ :acquirer => 'visa',
76
+ :amount => 150.00,
77
+ }
78
+
79
+ user = {
80
+ :email => 'papainoel@gmail.com',
81
+ :user_id => 8888,
82
+ :cpf => '248.783.463-37',
83
+ :full_name => 'Papai Noel',
84
+ :birthdate => 40.years.ago,
85
+ :phone => '11 8001 1002',
86
+ :gender => 'm',
87
+ :last_sign_in_ip => '127.0.0.1',
88
+ }
89
+
90
+ #Solicitando a analise
91
+ response = Clearsale::Analysis.send_order(order, payment, user)
92
+
93
+ #consultando a analise
94
+ order_id = '1234'
95
+ response = Clearsale::Analysis.get_order_status(order_id)
96
+
97
+ response.order_id
98
+ # => 1234
99
+
100
+ response.score
101
+ # => (0.01..21.11)
102
+
103
+ response.status
104
+ # => :automatic_approval
105
+ # => :manual_approval
106
+ # => :rejected_without_suspicion
107
+ # => :manual_analysis
108
+ # => :error
109
+ # => :waiting
110
+ # => :manual_rejection
111
+ # => :cancelled
112
+ # => :fraud
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/clearsale.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "clearsale/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "clearsaleID"
7
+ s.version = Clearsale::VERSION
8
+ s.authors = ["Bruno Frank"]
9
+ s.email = %w[bfscordeiro@gmail.com]
10
+ s.homepage = "http://github.com/brunofrank/ClearSaleID"
11
+ s.summary = "clearsale gem to use Clearsale ClearID service"
12
+ s.description = "clearsale gem to use Clearsale ClearID service"
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+ s.add_dependency "builder"
19
+ s.add_dependency "savon", "=2.6.0"
20
+
21
+ s.add_development_dependency "rake"
22
+ s.add_development_dependency "rspec"
23
+ s.add_development_dependency "webmock" , "~> 1.7.0"
24
+ s.add_development_dependency "vcr" , "~> 1.11.3"
25
+ s.add_development_dependency "guard-rspec"
26
+ s.add_development_dependency "guard-bundler"
27
+ s.add_development_dependency "debugger" , ">= 1.6.5"
28
+ s.add_development_dependency "activesupport"
29
+ s.add_development_dependency "i18n"
30
+ s.add_development_dependency "curb"
31
+ s.add_development_dependency "timecop"
32
+ s.add_development_dependency "psych" , "~> 2.0.2"
33
+ end
@@ -0,0 +1,27 @@
1
+ module Clearsale
2
+ class Analysis
3
+ def self.connector
4
+ @connector ||= Clearsale::Connector.build
5
+ end
6
+
7
+ def self.send_order(order_hash, payment_hash, user_hash)
8
+ order = Object.new(order_hash)
9
+ payment = Object.new(payment_hash)
10
+ user = Object.new(user_hash)
11
+
12
+ order_xml = Clearsale::Order.to_xml(order, payment, user)
13
+ request = {"xml" => order_xml}
14
+
15
+ OrderResponse.build_from_send_order(connector.do_request('SendOrders', request))
16
+ end
17
+
18
+ def self.clear_connector
19
+ @connector = nil
20
+ end
21
+
22
+ def self.get_order_status(order_id)
23
+ request = {'orderID' => order_id}
24
+ OrderResponse.build_from_update(connector.do_request('GetOrderStatus', request))
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,24 @@
1
+ require 'savon'
2
+ require 'nori'
3
+
4
+ module Clearsale
5
+ class Config
6
+ cattr_accessor :logger, :log, :read_timeout, :open_timeout, :entity_code, :env, :proxy
7
+
8
+ def self.logger
9
+ @@logger ||= Logger.new(STDOUT)
10
+ end
11
+
12
+ def self.log
13
+ @@log.nil? ? true : @@log
14
+ end
15
+
16
+ def self.entity_code
17
+ @@entity_code.nil? ? ENV['CLEARSALE_ENTITYCODE'] : @@entity_code
18
+ end
19
+
20
+ def self.env
21
+ @@env.nil? ? 'homolog' : @@env
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,61 @@
1
+ require 'savon'
2
+ require 'nori'
3
+
4
+ module Clearsale
5
+ class Connector
6
+ NAMESPACE = "http://www.clearsale.com.br/integration"
7
+
8
+ URLs = {
9
+ "homolog" => 'http://homologacao.clearsale.com.br/integracaov2/service.asmx',
10
+ "production" => 'https://integracao.clearsale.com.br/service.asmx'
11
+ }
12
+
13
+ def self.build(env = Clearsale::Config.env)
14
+ url = URLs[env]
15
+ proxy = Clearsale::Config.proxy
16
+ new url, proxy
17
+ end
18
+
19
+ def initialize(endpoint_url, proxy=nil)
20
+ @token = Clearsale::Config.entity_code
21
+
22
+ namespaces = {
23
+ 'xmlns:soap' => "http://www.w3.org/2003/05/soap-envelope",
24
+ 'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema" ,
25
+ 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance" ,
26
+ 'xmlns:int' => "http://www.clearsale.com.br/integration",
27
+ }
28
+
29
+ savon_options = {:endpoint => endpoint_url, :namespace => NAMESPACE,
30
+ :namespaces => namespaces, :convert_request_keys_to => :snakecase }
31
+
32
+ savon_options[:proxy] = proxy if proxy
33
+ savon_options[:log] = Clearsale::Config.log
34
+ savon_options[:logger] = Clearsale::Config.logger
35
+ savon_options[:read_timeout] = Clearsale::Config.read_timeout if Clearsale::Config.read_timeout.present?
36
+ savon_options[:open_timeout] = Clearsale::Config.open_timeout if Clearsale::Config.open_timeout.present?
37
+
38
+ @client = Savon.client(savon_options)
39
+ end
40
+
41
+ def do_request(method, request)
42
+ namespaced_request = append_namespace('int', request)
43
+ arguments = namespaced_request.merge({'int:entityCode' => @token})
44
+
45
+ response = @client.call(method, :message => arguments, :soap_action => "#{NAMESPACE}/#{method}")
46
+
47
+ extract_response_xml(method, response.to_hash)
48
+ end
49
+
50
+ def extract_response_xml(method, response)
51
+ results = response.fetch(:"#{method.snakecase}_response", {})
52
+ response_xml = results.fetch(:"#{method.snakecase}_result", {}).to_s
53
+
54
+ Nori.new(:parser => :nokogiri, :convert_tags_to => lambda { |tag| tag.snakecase.to_sym }).parse(response_xml.gsub(/^<\?xml.*\?>/, ''))
55
+ end
56
+
57
+ def append_namespace(namespace, hash)
58
+ Hash[hash.map {|key, value| ["#{namespace}:#{key}", value]}]
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,28 @@
1
+ class Clearsale::LoggerFormatterFilter
2
+ OPEN_TAG = lambda{ |tag_name| "&lt;#{tag_name}&gt;" }
3
+ CLOSE_TAG = lambda{ |tag_name| "&lt;\/#{tag_name}&gt;" }
4
+ TAG_REGEXP = lambda{ |tag_name, content| "#{OPEN_TAG.call(tag_name)}#{content}#{CLOSE_TAG.call(tag_name)}" }
5
+
6
+ def filter(msg)
7
+ return msg if !msg.respond_to?(:gsub) || @tags_to_filter.nil?
8
+
9
+ @tags_to_filter.each do |tag|
10
+ msg = msg.gsub(%r{#{TAG_REGEXP.call(tag,'.*')}}, TAG_REGEXP.call(tag,"[FILTERED]"))
11
+ end
12
+ msg
13
+ end
14
+
15
+ def initialize(tags_to_filter = [], &block)
16
+ @tags_to_filter = tags_to_filter
17
+ @block = block
18
+ end
19
+
20
+ def call(severity, datetime, progname, msg)
21
+ if @block
22
+ @block.call(severity, datetime, progname, filter(msg))
23
+ else
24
+ "#{severity} #{datetime} --#{progname}: #{filter(msg)}"
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,27 @@
1
+ require 'ostruct'
2
+
3
+ module Clearsale
4
+ class Object < OpenStruct
5
+ def new_ostruct_member(name)
6
+ name = name.to_sym
7
+ unless self.respond_to?(name)
8
+ class << self; self; end.class_eval do
9
+ define_method(name) {
10
+ v = @table[name]
11
+ case v
12
+ when Hash
13
+ Object.new(v)
14
+ when Array
15
+ v.each_with_index { |item, index| v[index] = Object.new(item) }
16
+ else
17
+ v
18
+ end
19
+ }
20
+ define_method("#{name}=") { |x| modifiable[name] = x }
21
+ define_method("#{name}_as_a_hash") { @table[name] }
22
+ end
23
+ end
24
+ name
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,135 @@
1
+ require 'builder'
2
+ require 'ostruct'
3
+
4
+ module Clearsale
5
+ class Order
6
+ CARD_TYPE_MAP = {
7
+ :visa => 3,
8
+ :mastercard => 2
9
+ }
10
+ def self.to_xml(order, payment, user)
11
+ builder = Builder::XmlMarkup.new(:indent => 2, :encoding => 'utf-8')
12
+ xml = builder.tag!("ClearID_Input") do |b|
13
+ builder.tag!('SessionID', order.session_id)
14
+ b.tag!('Pedido') do |b|
15
+ build_order(b, order, payment, user)
16
+ end
17
+ end
18
+ xml.to_s
19
+ end
20
+
21
+ def self.build_order(builder, order, payment, user)
22
+ builder.tag!('PedidoID', order.order_id)
23
+ builder.tag!('Data', order.created_at.strftime("%Y-%m-%dT%H:%M:%S"))
24
+ builder.tag!('Email', user.email)
25
+ builder.tag!('ValorTotalItens', order.total_items)
26
+ builder.tag!('ValorTotalPedido', order.total_order)
27
+ builder.tag!('QtdParcelas', order.installments)
28
+ builder.tag!('QtdItens', order.items_count)
29
+ builder.tag!('IP', user.last_sign_in_ip)
30
+ builder.tag!('DadosCobranca') do |b|
31
+ build_user_data(b, user, order.billing_address)
32
+ end
33
+ builder.tag!('DadosEntrega') do |b|
34
+ build_user_data(b, user, order.shipping_address)
35
+ end
36
+
37
+ builder.tag!('Pagamentos') do |b|
38
+ build_payment_data(b, order, payment, user)
39
+ end
40
+
41
+ builder.tag!('Itens') do |b|
42
+ order.order_items.each do |order_item|
43
+ build_item(b, order_item)
44
+ end
45
+ end
46
+ end
47
+
48
+ def self.build_user_data(builder, user, billing_address)
49
+ builder.tag!('UsuarioID', user.user_id)
50
+ builder.tag!('TipoUsuario', 1) # Pessoa Física
51
+ builder.tag!('DocumentoLegal1', user.cpf.gsub(/[\.\-]*/, '').strip)
52
+ builder.tag!('Nome', user.full_name)
53
+ builder.tag!('Email', user.email)
54
+ builder.tag!('Sexo', user.gender.downcase)
55
+ builder.tag!('Nascimento', user.birthdate.to_time.strftime("%Y-%m-%dT%H:%M:%S")) if user.birthdate.present?
56
+ build_address(builder, billing_address)
57
+ builder.tag!('Telefones') do |b|
58
+ build_phone(b, user)
59
+ end
60
+ end
61
+
62
+ def self.build_address(builder, address)
63
+ builder.tag!('Endereco') do |b|
64
+ builder.tag!('Logradouro', address.street_name)
65
+ builder.tag!('Complemento', address.complement)
66
+ builder.tag!('Numero', address.number)
67
+ builder.tag!('Bairro', address.neighborhood)
68
+ builder.tag!('Cidade', address.city)
69
+ builder.tag!('UF', address.state)
70
+ builder.tag!('CEP', address.postal_code)
71
+ builder.tag!('Pais', 'Brasil')
72
+ end
73
+ end
74
+
75
+ def self.build_collection_address(builder, address)
76
+ builder.tag!('EnderecoCobranca') do |b|
77
+ builder.tag!('Logradouro', address.street_name)
78
+ builder.tag!('Complemento', address.complement)
79
+ builder.tag!('Numero', address.number)
80
+ builder.tag!('Bairro', address.neighborhood)
81
+ builder.tag!('Cidade', address.city)
82
+ builder.tag!('UF', address.state)
83
+ builder.tag!('CEP', address.postal_code)
84
+ builder.tag!('Pais', 'Brasil')
85
+ end
86
+ end
87
+
88
+ def self.build_phone(builder, user)
89
+ if user.phone.present?
90
+ stripped_phone = user.phone.gsub(/\(*\)*\s*\-*/, '')
91
+
92
+ builder.tag!('Telefone') do |b|
93
+ b.tag!('Tipo', 0) # Undefined
94
+ b.tag!('DDD', stripped_phone[0..1])
95
+ b.tag!('Numero', stripped_phone[2..-1])
96
+ end
97
+ end
98
+ end
99
+
100
+ def self.build_payment_data(builder, order, payment, user)
101
+ builder.tag!('Pagamento') do |b|
102
+ paid_at = order.paid_at || Time.current
103
+
104
+ b.tag!('Data', paid_at.strftime("%Y-%m-%dT%H:%M:%S"))
105
+ b.tag!('Valor', payment.amount)
106
+
107
+ #is_credit_card
108
+ b.tag!('TipoPagamentoID', 1)
109
+
110
+ b.tag!('QtdParcelas', order.installments)
111
+
112
+ b.tag!('HashNumeroCartao', payment.card_hash)
113
+ b.tag!('BinCartao', payment.card_number[0..5])
114
+ b.tag!('Cartao4Ultimos', payment.card_number.reverse[0..3])
115
+ b.tag!('TipoCartao', CARD_TYPE_MAP.fetch(payment.acquirer.to_sym, 4)) # Failover is 'outros'
116
+ b.tag!('DataValidadeCartao', payment.card_expiration)
117
+ b.tag!('NomeTitularCartao', payment.customer_name)
118
+ b.tag!('DocumentoLegal1', user.cpf.gsub(/[\.\-]*/, '').strip)
119
+
120
+ build_collection_address(b, order.billing_address)
121
+ end
122
+ end
123
+
124
+ def self.build_item(builder, order_item)
125
+ builder.tag!('Item') do |b|
126
+ b.tag!('CodigoItem', order_item.product.product_id)
127
+ b.tag!('NomeItem', order_item.product.name)
128
+ b.tag!('ValorItem', order_item.price)
129
+ b.tag!('Quantidade', order_item.quantity)
130
+ b.tag!('CodigoCategoria', order_item.product.category.category_id) if order_item.product.category.try(:category_id).present?
131
+ b.tag!('NomeCategoria', order_item.product.category.name) if order_item.product.category.try(:name).present?
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,50 @@
1
+ module Clearsale
2
+ class OrderResponse
3
+ STATUS_MAP = {
4
+ "APA" => :approved,
5
+ "PAV" => :approval_pending,
6
+ "APQ" => :approved_by_survey,
7
+ "RPQ" => :rejected_by_survey,
8
+ "RPP" => :rejected_by_policy,
9
+ "RPA" => :rejected
10
+ }
11
+
12
+ attr_reader :order_id, :status, :score, :transaction_id, :quiz_url
13
+
14
+ def self.build_from_send_order(package)
15
+ new(package.fetch(:package_status, {}))
16
+ end
17
+
18
+ def self.build_from_update(package)
19
+ new(package.fetch(:clear_sale, {}))
20
+ end
21
+
22
+ def initialize(hash)
23
+ response = hash.fetch(:orders, {}).fetch(:order, {})
24
+ if response.blank?
25
+ if hash && hash[:status_code] == "05"
26
+ @status = :order_already_exists
27
+ else
28
+ @status = :inexistent_order
29
+ end
30
+ else
31
+ @order_id = response[:id].gsub(/[a-zA-Z]*/, '').to_i
32
+ @score = response[:score].to_f
33
+ @quiz_url = response[:quiz_url]
34
+ @status = STATUS_MAP[response[:status]]
35
+ end
36
+ end
37
+
38
+ def approved?
39
+ @status == :approved || @status == :approved_by_survey
40
+ end
41
+
42
+ def rejected?
43
+ @status == :rejected_by_survey || @status == :rejected_by_policy || @status == :rejected
44
+ end
45
+
46
+ def pending?
47
+ @status == :approval_pending
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module Clearsale
2
+ VERSION = "1.0.5"
3
+ end
data/lib/clearsale.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'active_support/all'
2
+ require 'clearsale/analysis'
3
+ require 'clearsale/config'
4
+ require 'clearsale/connector'
5
+ require 'clearsale/logger_formatter_filter'
6
+ require 'clearsale/object'
7
+ require 'clearsale/order'
8
+ require 'clearsale/order_response'
9
+
10
+ module Clearsale
11
+ end
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.clearsale.com.br/integration" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
3
+ <soap:Body>
4
+ <int:SendOrders>
5
+ <int:xml>&lt;ClearSale&gt;&lt;Orders&gt;&lt;Order&gt;&lt;ID&gt;83F027&lt;/ID&gt;&lt;Date&gt;2012-09-13T13:54:53&lt;/Date&gt;&lt;Email&gt;dkonishi@gmail.com&lt;/Email&gt;&lt;TotalItens&gt;10.9&lt;/TotalItens&gt;&lt;TotalOrder&gt;10.9&lt;/TotalOrder&gt;&lt;QtyInstallments&gt;1&lt;/QtyInstallments&gt;&lt;QtyItems&gt;1&lt;/QtyItems&gt;&lt;IP&gt;127.0.0.1&lt;/IP&gt;&lt;CollectionData&gt;&lt;ID&gt;14&lt;/ID&gt;&lt;Type&gt;1&lt;/Type&gt;&lt;LegalDocument1&gt;27836038882&lt;/LegalDocument1&gt;&lt;Name&gt;Daniel Konishi&lt;/Name&gt;&lt;BirthDate&gt;1990-10-10T00:00:00&lt;/BirthDate&gt;&lt;Email&gt;dkonishi@gmail.com&lt;/Email&gt;&lt;Genre&gt;m&lt;/Genre&gt;&lt;Address&gt;&lt;Street&gt;Rua Carlos Del Prete&lt;/Street&gt;&lt;Number&gt;212&lt;/Number&gt;&lt;Comp&gt;&lt;/Comp&gt;&lt;County&gt;Centro&lt;/County&gt;&lt;City&gt;São Bernardo do Campo&lt;/City&gt;&lt;State&gt;SP&lt;/State&gt;&lt;ZipCode&gt;09710-230&lt;/ZipCode&gt;&lt;/Address&gt;&lt;Phones&gt;&lt;Phone&gt;&lt;Type&gt;0&lt;/Type&gt;&lt;DDD&gt;11&lt;/DDD&gt;&lt;Number&gt;345678977&lt;/Number&gt;&lt;/Phone&gt;&lt;/Phones&gt;&lt;/CollectionData&gt;&lt;ShippingData&gt;&lt;ID&gt;14&lt;/ID&gt;&lt;Type&gt;1&lt;/Type&gt;&lt;LegalDocument1&gt;27836038882&lt;/LegalDocument1&gt;&lt;Name&gt;Daniel Konishi&lt;/Name&gt;&lt;BirthDate&gt;1990-10-10T00:00:00&lt;/BirthDate&gt;&lt;Email&gt;dkonishi@gmail.com&lt;/Email&gt;&lt;Genre&gt;m&lt;/Genre&gt;&lt;Address&gt;&lt;Street&gt;Rua Carlos Del Prete&lt;/Street&gt;&lt;Number&gt;212&lt;/Number&gt;&lt;Comp&gt;&lt;/Comp&gt;&lt;County&gt;Centro&lt;/County&gt;&lt;City&gt;São Bernardo do Campo&lt;/City&gt;&lt;State&gt;SP&lt;/State&gt;&lt;ZipCode&gt;09710-230&lt;/ZipCode&gt;&lt;/Address&gt;&lt;Phones&gt;&lt;Phone&gt;&lt;Type&gt;0&lt;/Type&gt;&lt;DDD&gt;11&lt;/DDD&gt;&lt;Number&gt;345678977&lt;/Number&gt;&lt;/Phone&gt;&lt;/Phones&gt;&lt;/ShippingData&gt;&lt;Payments&gt;&lt;Payment&gt;&lt;Date&gt;2012-09-13T13:54:53&lt;/Date&gt;&lt;Amount&gt;10.9&lt;/Amount&gt;&lt;PaymentTypeID&gt;1&lt;/PaymentTypeID&gt;&lt;QtyInstallments&gt;1&lt;/QtyInstallments&gt;&lt;CardNumber&gt;4000000000000002&lt;/CardNumber&gt;&lt;CardBin&gt;1234&lt;/CardBin&gt;&lt;CardType&gt;5&lt;/CardType&gt;&lt;CardExpirationDate&gt;02/13&lt;/CardExpirationDate&gt;&lt;Name&gt;McKay Thomas&lt;/Name&gt;&lt;LegalDocument&gt;27836038882&lt;/LegalDocument&gt;&lt;Address&gt;&lt;Street&gt;Rua Carlos Del Prete&lt;/Street&gt;&lt;Number&gt;212&lt;/Number&gt;&lt;Comp&gt;&lt;/Comp&gt;&lt;County&gt;Centro&lt;/County&gt;&lt;City&gt;São Bernardo do Campo&lt;/City&gt;&lt;State&gt;SP&lt;/State&gt;&lt;ZipCode&gt;09710-230&lt;/ZipCode&gt;&lt;/Address&gt;&lt;/Payment&gt;&lt;/Payments&gt;&lt;Items&gt;&lt;Item&gt;&lt;ID&gt;123&lt;/ID&gt;&lt;Name&gt;Produto 2&lt;/Name&gt;&lt;ItemValue&gt;1.0&lt;/ItemValue&gt;&lt;Qty&gt;1&lt;/Qty&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/Order&gt;&lt;/Orders&gt;&lt;/ClearSale&gt;</int:xml>
6
+ <int:entityCode>0E6F0C82-FC05-4AA7-86D4-EBBFC0FDC41A</int:entityCode>
7
+ </int:SendOrders>
8
+ </soap:Body>
9
+ </soap:Envelope>
10
+
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.clearsale.com.br/integration" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
3
+ <soap:Body>
4
+ <int:SendOrders>
5
+ <int:xml>&lt;ClearSale&gt;&lt;Orders&gt;&lt;Order&gt;&lt;ID&gt;83F027&lt;/ID&gt;&lt;Date&gt;2012-09-13T13:54:53&lt;/Date&gt;&lt;Email&gt;dkonishi@gmail.com&lt;/Email&gt;&lt;TotalItens&gt;10.9&lt;/TotalItens&gt;&lt;TotalOrder&gt;10.9&lt;/TotalOrder&gt;&lt;QtyInstallments&gt;1&lt;/QtyInstallments&gt;&lt;QtyItems&gt;1&lt;/QtyItems&gt;&lt;IP&gt;127.0.0.1&lt;/IP&gt;&lt;CollectionData&gt;&lt;ID&gt;14&lt;/ID&gt;&lt;Type&gt;1&lt;/Type&gt;&lt;LegalDocument1&gt;27836038882&lt;/LegalDocument1&gt;&lt;Name&gt;Daniel Konishi&lt;/Name&gt;&lt;BirthDate&gt;1990-10-10T00:00:00&lt;/BirthDate&gt;&lt;Email&gt;dkonishi@gmail.com&lt;/Email&gt;&lt;Genre&gt;m&lt;/Genre&gt;&lt;Address&gt;&lt;Street&gt;Rua Carlos Del Prete&lt;/Street&gt;&lt;Number&gt;212&lt;/Number&gt;&lt;Comp&gt;&lt;/Comp&gt;&lt;County&gt;Centro&lt;/County&gt;&lt;City&gt;São Bernardo do Campo&lt;/City&gt;&lt;State&gt;SP&lt;/State&gt;&lt;ZipCode&gt;09710-230&lt;/ZipCode&gt;&lt;/Address&gt;&lt;Phones&gt;&lt;Phone&gt;&lt;Type&gt;0&lt;/Type&gt;&lt;DDD&gt;11&lt;/DDD&gt;&lt;Number&gt;345678977&lt;/Number&gt;&lt;/Phone&gt;&lt;/Phones&gt;&lt;/CollectionData&gt;&lt;ShippingData&gt;&lt;ID&gt;14&lt;/ID&gt;&lt;Type&gt;1&lt;/Type&gt;&lt;LegalDocument1&gt;27836038882&lt;/LegalDocument1&gt;&lt;Name&gt;Daniel Konishi&lt;/Name&gt;&lt;BirthDate&gt;1990-10-10T00:00:00&lt;/BirthDate&gt;&lt;Email&gt;dkonishi@gmail.com&lt;/Email&gt;&lt;Genre&gt;m&lt;/Genre&gt;&lt;Address&gt;&lt;Street&gt;Rua Carlos Del Prete&lt;/Street&gt;&lt;Number&gt;212&lt;/Number&gt;&lt;Comp&gt;&lt;/Comp&gt;&lt;County&gt;Centro&lt;/County&gt;&lt;City&gt;São Bernardo do Campo&lt;/City&gt;&lt;State&gt;SP&lt;/State&gt;&lt;ZipCode&gt;09710-230&lt;/ZipCode&gt;&lt;/Address&gt;&lt;Phones&gt;&lt;Phone&gt;&lt;Type&gt;0&lt;/Type&gt;&lt;DDD&gt;11&lt;/DDD&gt;&lt;Number&gt;345678977&lt;/Number&gt;&lt;/Phone&gt;&lt;/Phones&gt;&lt;/ShippingData&gt;&lt;Payments&gt;&lt;Payment&gt;&lt;Date&gt;2012-09-13T13:54:53&lt;/Date&gt;&lt;Amount&gt;10.9&lt;/Amount&gt;&lt;PaymentTypeID&gt;1&lt;/PaymentTypeID&gt;&lt;QtyInstallments&gt;1&lt;/QtyInstallments&gt;&lt;CardNumber&gt;[FILTERED]&lt;/CardNumber&gt;&lt;CardBin&gt;[FILTERED]&lt;/CardBin&gt;&lt;CardType&gt;5&lt;/CardType&gt;&lt;CardExpirationDate&gt;02/13&lt;/CardExpirationDate&gt;&lt;Name&gt;McKay Thomas&lt;/Name&gt;&lt;LegalDocument&gt;27836038882&lt;/LegalDocument&gt;&lt;Address&gt;&lt;Street&gt;Rua Carlos Del Prete&lt;/Street&gt;&lt;Number&gt;212&lt;/Number&gt;&lt;Comp&gt;&lt;/Comp&gt;&lt;County&gt;Centro&lt;/County&gt;&lt;City&gt;São Bernardo do Campo&lt;/City&gt;&lt;State&gt;SP&lt;/State&gt;&lt;ZipCode&gt;09710-230&lt;/ZipCode&gt;&lt;/Address&gt;&lt;/Payment&gt;&lt;/Payments&gt;&lt;Items&gt;&lt;Item&gt;&lt;ID&gt;123&lt;/ID&gt;&lt;Name&gt;Produto 2&lt;/Name&gt;&lt;ItemValue&gt;1.0&lt;/ItemValue&gt;&lt;Qty&gt;1&lt;/Qty&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/Order&gt;&lt;/Orders&gt;&lt;/ClearSale&gt;</int:xml>
6
+ <int:entityCode>0E6F0C82-FC05-4AA7-86D4-EBBFC0FDC41A</int:entityCode>
7
+ </int:SendOrders>
8
+ </soap:Body>
9
+ </soap:Envelope>
10
+
@@ -0,0 +1,59 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: http://homologacao.clearsale.com.br:80/Integracaov2/Service.asmx
6
+ body: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
7
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.clearsale.com.br/integration"
8
+ xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><int:GetOrderStatus><int:orderID>TS1234</int:orderID><int:entityCode>0E6F0C82-FC05-4AA7-86D4-EBBFC0FDC41A</int:entityCode></int:GetOrderStatus></soap:Body></soap:Envelope>
9
+ headers:
10
+ soapaction:
11
+ - '"http://www.clearsale.com.br/integration/GetOrderStatus"'
12
+ content-type:
13
+ - text/xml;charset=UTF-8
14
+ content-length:
15
+ - '505'
16
+ response: !ruby/struct:VCR::Response
17
+ status: !ruby/struct:VCR::ResponseStatus
18
+ code: 200
19
+ message: !binary |-
20
+ T0s=
21
+ headers:
22
+ !binary "ZGF0ZQ==":
23
+ - !binary |-
24
+ V2VkLCAxMSBBcHIgMjAxMiAyMDozODowMCBHTVQ=
25
+ !binary "c2VydmVy":
26
+ - !binary |-
27
+ TWljcm9zb2Z0LUlJUy82LjA=
28
+ !binary "eC1wb3dlcmVkLWJ5":
29
+ - !binary |-
30
+ QVNQLk5FVA==
31
+ !binary "eC1hc3BuZXQtdmVyc2lvbg==":
32
+ - !binary |-
33
+ Mi4wLjUwNzI3
34
+ !binary "Y2FjaGUtY29udHJvbA==":
35
+ - !binary |-
36
+ cHJpdmF0ZSwgbWF4LWFnZT0w
37
+ !binary "Y29udGVudC10eXBl":
38
+ - !binary |-
39
+ YXBwbGljYXRpb24vc29hcCt4bWw7IGNoYXJzZXQ9dXRmLTg=
40
+ !binary "Y29udGVudC1sZW5ndGg=":
41
+ - !binary |-
42
+ NjYz
43
+ body: !binary |-
44
+ PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c29hcDpF
45
+ bnZlbG9wZSB4bWxuczpzb2FwPSJodHRwOi8vd3d3LnczLm9yZy8yMDAzLzA1
46
+ L3NvYXAtZW52ZWxvcGUiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcv
47
+ MjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3
48
+ dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiPjxzb2FwOkJvZHk+PEdldE9yZGVy
49
+ U3RhdHVzUmVzcG9uc2UgeG1sbnM9Imh0dHA6Ly93d3cuY2xlYXJzYWxlLmNv
50
+ bS5ici9pbnRlZ3JhdGlvbiI+PEdldE9yZGVyU3RhdHVzUmVzdWx0PiZsdDs/
51
+ eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi0xNiI/Jmd0Ow0KJmx0
52
+ O0NsZWFyU2FsZSZndDsNCiAgJmx0O09yZGVycyZndDsNCiAgICAmbHQ7T3Jk
53
+ ZXImZ3Q7DQogICAgICAmbHQ7SUQmZ3Q7VFMxMjM0Jmx0Oy9JRCZndDsNCiAg
54
+ ICAgICZsdDtTdGF0dXMmZ3Q7QU1BJmx0Oy9TdGF0dXMmZ3Q7DQogICAgICAm
55
+ bHQ7U2NvcmUmZ3Q7MjEuMTEwMCZsdDsvU2NvcmUmZ3Q7DQogICAgJmx0Oy9P
56
+ cmRlciZndDsNCiAgJmx0Oy9PcmRlcnMmZ3Q7DQombHQ7L0NsZWFyU2FsZSZn
57
+ dDs8L0dldE9yZGVyU3RhdHVzUmVzdWx0PjwvR2V0T3JkZXJTdGF0dXNSZXNw
58
+ b25zZT48L3NvYXA6Qm9keT48L3NvYXA6RW52ZWxvcGU+
59
+ http_version: '1.1'