mundipagg_sdk 1.3.0 → 1.4.0

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 (52) hide show
  1. checksums.yaml +13 -5
  2. data/LICENSE +190 -190
  3. data/README.md +61 -61
  4. data/lib/gateway/Address/billing_address.rb +33 -33
  5. data/lib/gateway/Address/buyer_address.rb +38 -38
  6. data/lib/gateway/Address/delivery_address.rb +34 -34
  7. data/lib/gateway/BoletoTransaction/boleto_transaction.rb +40 -40
  8. data/lib/gateway/BoletoTransaction/boleto_transaction_options.rb +16 -16
  9. data/lib/gateway/BoletoTransaction/boleto_transaction_report_file.rb +22 -22
  10. data/lib/gateway/CreditCardTransaction/credit_card.rb +30 -30
  11. data/lib/gateway/CreditCardTransaction/credit_card_transaction.rb +33 -33
  12. data/lib/gateway/CreditCardTransaction/credit_card_transaction_options.rb +28 -28
  13. data/lib/gateway/CreditCardTransaction/credit_card_transaction_report_file.rb +31 -31
  14. data/lib/gateway/CreditCardTransaction/manage_credit_card_transaction.rb +14 -14
  15. data/lib/gateway/CreditCardTransaction/retry_sale_credit_card_transaction.rb +14 -14
  16. data/lib/gateway/Gateway.rb +525 -627
  17. data/lib/gateway/InstantBuyData/create_instant_buy_data_request.rb +30 -30
  18. data/lib/gateway/InstantBuyData/update_instant_buy_data_request.rb +10 -10
  19. data/lib/gateway/Merchant/merchant.rb +12 -12
  20. data/lib/gateway/OnlineDebit/online_debit_transaction_report_file.rb +21 -21
  21. data/lib/gateway/Order/order.rb +13 -13
  22. data/lib/gateway/Order/order_transaction_report_file.rb +8 -8
  23. data/lib/gateway/Parsers/boleto_transaction_parser.rb +33 -33
  24. data/lib/gateway/Parsers/credit_card_transaction_parser.rb +42 -42
  25. data/lib/gateway/Parsers/header_parser.rb +16 -16
  26. data/lib/gateway/Parsers/online_debit_transaction_parser.rb +32 -32
  27. data/lib/gateway/Parsers/trailer_parser.rb +16 -16
  28. data/lib/gateway/Person/buyer.rb +32 -32
  29. data/lib/gateway/Person/create_buyer_request.rb +22 -22
  30. data/lib/gateway/Person/person.rb +48 -48
  31. data/lib/gateway/Recurrency/recurrency.rb +24 -24
  32. data/lib/gateway/Sale/create_sale_request.rb +37 -37
  33. data/lib/gateway/Sale/manage_sale_request.rb +18 -18
  34. data/lib/gateway/Sale/query_sale_request.rb +37 -37
  35. data/lib/gateway/Sale/request_data.rb +21 -21
  36. data/lib/gateway/Sale/retry_sale_options.rb +15 -15
  37. data/lib/gateway/Sale/retry_sale_request.rb +23 -23
  38. data/lib/gateway/Sale/sale_data.rb +30 -30
  39. data/lib/gateway/Sale/sale_order_data.rb +18 -18
  40. data/lib/gateway/SalesOption.rb +18 -18
  41. data/lib/gateway/ShoppingCart/shopping_cart.rb +27 -27
  42. data/lib/gateway/ShoppingCart/shopping_cart_item.rb +24 -24
  43. data/lib/gateway/Trailer.rb +8 -8
  44. data/lib/gateway/header.rb +7 -7
  45. data/lib/gateway/post_notification.rb +31 -31
  46. data/lib/gateway/transaction_report_file.rb +47 -47
  47. data/lib/mundipagg_sdk.rb +61 -61
  48. data/mundipagg_sdk.gemspec +20 -20
  49. data/spec/integration/gateway_spec.rb +1023 -1022
  50. data/spec/integration/test_helper.rb +68 -68
  51. data/spec/spec_helper.rb +96 -96
  52. metadata +33 -33
@@ -1,22 +1,22 @@
1
- module Gateway
2
-
3
- class RequestData
4
- # Identificador da origem de venda na loja
5
- attr_accessor :Origin
6
-
7
- # Identificador da sess�o do usu�rio no sistema da loja (utilizado pelo servi�o de antifraude)
8
- attr_accessor :SessionId
9
-
10
- # Endere�o IP do cliente da loja
11
- attr_accessor :IpAddress
12
-
13
- # Categoria da venda e-commerce. B2B ou B2C
14
- attr_accessor :EcommerceCategory
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
1
+ module Gateway
2
+
3
+ class RequestData
4
+ # Identificador da origem de venda na loja
5
+ attr_accessor :Origin
6
+
7
+ # Identificador da sess�o do usu�rio no sistema da loja (utilizado pelo servi�o de antifraude)
8
+ attr_accessor :SessionId
9
+
10
+ # Endere�o IP do cliente da loja
11
+ attr_accessor :IpAddress
12
+
13
+ # Categoria da venda e-commerce. B2B ou B2C
14
+ attr_accessor :EcommerceCategory
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
22
22
  end
@@ -1,16 +1,16 @@
1
- module Gateway
2
-
3
- class RetrySaleOptions
4
- # Indica se o limite extendido est� habilitado
5
- attr_accessor :ExtendedLimitEnabled
6
-
7
- # C�digo do limite extendido
8
- attr_accessor :ExtendedLimitCode
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
1
+ module Gateway
2
+
3
+ class RetrySaleOptions
4
+ # Indica se o limite extendido est� habilitado
5
+ attr_accessor :ExtendedLimitEnabled
6
+
7
+ # C�digo do limite extendido
8
+ attr_accessor :ExtendedLimitCode
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
16
16
  end
@@ -1,23 +1,23 @@
1
- require_relative 'retry_sale_options'
2
- module Gateway
3
-
4
- class RetrySaleRequest
5
-
6
- attr_accessor :Options
7
-
8
- attr_accessor :OrderKey
9
-
10
- attr_accessor :RetrySaleCreditCardTransactionCollection
11
-
12
- def initialize
13
- @RetrySaleCreditCardTransactionCollection = Array.new
14
- @Options = RetrySaleOptions.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
+ require_relative 'retry_sale_options'
2
+ module Gateway
3
+
4
+ class RetrySaleRequest
5
+
6
+ attr_accessor :Options
7
+
8
+ attr_accessor :OrderKey
9
+
10
+ attr_accessor :RetrySaleCreditCardTransactionCollection
11
+
12
+ def initialize
13
+ @RetrySaleCreditCardTransactionCollection = Array.new
14
+ @Options = RetrySaleOptions.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,31 +1,31 @@
1
- require_relative 'sale_order_data'
2
-
3
- class SaleData
4
- # Lista transa��es de cart�o de cr�dito
5
- attr_accessor :CreditCardTransactionDataCollection
6
-
7
- # Lista as transa��es de boleto
8
- attr_accessor :BoletoTransactionDataCollection
9
-
10
- # Dados do pedido
11
- attr_accessor :OrderData
12
-
13
- # Chave do comprador. Utilzada para identificar um comprador no gateway
14
- attr_accessor :BuyerKey
15
-
16
- # Dados de servi�o do antifraude
17
- attr_accessor :AntiFraudAnalysisData
18
-
19
- def initialize
20
- @CreditCardTransactionDataCollection = Array.new
21
- @BoletoTransactionDataCollection = Array.new
22
- @OrderData = SaleOrderData.new
23
- end
24
-
25
- def to_json
26
- hash = {}
27
- instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
28
- hash
29
- end
30
-
1
+ require_relative 'sale_order_data'
2
+
3
+ class SaleData
4
+ # Lista transa��es de cart�o de cr�dito
5
+ attr_accessor :CreditCardTransactionDataCollection
6
+
7
+ # Lista as transa��es de boleto
8
+ attr_accessor :BoletoTransactionDataCollection
9
+
10
+ # Dados do pedido
11
+ attr_accessor :OrderData
12
+
13
+ # Chave do comprador. Utilzada para identificar um comprador no gateway
14
+ attr_accessor :BuyerKey
15
+
16
+ # Dados de servi�o do antifraude
17
+ attr_accessor :AntiFraudAnalysisData
18
+
19
+ def initialize
20
+ @CreditCardTransactionDataCollection = Array.new
21
+ @BoletoTransactionDataCollection = Array.new
22
+ @OrderData = SaleOrderData.new
23
+ end
24
+
25
+ def to_json
26
+ hash = {}
27
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
28
+ hash
29
+ end
30
+
31
31
  end
@@ -1,19 +1,19 @@
1
- module Gateway
2
-
3
- class SaleOrderData
4
- # N�mero do pedido no sistema da loja
5
- attr_accessor :OrderReference
6
-
7
- # Chave do pedido. Utilizado para identificar o pedido no Gateway
8
- attr_accessor :OrderKey
9
-
10
- # Data de cria��o do pedido no Gateway
11
- attr_accessor :CreateDate
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
1
+ module Gateway
2
+
3
+ class SaleOrderData
4
+ # N�mero do pedido no sistema da loja
5
+ attr_accessor :OrderReference
6
+
7
+ # Chave do pedido. Utilizado para identificar o pedido no Gateway
8
+ attr_accessor :OrderKey
9
+
10
+ # Data de cria��o do pedido no Gateway
11
+ attr_accessor :CreateDate
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
19
19
  end
@@ -1,19 +1,19 @@
1
- module Gateway
2
-
3
- class SalesOption
4
-
5
- attr_accessor :IsAntiFraudEnabled
6
-
7
- attr_accessor :AntiFraudServiceCode
8
-
9
- attr_accessor :Retries
10
-
11
- attr_accessor :CurrencyIso
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
1
+ module Gateway
2
+
3
+ class SalesOption
4
+
5
+ attr_accessor :IsAntiFraudEnabled
6
+
7
+ attr_accessor :AntiFraudServiceCode
8
+
9
+ attr_accessor :Retries
10
+
11
+ attr_accessor :CurrencyIso
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
19
19
  end
@@ -1,28 +1,28 @@
1
- module Gateway
2
-
3
- class ShoppingCartCollection
4
-
5
- attr_accessor :FreighCostInCents
6
-
7
- attr_accessor :EstimatedDeliveryDate
8
-
9
- attr_accessor :DeliveryDeadline
10
-
11
- attr_accessor :ShippingCompany
12
-
13
- attr_accessor :DeliveryAddress
14
-
15
- attr_accessor :ShoppingCartItemCollection
16
-
17
- def initialize
18
- @ShoppingCartItemCollection = Array.new
19
- @DeliveryAddress = DeliveryAddress.new
20
- end
21
-
22
- def to_json
23
- hash = {}
24
- instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
25
- hash
26
- end
27
- end
1
+ module Gateway
2
+
3
+ class ShoppingCartCollection
4
+
5
+ attr_accessor :FreighCostInCents
6
+
7
+ attr_accessor :EstimatedDeliveryDate
8
+
9
+ attr_accessor :DeliveryDeadline
10
+
11
+ attr_accessor :ShippingCompany
12
+
13
+ attr_accessor :DeliveryAddress
14
+
15
+ attr_accessor :ShoppingCartItemCollection
16
+
17
+ def initialize
18
+ @ShoppingCartItemCollection = Array.new
19
+ @DeliveryAddress = DeliveryAddress.new
20
+ end
21
+
22
+ def to_json
23
+ hash = {}
24
+ instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
25
+ hash
26
+ end
27
+ end
28
28
  end
@@ -1,25 +1,25 @@
1
- module Gateway
2
-
3
- class ShoppingCartItemCollection
4
-
5
- attr_accessor :ItemReference
6
-
7
- attr_accessor :Quantity
8
-
9
- attr_accessor :UnitCostInCents
10
-
11
- attr_accessor :TotalCostInCents
12
-
13
- attr_accessor :Name
14
-
15
- attr_accessor :Description
16
-
17
- attr_accessor :DiscountAmountInCents
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
1
+ module Gateway
2
+
3
+ class ShoppingCartItemCollection
4
+
5
+ attr_accessor :ItemReference
6
+
7
+ attr_accessor :Quantity
8
+
9
+ attr_accessor :UnitCostInCents
10
+
11
+ attr_accessor :TotalCostInCents
12
+
13
+ attr_accessor :Name
14
+
15
+ attr_accessor :Description
16
+
17
+ attr_accessor :DiscountAmountInCents
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
25
25
  end
@@ -1,9 +1,9 @@
1
- module Gateway
2
-
3
- class Trailer
4
- attr_accessor :OrderDataCount
5
- attr_accessor :CreditCardTransactionDataCount
6
- attr_accessor :BoletoTransactionDataCount
7
- attr_accessor :OnlineDebitTransactionDataCount
8
- end
1
+ module Gateway
2
+
3
+ class Trailer
4
+ attr_accessor :OrderDataCount
5
+ attr_accessor :CreditCardTransactionDataCount
6
+ attr_accessor :BoletoTransactionDataCount
7
+ attr_accessor :OnlineDebitTransactionDataCount
8
+ end
9
9
  end
@@ -1,8 +1,8 @@
1
- module Gateway
2
-
3
- class Header
4
- attr_accessor :TransactionProcessedDate
5
- attr_accessor :ReportFileCreateDate
6
- attr_accessor :Version
7
- end
1
+ module Gateway
2
+
3
+ class Header
4
+ attr_accessor :TransactionProcessedDate
5
+ attr_accessor :ReportFileCreateDate
6
+ attr_accessor :Version
7
+ end
8
8
  end
@@ -1,32 +1,32 @@
1
- require 'nori'
2
-
3
- module Gateway
4
-
5
- # Class who handles Gateway post notification XML
6
- class PostNotification
7
-
8
- # This method parse the Xml sent by Gateway when notify a change in a transaction.
9
- #
10
- # @param request [String] XML received in the Gateway POST request.
11
- # @return [Hash<Symbol, String>] A hash collection containing the XML data parsed.
12
- def self.ParseNotification(xml)
13
-
14
- nori = Nori.new(:convert_tags_to => lambda { |tag| PostNotification.to_underscore(tag).to_sym })
15
- xml_hash = nori.parse(CGI::unescapeHTML(xml))
16
-
17
- return xml_hash
18
- end
19
-
20
- # Converts a string in Camel Case format to lower case with underscore.
21
- #
22
- # @param Example: 'StatusNotification' outputs 'status_notification'
23
- # @returns [String] lower case string separated with underscore
24
- def self.to_underscore(camel_case_string)
25
- return camel_case_string.gsub(/::/, '/').
26
- gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
27
- gsub(/([a-z\d])([A-Z])/, '\1_\2').
28
- tr("-", "_").
29
- downcase
30
- end
31
- end
1
+ require 'nori'
2
+
3
+ module Gateway
4
+
5
+ # Class who handles Gateway post notification XML
6
+ class PostNotification
7
+
8
+ # This method parse the Xml sent by Gateway when notify a change in a transaction.
9
+ #
10
+ # @param request [String] XML received in the Gateway POST request.
11
+ # @return [Hash<Symbol, String>] A hash collection containing the XML data parsed.
12
+ def self.ParseNotification(xml)
13
+
14
+ nori = Nori.new(:convert_tags_to => lambda { |tag| PostNotification.to_underscore(tag).to_sym })
15
+ xml_hash = nori.parse(CGI::unescapeHTML(xml))
16
+
17
+ return xml_hash
18
+ end
19
+
20
+ # Converts a string in Camel Case format to lower case with underscore.
21
+ #
22
+ # @param Example: 'StatusNotification' outputs 'status_notification'
23
+ # @returns [String] lower case string separated with underscore
24
+ def self.to_underscore(camel_case_string)
25
+ return camel_case_string.gsub(/::/, '/').
26
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
27
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
28
+ tr("-", "_").
29
+ downcase
30
+ end
31
+ end
32
32
  end