stone_ecommerce 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +202 -202
- data/README.md +58 -58
- data/lib/gateway/Address/billing_address.rb +33 -33
- data/lib/gateway/Address/buyer_address.rb +38 -38
- data/lib/gateway/Address/delivery_address.rb +34 -34
- data/lib/gateway/BoletoTransaction/boleto_transaction.rb +40 -40
- data/lib/gateway/BoletoTransaction/boleto_transaction_options.rb +16 -16
- data/lib/gateway/BoletoTransaction/boleto_transaction_report_file.rb +22 -22
- data/lib/gateway/CreditCardTransaction/credit_card.rb +30 -30
- data/lib/gateway/CreditCardTransaction/credit_card_transaction.rb +33 -33
- data/lib/gateway/CreditCardTransaction/credit_card_transaction_options.rb +28 -28
- data/lib/gateway/CreditCardTransaction/credit_card_transaction_report_file.rb +31 -31
- data/lib/gateway/CreditCardTransaction/manage_credit_card_transaction.rb +14 -14
- data/lib/gateway/CreditCardTransaction/retry_sale_credit_card_transaction.rb +14 -14
- data/lib/gateway/Gateway.rb +621 -621
- data/lib/gateway/InstantBuyData/create_instant_buy_data_request.rb +30 -30
- data/lib/gateway/InstantBuyData/update_instant_buy_data_request.rb +10 -10
- data/lib/gateway/Merchant/merchant.rb +12 -12
- data/lib/gateway/OnlineDebit/online_debit_transaction_report_file.rb +21 -21
- data/lib/gateway/Order/order.rb +13 -13
- data/lib/gateway/Order/order_transaction_report_file.rb +8 -8
- data/lib/gateway/Parsers/boleto_transaction_parser.rb +33 -33
- data/lib/gateway/Parsers/credit_card_transaction_parser.rb +42 -42
- data/lib/gateway/Parsers/header_parser.rb +16 -16
- data/lib/gateway/Parsers/online_debit_transaction_parser.rb +32 -32
- data/lib/gateway/Parsers/trailer_parser.rb +16 -16
- data/lib/gateway/Person/buyer.rb +32 -32
- data/lib/gateway/Person/create_buyer_request.rb +22 -22
- data/lib/gateway/Person/person.rb +48 -48
- data/lib/gateway/Recurrency/recurrency.rb +24 -24
- data/lib/gateway/Sale/create_sale_request.rb +37 -37
- data/lib/gateway/Sale/manage_sale_request.rb +18 -18
- data/lib/gateway/Sale/query_sale_request.rb +37 -37
- data/lib/gateway/Sale/request_data.rb +21 -21
- data/lib/gateway/Sale/retry_sale_options.rb +15 -15
- data/lib/gateway/Sale/retry_sale_request.rb +23 -23
- data/lib/gateway/Sale/sale_data.rb +30 -30
- data/lib/gateway/Sale/sale_order_data.rb +18 -18
- data/lib/gateway/SalesOption.rb +18 -18
- data/lib/gateway/ShoppingCart/shopping_cart.rb +27 -27
- data/lib/gateway/ShoppingCart/shopping_cart_item.rb +24 -24
- data/lib/gateway/Trailer.rb +8 -8
- data/lib/gateway/header.rb +7 -7
- data/lib/gateway/post_notification.rb +31 -31
- data/lib/gateway/transaction_report_file.rb +47 -47
- data/lib/stone_ecommerce.rb +61 -62
- data/spec/integration/gateway_spec.rb +1024 -1024
- data/spec/integration/test_helper.rb +68 -68
- data/stone_ecommerce.gemspec +20 -19
- metadata +27 -24
@@ -1,69 +1,69 @@
|
|
1
|
-
require_relative '../../lib/stone_ecommerce'
|
2
|
-
require 'gyoku'
|
3
|
-
class TestHelper
|
4
|
-
|
5
|
-
def self.JoinAndConvertAmountAndCents(amount, cents)
|
6
|
-
amount_with_cents = amount.gsub(',', '.')
|
7
|
-
return BigDecimal.new(amount_with_cents)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.CreateFakePostNotification(create_order_result, manage_order_result)
|
11
|
-
xml = '<StatusNotification xmlns="http://schemas.datacontract.org/2004/07/Gateway.NotificationService.DataContract"
|
12
|
-
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
13
|
-
<AmountInCents>?</AmountInCents>
|
14
|
-
<AmountPaidInCents>?</AmountPaidInCents>
|
15
|
-
<BoletoTransaction i:nil="true"/>
|
16
|
-
<CreditCardTransaction>
|
17
|
-
<Acquirer>Cielo</Acquirer>
|
18
|
-
<AmountInCents>?</AmountInCents>
|
19
|
-
<AuthorizedAmountInCents>?</AuthorizedAmountInCents>
|
20
|
-
<CapturedAmountInCents>?</CapturedAmountInCents>
|
21
|
-
<CreditCardBrand>?</CreditCardBrand>
|
22
|
-
<RefundedAmountInCents i:nil="true"/>
|
23
|
-
<StatusChangedDate>?</StatusChangedDate>
|
24
|
-
<TransactionIdentifier>?</TransactionIdentifier>
|
25
|
-
<TransactionKey>?</TransactionKey>
|
26
|
-
<TransactionReference>?</TransactionReference>
|
27
|
-
<UniqueSequentialNumber>?</UniqueSequentialNumber>
|
28
|
-
<VoidedAmountInCents i:nil="true"/>
|
29
|
-
<PreviousCreditCardTransactionStatus>?</PreviousCreditCardTransactionStatus>
|
30
|
-
<CreditCardTransactionStatus>?</CreditCardTransactionStatus>
|
31
|
-
</CreditCardTransaction>
|
32
|
-
<MerchantKey>?</MerchantKey>
|
33
|
-
<OrderKey>?</OrderKey>
|
34
|
-
<OrderReference>?</OrderReference>
|
35
|
-
<OrderStatus>?</OrderStatus>
|
36
|
-
</StatusNotification>'
|
37
|
-
|
38
|
-
parser = Nori.new(:convert_tags_to => lambda { |tag| tag })
|
39
|
-
hash = parser.parse(xml)
|
40
|
-
|
41
|
-
credit_card_result = create_order_result['CreditCardTransactionResultCollection'][0]
|
42
|
-
manage_transaction_result = manage_order_result['CreditCardTransactionResultCollection'][0]
|
43
|
-
|
44
|
-
root = hash['StatusNotification']
|
45
|
-
|
46
|
-
root['AmountPaidInCents'] = 0
|
47
|
-
root['CreditCardTransaction'] = {
|
48
|
-
'Acquirer' => 'Cielo',
|
49
|
-
'AmountInCents' =>credit_card_result['AmountInCents'],
|
50
|
-
'AuthorizedAmountInCents'=> credit_card_result['AmountInCents'],
|
51
|
-
'CapturedAmountInCents' =>credit_card_result['AmountInCents'],
|
52
|
-
'CreditCardBrand' => 'Visa',
|
53
|
-
'RefundedAmountInCents' => nil,
|
54
|
-
'StatusChangedDate' => DateTime.now,
|
55
|
-
'TransactionIdentifier' => Array.new(12){[*'0'..'9', *'A'..'Z'].sample}.join,
|
56
|
-
'TransactionKey'=> credit_card_result['TransactionKey'],
|
57
|
-
'TransactionReference'=> credit_card_result['TransactionReference'],
|
58
|
-
'UniqueSequentialNumber' => Array.new(6){[*'0'..'9'].sample}.join,
|
59
|
-
'PreviousCreditCardTransactionStatus' => credit_card_result['CreditCardTransactionStatus'],
|
60
|
-
'CreditCardTransactionStatus' => (manage_transaction_result.nil? == true) ? 'null' : manage_transaction_result['CreditCardTransactionStatus']
|
61
|
-
}
|
62
|
-
root['MerchantKey'] = create_order_result['MerchantKey']
|
63
|
-
root['OrderKey'] = create_order_result['OrderResult']['OrderKey']
|
64
|
-
root['OrderReference'] = create_order_result['OrderResult']['OrderReference']
|
65
|
-
root['OrderStatus'] = (manage_transaction_result.nil? == true) ? 'null' : manage_transaction_result['CreditCardTransactionStatus']
|
66
|
-
|
67
|
-
return CGI::escapeHTML(Gyoku.xml(hash))
|
68
|
-
end
|
1
|
+
require_relative '../../lib/stone_ecommerce'
|
2
|
+
require 'gyoku'
|
3
|
+
class TestHelper
|
4
|
+
|
5
|
+
def self.JoinAndConvertAmountAndCents(amount, cents)
|
6
|
+
amount_with_cents = amount.gsub(',', '.')
|
7
|
+
return BigDecimal.new(amount_with_cents)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.CreateFakePostNotification(create_order_result, manage_order_result)
|
11
|
+
xml = '<StatusNotification xmlns="http://schemas.datacontract.org/2004/07/Gateway.NotificationService.DataContract"
|
12
|
+
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
13
|
+
<AmountInCents>?</AmountInCents>
|
14
|
+
<AmountPaidInCents>?</AmountPaidInCents>
|
15
|
+
<BoletoTransaction i:nil="true"/>
|
16
|
+
<CreditCardTransaction>
|
17
|
+
<Acquirer>Cielo</Acquirer>
|
18
|
+
<AmountInCents>?</AmountInCents>
|
19
|
+
<AuthorizedAmountInCents>?</AuthorizedAmountInCents>
|
20
|
+
<CapturedAmountInCents>?</CapturedAmountInCents>
|
21
|
+
<CreditCardBrand>?</CreditCardBrand>
|
22
|
+
<RefundedAmountInCents i:nil="true"/>
|
23
|
+
<StatusChangedDate>?</StatusChangedDate>
|
24
|
+
<TransactionIdentifier>?</TransactionIdentifier>
|
25
|
+
<TransactionKey>?</TransactionKey>
|
26
|
+
<TransactionReference>?</TransactionReference>
|
27
|
+
<UniqueSequentialNumber>?</UniqueSequentialNumber>
|
28
|
+
<VoidedAmountInCents i:nil="true"/>
|
29
|
+
<PreviousCreditCardTransactionStatus>?</PreviousCreditCardTransactionStatus>
|
30
|
+
<CreditCardTransactionStatus>?</CreditCardTransactionStatus>
|
31
|
+
</CreditCardTransaction>
|
32
|
+
<MerchantKey>?</MerchantKey>
|
33
|
+
<OrderKey>?</OrderKey>
|
34
|
+
<OrderReference>?</OrderReference>
|
35
|
+
<OrderStatus>?</OrderStatus>
|
36
|
+
</StatusNotification>'
|
37
|
+
|
38
|
+
parser = Nori.new(:convert_tags_to => lambda { |tag| tag })
|
39
|
+
hash = parser.parse(xml)
|
40
|
+
|
41
|
+
credit_card_result = create_order_result['CreditCardTransactionResultCollection'][0]
|
42
|
+
manage_transaction_result = manage_order_result['CreditCardTransactionResultCollection'][0]
|
43
|
+
|
44
|
+
root = hash['StatusNotification']
|
45
|
+
|
46
|
+
root['AmountPaidInCents'] = 0
|
47
|
+
root['CreditCardTransaction'] = {
|
48
|
+
'Acquirer' => 'Cielo',
|
49
|
+
'AmountInCents' =>credit_card_result['AmountInCents'],
|
50
|
+
'AuthorizedAmountInCents'=> credit_card_result['AmountInCents'],
|
51
|
+
'CapturedAmountInCents' =>credit_card_result['AmountInCents'],
|
52
|
+
'CreditCardBrand' => 'Visa',
|
53
|
+
'RefundedAmountInCents' => nil,
|
54
|
+
'StatusChangedDate' => DateTime.now,
|
55
|
+
'TransactionIdentifier' => Array.new(12){[*'0'..'9', *'A'..'Z'].sample}.join,
|
56
|
+
'TransactionKey'=> credit_card_result['TransactionKey'],
|
57
|
+
'TransactionReference'=> credit_card_result['TransactionReference'],
|
58
|
+
'UniqueSequentialNumber' => Array.new(6){[*'0'..'9'].sample}.join,
|
59
|
+
'PreviousCreditCardTransactionStatus' => credit_card_result['CreditCardTransactionStatus'],
|
60
|
+
'CreditCardTransactionStatus' => (manage_transaction_result.nil? == true) ? 'null' : manage_transaction_result['CreditCardTransactionStatus']
|
61
|
+
}
|
62
|
+
root['MerchantKey'] = create_order_result['MerchantKey']
|
63
|
+
root['OrderKey'] = create_order_result['OrderResult']['OrderKey']
|
64
|
+
root['OrderReference'] = create_order_result['OrderResult']['OrderReference']
|
65
|
+
root['OrderStatus'] = (manage_transaction_result.nil? == true) ? 'null' : manage_transaction_result['CreditCardTransactionStatus']
|
66
|
+
|
67
|
+
return CGI::escapeHTML(Gyoku.xml(hash))
|
68
|
+
end
|
69
69
|
end
|
data/stone_ecommerce.gemspec
CHANGED
@@ -1,19 +1,20 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = 'stone_ecommerce'
|
3
|
-
s.summary = 'Stone Ruby Client Library'
|
4
|
-
s.description = 'Ruby library for integrating with the Stone payment web services.'
|
5
|
-
s.version = '1.2.
|
6
|
-
s.author = 'Stone Pagamentos'
|
7
|
-
s.email = 'meajuda@stone.com.br'
|
8
|
-
s.homepage = 'http://stone.com.br/'
|
9
|
-
s.files = Dir.glob ["README.md", "LICENSE", "lib/**/*.{rb}", "
|
10
|
-
s.
|
11
|
-
s.add_dependency '
|
12
|
-
s.add_dependency 'nori', '~> 2.6', '>= 2.6.0'
|
13
|
-
s.add_dependency 'gyoku', '~> 1.3', '>= 1.3.1'
|
14
|
-
s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.6.2'
|
15
|
-
s.add_dependency 'ffi', '~> 1.9', '>= 1.9.10'
|
16
|
-
s.add_dependency 'bundler', '~> 1.10', '>= 1.10.6'
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'stone_ecommerce'
|
3
|
+
s.summary = 'Stone Ruby Client Library'
|
4
|
+
s.description = 'Ruby library for integrating with the Stone payment web services.'
|
5
|
+
s.version = '1.2.4' # Major.Minor.Revision
|
6
|
+
s.author = 'Stone Pagamentos'
|
7
|
+
s.email = 'meajuda@stone.com.br'
|
8
|
+
s.homepage = 'http://stone.com.br/'
|
9
|
+
s.files = Dir.glob ["README.md", "LICENSE", "lib/**/*.{rb}", "*.gemspec"]
|
10
|
+
s.test_files = Dir.glob ["spec/**/*"]
|
11
|
+
s.add_dependency 'rest-client', '~> 1.8', '>= 1.8.0'
|
12
|
+
s.add_dependency 'nori', '~> 2.6', '>= 2.6.0'
|
13
|
+
s.add_dependency 'gyoku', '~> 1.3', '>= 1.3.1'
|
14
|
+
s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.6.2'
|
15
|
+
s.add_dependency 'ffi', '~> 1.9', '>= 1.9.10'
|
16
|
+
s.add_dependency 'bundler', '~> 1.10', '>= 1.10.6'
|
17
|
+
s.add_development_dependency 'rspec', '~> 3.3', '>= 3.3.0'
|
18
|
+
s.required_ruby_version = '>= 2.1.7'
|
19
|
+
s.license = 'Apache 2.0'
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stone_ecommerce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stone Pagamentos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,26 +30,6 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.8.0
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: rspec
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '3.3'
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 3.3.0
|
43
|
-
type: :runtime
|
44
|
-
prerelease: false
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '3.3'
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 3.3.0
|
53
33
|
- !ruby/object:Gem::Dependency
|
54
34
|
name: nori
|
55
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +130,26 @@ dependencies:
|
|
150
130
|
- - ">="
|
151
131
|
- !ruby/object:Gem::Version
|
152
132
|
version: 1.10.6
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: rspec
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.3'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 3.3.0
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '3.3'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.3.0
|
153
153
|
description: Ruby library for integrating with the Stone payment web services.
|
154
154
|
email: meajuda@stone.com.br
|
155
155
|
executables: []
|
@@ -226,8 +226,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
version: '0'
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.
|
229
|
+
rubygems_version: 2.4.8
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Stone Ruby Client Library
|
233
|
-
test_files:
|
233
|
+
test_files:
|
234
|
+
- spec/integration/gateway_spec.rb
|
235
|
+
- spec/integration/test_helper.rb
|
236
|
+
- spec/spec_helper.rb
|