stone_ecommerce 1.0.3 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gateway/Address/billing_address.rb +25 -23
  3. data/lib/gateway/Address/buyer_address.rb +28 -25
  4. data/lib/gateway/Address/delivery_address.rb +24 -22
  5. data/lib/gateway/BoletoTransaction/boleto_transaction.rb +28 -30
  6. data/lib/gateway/BoletoTransaction/boleto_transaction_options.rb +14 -11
  7. data/lib/gateway/BoletoTransaction/boleto_transaction_report_file.rb +20 -17
  8. data/lib/gateway/CreditCardTransaction/credit_card.rb +19 -18
  9. data/lib/gateway/CreditCardTransaction/credit_card_transaction.rb +21 -19
  10. data/lib/gateway/CreditCardTransaction/credit_card_transaction_options.rb +17 -15
  11. data/lib/gateway/CreditCardTransaction/credit_card_transaction_report_file.rb +29 -26
  12. data/lib/gateway/CreditCardTransaction/manage_credit_card_transaction.rb +11 -8
  13. data/lib/gateway/CreditCardTransaction/retry_sale_credit_card_transaction.rb +10 -8
  14. data/lib/gateway/Gateway.rb +514 -334
  15. data/lib/gateway/InstantBuyData/create_instant_buy_data_request.rb +31 -0
  16. data/lib/gateway/InstantBuyData/update_instant_buy_data_request.rb +11 -0
  17. data/lib/gateway/Merchant/merchant.rb +10 -8
  18. data/lib/gateway/OnlineDebit/online_debit_transaction_report_file.rb +19 -16
  19. data/lib/gateway/Order/order.rb +11 -8
  20. data/lib/gateway/Order/order_transaction_report_file.rb +8 -5
  21. data/lib/gateway/Parsers/boleto_transaction_parser.rb +28 -25
  22. data/lib/gateway/Parsers/credit_card_transaction_parser.rb +37 -34
  23. data/lib/gateway/Parsers/header_parser.rb +13 -10
  24. data/lib/gateway/Parsers/online_debit_transaction_parser.rb +26 -23
  25. data/lib/gateway/Parsers/trailer_parser.rb +13 -11
  26. data/lib/gateway/Person/buyer.rb +22 -22
  27. data/lib/gateway/Person/create_buyer_request.rb +23 -0
  28. data/lib/gateway/Person/person.rb +34 -32
  29. data/lib/gateway/Recurrency/recurrency.rb +18 -16
  30. data/lib/gateway/Sale/create_sale_request.rb +26 -24
  31. data/lib/gateway/Sale/manage_sale_request.rb +13 -11
  32. data/lib/gateway/Sale/query_sale_request.rb +27 -25
  33. data/lib/gateway/Sale/request_data.rb +16 -14
  34. data/lib/gateway/Sale/retry_sale_options.rb +12 -10
  35. data/lib/gateway/Sale/retry_sale_request.rb +15 -14
  36. data/lib/gateway/Sale/sale_data.rb +0 -2
  37. data/lib/gateway/Sale/sale_order_data.rb +14 -12
  38. data/lib/gateway/SalesOption.rb +13 -11
  39. data/lib/gateway/ShoppingCart/shopping_cart.rb +18 -16
  40. data/lib/gateway/ShoppingCart/shopping_cart_item.rb +15 -13
  41. data/lib/gateway/Trailer.rb +8 -5
  42. data/lib/gateway/header.rb +7 -4
  43. data/lib/gateway/post_notification.rb +23 -20
  44. data/lib/gateway/transaction_report_file.rb +43 -40
  45. data/lib/stone_ecommerce.rb +6 -14
  46. data/spec/integration/gateway_spec.rb +376 -85
  47. data/spec/spec_helper.rb +96 -96
  48. data/stone_ecommerce.gemspec +2 -2
  49. metadata +6 -20
  50. data/lib/gateway/AntiFraud/anti_fraud_analysis_result.rb +0 -47
  51. data/lib/gateway/AntiFraud/query_sale_anti_fraud_analysis_data.rb +0 -51
  52. data/lib/gateway/AntiFraud/query_sale_anti_fraud_analysis_history_data.rb +0 -41
  53. data/lib/gateway/BaseRequest.rb +0 -11
  54. data/lib/gateway/BaseResponse.rb +0 -17
  55. data/lib/gateway/BoletoTransaction/boleto_transaction_data.rb +0 -44
  56. data/lib/gateway/BoletoTransaction/boleto_transaction_result.rb +0 -35
  57. data/lib/gateway/CreditCardTransaction/credit_card_transaction_data.rb +0 -104
  58. data/lib/gateway/ErrorItem.rb +0 -17
  59. data/lib/gateway/ErrorReport.rb +0 -18
  60. data/lib/gateway/InstantBuy/credit_card_data.rb +0 -41
  61. data/lib/gateway/InstantBuy/get_instant_buy_data_response.rb +0 -18
  62. data/lib/gateway/Sale/create_sale_response.rb +0 -25
  63. data/lib/gateway/Sale/manage_sale_response.rb +0 -15
  64. data/lib/gateway/Sale/query_sale_response.rb +0 -18
  65. data/lib/gateway/Sale/retry_sale_response.rb +0 -14
  66. data/lib/gateway/address.rb +0 -25
@@ -0,0 +1,23 @@
1
+ module Gateway
2
+ class CreateBuyerRequest < Person
3
+ attr_accessor :AddressCollection
4
+
5
+ attr_accessor :BuyerCategory
6
+
7
+ attr_accessor :BuyerReference
8
+
9
+ attr_accessor :CreateDateInMerchant
10
+
11
+ attr_accessor :LastBuyerUpdateInMerchant
12
+
13
+ def initialize
14
+ @AddressCollection = Array.new
15
+ end
16
+
17
+ def to_json
18
+ hash = {}
19
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
20
+ hash
21
+ end
22
+ end
23
+ end
@@ -1,47 +1,49 @@
1
- class Person
2
- # Nome da pessoa
3
- attr_accessor :Name
1
+ module Gateway
4
2
 
5
- # Define se � pessoa f�sica ou jur�dica
6
- attr_accessor :PersonType
3
+ class Person
4
+ # Nome da pessoa
5
+ attr_accessor :Name
7
6
 
8
- # Nmero do documento
9
- attr_accessor :DocumentNumber
7
+ # Define se pessoa f�sica ou jur�dica
8
+ attr_accessor :PersonType
10
9
 
11
- # Tipo de documento
12
- attr_accessor :DocumentType
10
+ # N�mero do documento
11
+ attr_accessor :DocumentNumber
13
12
 
14
- # Sexo da pessoa
15
- attr_accessor :Gender
13
+ # Tipo de documento
14
+ attr_accessor :DocumentType
16
15
 
17
- # Data de nascimento
18
- attr_accessor :Birthdate
16
+ # Sexo da pessoa
17
+ attr_accessor :Gender
19
18
 
20
- # E-mail
21
- attr_accessor :Email
19
+ # Data de nascimento
20
+ attr_accessor :Birthdate
22
21
 
23
- # Tipo do email. Pessoal ou comercial
24
- attr_accessor :EmailType
22
+ # E-mail
23
+ attr_accessor :Email
25
24
 
26
- # C�digo identificador do cadastro no Facebook
27
- attr_accessor :FacebookId
25
+ # Tipo do email. Pessoal ou comercial
26
+ attr_accessor :EmailType
28
27
 
29
- # C�digo identificador do cadastro no Twitter
30
- attr_accessor :TwitterId
28
+ # C�digo identificador do cadastro no Facebook
29
+ attr_accessor :FacebookId
31
30
 
32
- # Telefone celular
33
- attr_accessor :MobilePhone
31
+ # C�digo identificador do cadastro no Twitter
32
+ attr_accessor :TwitterId
34
33
 
35
- # Telefone Residencial
36
- attr_accessor :HomePhone
34
+ # Telefone celular
35
+ attr_accessor :MobilePhone
37
36
 
38
- # Telefone comercial
39
- attr_accessor :WorkPhone
37
+ # Telefone Residencial
38
+ attr_accessor :HomePhone
40
39
 
41
- def to_json
42
- hash = {}
43
- instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
44
- hash
45
- end
40
+ # Telefone comercial
41
+ attr_accessor :WorkPhone
46
42
 
43
+ def to_json
44
+ hash = {}
45
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
46
+ hash
47
+ end
48
+ end
47
49
  end
@@ -1,23 +1,25 @@
1
- class Recurrency
2
- # Frequ�ncia da recorr�ncia
3
- attr_accessor :Frequency
1
+ module Gateway
4
2
 
5
- # Intervalo de recorr�ncia
6
- attr_accessor :Interval
3
+ class Recurrency
4
+ # Frequ�ncia da recorr�ncia
5
+ attr_accessor :Frequency
7
6
 
8
- # Data da primeira cobrana
9
- attr_accessor :DateToStartBilling
7
+ # Intervalo de recorrncia
8
+ attr_accessor :Interval
10
9
 
11
- # Total de recorrncias
12
- attr_accessor :Recurrences
10
+ # Data da primeira cobrana
11
+ attr_accessor :DateToStartBilling
13
12
 
14
- # Informa se ser� necess�rio efetuar o procedimento OneDollarAuth antes de registrar a recorr�ncia
15
- attr_accessor :OneDollarAuth
13
+ # Total de recorr�ncias
14
+ attr_accessor :Recurrences
16
15
 
17
- def to_json
18
- hash = {}
19
- instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
20
- hash
21
- end
16
+ # Informa se ser� necess�rio efetuar o procedimento OneDollarAuth antes de registrar a recorr�ncia
17
+ attr_accessor :OneDollarAuth
22
18
 
19
+ def to_json
20
+ hash = {}
21
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
22
+ hash
23
+ end
24
+ end
23
25
  end
@@ -1,36 +1,38 @@
1
- class CreateSaleRequest
1
+ module Gateway
2
2
 
3
- attr_accessor :CreditCardTransactionCollection
3
+ class CreateSaleRequest
4
4
 
5
- attr_accessor :BoletoTransactionCollection
5
+ attr_accessor :CreditCardTransactionCollection
6
6
 
7
- attr_accessor :Order
7
+ attr_accessor :BoletoTransactionCollection
8
8
 
9
- attr_accessor :Buyer
9
+ attr_accessor :Order
10
10
 
11
- attr_accessor :ShoppingCartCollection
11
+ attr_accessor :Buyer
12
12
 
13
- attr_accessor :Options
13
+ attr_accessor :ShoppingCartCollection
14
14
 
15
- attr_accessor :Merchant
15
+ attr_accessor :Options
16
16
 
17
- attr_accessor :RequestData
17
+ attr_accessor :Merchant
18
18
 
19
- def initialize
20
- @CreditCardTransactionCollection = Array.new
21
- @BoletoTransactionCollection = Array.new
22
- @ShoppingCartCollection = Array.new
23
- @Buyer = Buyer.new
24
- @RequestData = RequestData.new
25
- @Options = SalesOption.new
26
- @Merchant = Merchant.new
27
- @Order = Order.new
28
- end
19
+ attr_accessor :RequestData
29
20
 
30
- def to_json
31
- hash = {}
32
- instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
33
- hash
34
- end
21
+ def initialize
22
+ @CreditCardTransactionCollection = Array.new
23
+ @BoletoTransactionCollection = Array.new
24
+ @ShoppingCartCollection = Array.new
25
+ @Buyer = Buyer.new
26
+ @RequestData = RequestData.new
27
+ @Options = SalesOption.new
28
+ @Merchant = Merchant.new
29
+ @Order = Order.new
30
+ end
35
31
 
32
+ def to_json
33
+ hash = {}
34
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
35
+ hash
36
+ end
37
+ end
36
38
  end
@@ -1,17 +1,19 @@
1
- class ManageSaleRequest
1
+ module Gateway
2
+
3
+ class ManageSaleRequest
2
4
 
3
- attr_accessor :CreditCardTransactionCollection
5
+ attr_accessor :CreditCardTransactionCollection
4
6
 
5
- attr_accessor :OrderKey
7
+ attr_accessor :OrderKey
6
8
 
7
- def initialize
8
- @CreditCardTransactionCollection = Array.new;
9
- end
9
+ def initialize
10
+ @CreditCardTransactionCollection = Array.new;
11
+ end
10
12
 
11
- def to_json
12
- hash = {}
13
- instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
14
- hash
13
+ def to_json
14
+ hash = {}
15
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
16
+ hash
17
+ end
15
18
  end
16
-
17
19
  end
@@ -1,36 +1,38 @@
1
- class QuerySaleRequest
2
- attr_accessor :OrderKey
1
+ module Gateway
3
2
 
4
- attr_accessor :OrderReference
3
+ class QuerySaleRequest
4
+ attr_accessor :OrderKey
5
5
 
6
- attr_accessor :CreditCardTransactionKey
6
+ attr_accessor :OrderReference
7
7
 
8
- attr_accessor :CreditCardTransactionReference
8
+ attr_accessor :CreditCardTransactionKey
9
9
 
10
- attr_accessor :BoletoTransactionKey
10
+ attr_accessor :CreditCardTransactionReference
11
11
 
12
- attr_accessor :BoletoTransactionReference
12
+ attr_accessor :BoletoTransactionKey
13
13
 
14
- attr_accessor :QuerySaleRequestEnum
14
+ attr_accessor :BoletoTransactionReference
15
15
 
16
- # Enum feito para as chamadas do m�todo query
17
- @@QuerySaleRequestEnum = {
18
- :OrderKey => 'OrderKey',
19
- :OrderReference => 'OrderReference',
20
- :CreditCardTransactionKey => 'CreditCardTransactionKey',
21
- :CreditCardTransactionReference => 'CreditCardTransactionReference',
22
- :BoletoTransactionKey => 'BoletoTransactionKey',
23
- :BoletoTransactionReference => 'BoletoTransactionReference'
24
- }
16
+ attr_accessor :QuerySaleRequestEnum
25
17
 
26
- def self.QuerySaleRequestEnum
27
- @@QuerySaleRequestEnum
28
- end
18
+ # Enum feito para as chamadas do m�todo query
19
+ @@QuerySaleRequestEnum = {
20
+ :OrderKey => 'OrderKey',
21
+ :OrderReference => 'OrderReference',
22
+ :CreditCardTransactionKey => 'CreditCardTransactionKey',
23
+ :CreditCardTransactionReference => 'CreditCardTransactionReference',
24
+ :BoletoTransactionKey => 'BoletoTransactionKey',
25
+ :BoletoTransactionReference => 'BoletoTransactionReference'
26
+ }
29
27
 
30
- def to_json
31
- hash = {}
32
- instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
33
- hash
34
- end
28
+ def self.QuerySaleRequestEnum
29
+ @@QuerySaleRequestEnum
30
+ end
35
31
 
32
+ def to_json
33
+ hash = {}
34
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
35
+ hash
36
+ end
37
+ end
36
38
  end
@@ -1,20 +1,22 @@
1
- class RequestData
2
- # Identificador da origem de venda na loja
3
- attr_accessor :Origin
1
+ module Gateway
4
2
 
5
- # Identificador da sess�o do usu�rio no sistema da loja (utilizado pelo servi�o de antifraude)
6
- attr_accessor :SessionId
3
+ class RequestData
4
+ # Identificador da origem de venda na loja
5
+ attr_accessor :Origin
7
6
 
8
- # Endere�o IP do cliente da loja
9
- attr_accessor :IpAddress
7
+ # Identificador da sess�o do usu�rio no sistema da loja (utilizado pelo servi�o de antifraude)
8
+ attr_accessor :SessionId
10
9
 
11
- # Categoria da venda e-commerce. B2B ou B2C
12
- attr_accessor :EcommerceCategory
10
+ # Endere�o IP do cliente da loja
11
+ attr_accessor :IpAddress
13
12
 
14
- def to_json
15
- hash = {}
16
- instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
17
- hash
18
- end
13
+ # Categoria da venda e-commerce. B2B ou B2C
14
+ attr_accessor :EcommerceCategory
19
15
 
16
+ def to_json
17
+ hash = {}
18
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
19
+ hash
20
+ end
21
+ end
20
22
  end
@@ -1,14 +1,16 @@
1
- class RetrySaleOptions
2
- # Indica se o limite extendido est� habilitado
3
- attr_accessor :ExtendedLimitEnabled
1
+ module Gateway
4
2
 
5
- # C�digo do limite extendido
6
- attr_accessor :ExtendedLimitCode
3
+ class RetrySaleOptions
4
+ # Indica se o limite extendido est� habilitado
5
+ attr_accessor :ExtendedLimitEnabled
7
6
 
8
- def to_json
9
- hash = {}
10
- instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
11
- hash
12
- end
7
+ # C�digo do limite extendido
8
+ attr_accessor :ExtendedLimitCode
13
9
 
10
+ def to_json
11
+ hash = {}
12
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
13
+ hash
14
+ end
15
+ end
14
16
  end
@@ -1,22 +1,23 @@
1
1
  require_relative 'retry_sale_options'
2
+ module Gateway
2
3
 
3
- class RetrySaleRequest
4
+ class RetrySaleRequest
4
5
 
5
- attr_accessor :Options
6
+ attr_accessor :Options
6
7
 
7
- attr_accessor :OrderKey
8
+ attr_accessor :OrderKey
8
9
 
9
- attr_accessor :RetrySaleCreditCardTransactionCollection
10
+ attr_accessor :RetrySaleCreditCardTransactionCollection
10
11
 
11
- def initialize
12
- @RetrySaleCreditCardTransactionCollection = Array.new
13
- @Options = RetrySaleOptions.new
14
- end
12
+ def initialize
13
+ @RetrySaleCreditCardTransactionCollection = Array.new
14
+ @Options = RetrySaleOptions.new
15
+ end
15
16
 
16
- def to_json
17
- hash = {}
18
- instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
19
- hash
17
+ def to_json
18
+ hash = {}
19
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
20
+ hash
21
+ end
20
22
  end
21
-
22
- end
23
+ end
@@ -1,5 +1,4 @@
1
1
  require_relative 'sale_order_data'
2
- require_relative '../../gateway/AntiFraud/query_sale_anti_fraud_analysis_data'
3
2
 
4
3
  class SaleData
5
4
  # Lista transa��es de cart�o de cr�dito
@@ -21,7 +20,6 @@ class SaleData
21
20
  @CreditCardTransactionDataCollection = Array.new
22
21
  @BoletoTransactionDataCollection = Array.new
23
22
  @OrderData = SaleOrderData.new
24
- @AntiFraudAnalysisData = QuerySaleAntiFraudAnalysisData.new
25
23
  end
26
24
 
27
25
  def to_json
@@ -1,17 +1,19 @@
1
- class SaleOrderData
2
- # N�mero do pedido no sistema da loja
3
- attr_accessor :OrderReference
1
+ module Gateway
4
2
 
5
- # Chave do pedido. Utilizado para identificar o pedido no Gateway
6
- attr_accessor :OrderKey
3
+ class SaleOrderData
4
+ # N�mero do pedido no sistema da loja
5
+ attr_accessor :OrderReference
7
6
 
8
- # Data de cria��o do pedido no Gateway
9
- attr_accessor :CreateDate
7
+ # Chave do pedido. Utilizado para identificar o pedido no Gateway
8
+ attr_accessor :OrderKey
10
9
 
11
- def to_json
12
- hash = {}
13
- instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
14
- hash
15
- end
10
+ # Data de cria��o do pedido no Gateway
11
+ attr_accessor :CreateDate
16
12
 
13
+ def to_json
14
+ hash = {}
15
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
16
+ hash
17
+ end
18
+ end
17
19
  end