stone_ecommerce 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/README.md +64 -0
  4. data/lib/gateway/Address/billing_address.rb +32 -0
  5. data/lib/gateway/Address/buyer_address.rb +36 -0
  6. data/lib/gateway/Address/delivery_address.rb +32 -0
  7. data/lib/gateway/AntiFraud/anti_fraud_analysis_result.rb +47 -0
  8. data/lib/gateway/AntiFraud/query_sale_anti_fraud_analysis_data.rb +51 -0
  9. data/lib/gateway/AntiFraud/query_sale_anti_fraud_analysis_history_data.rb +41 -0
  10. data/lib/gateway/BaseRequest.rb +11 -0
  11. data/lib/gateway/BaseResponse.rb +17 -0
  12. data/lib/gateway/BoletoTransaction/boleto_transaction.rb +43 -0
  13. data/lib/gateway/BoletoTransaction/boleto_transaction_data.rb +44 -0
  14. data/lib/gateway/BoletoTransaction/boleto_transaction_options.rb +14 -0
  15. data/lib/gateway/BoletoTransaction/boleto_transaction_report_file.rb +20 -0
  16. data/lib/gateway/BoletoTransaction/boleto_transaction_result.rb +35 -0
  17. data/lib/gateway/CreditCardTransaction/credit_card.rb +30 -0
  18. data/lib/gateway/CreditCardTransaction/credit_card_transaction.rb +32 -0
  19. data/lib/gateway/CreditCardTransaction/credit_card_transaction_data.rb +104 -0
  20. data/lib/gateway/CreditCardTransaction/credit_card_transaction_options.rb +27 -0
  21. data/lib/gateway/CreditCardTransaction/credit_card_transaction_report_file.rb +29 -0
  22. data/lib/gateway/CreditCardTransaction/manage_credit_card_transaction.rb +12 -0
  23. data/lib/gateway/CreditCardTransaction/retry_sale_credit_card_transaction.rb +13 -0
  24. data/lib/gateway/ErrorItem.rb +17 -0
  25. data/lib/gateway/ErrorReport.rb +18 -0
  26. data/lib/gateway/Gateway.rb +442 -0
  27. data/lib/gateway/InstantBuy/credit_card_data.rb +41 -0
  28. data/lib/gateway/InstantBuy/get_instant_buy_data_response.rb +18 -0
  29. data/lib/gateway/Merchant/merchant.rb +11 -0
  30. data/lib/gateway/OnlineDebit/online_debit_transaction_report_file.rb +18 -0
  31. data/lib/gateway/Order/order.rb +11 -0
  32. data/lib/gateway/Order/order_transaction_report_file.rb +6 -0
  33. data/lib/gateway/Parsers/boleto_transaction_parser.rb +31 -0
  34. data/lib/gateway/Parsers/credit_card_transaction_parser.rb +40 -0
  35. data/lib/gateway/Parsers/header_parser.rb +14 -0
  36. data/lib/gateway/Parsers/online_debit_transaction_parser.rb +30 -0
  37. data/lib/gateway/Parsers/trailer_parser.rb +15 -0
  38. data/lib/gateway/Person/buyer.rb +33 -0
  39. data/lib/gateway/Person/person.rb +47 -0
  40. data/lib/gateway/Recurrency/recurrency.rb +23 -0
  41. data/lib/gateway/Sale/create_sale_request.rb +36 -0
  42. data/lib/gateway/Sale/create_sale_response.rb +25 -0
  43. data/lib/gateway/Sale/manage_sale_request.rb +17 -0
  44. data/lib/gateway/Sale/manage_sale_response.rb +15 -0
  45. data/lib/gateway/Sale/query_sale_request.rb +36 -0
  46. data/lib/gateway/Sale/query_sale_response.rb +18 -0
  47. data/lib/gateway/Sale/request_data.rb +20 -0
  48. data/lib/gateway/Sale/retry_sale_options.rb +14 -0
  49. data/lib/gateway/Sale/retry_sale_request.rb +22 -0
  50. data/lib/gateway/Sale/retry_sale_response.rb +14 -0
  51. data/lib/gateway/Sale/sale_data.rb +33 -0
  52. data/lib/gateway/Sale/sale_order_data.rb +17 -0
  53. data/lib/gateway/SalesOption.rb +17 -0
  54. data/lib/gateway/ShoppingCart/shopping_cart.rb +26 -0
  55. data/lib/gateway/ShoppingCart/shopping_cart_item.rb +23 -0
  56. data/lib/gateway/Trailer.rb +6 -0
  57. data/lib/gateway/address.rb +25 -0
  58. data/lib/gateway/header.rb +5 -0
  59. data/lib/gateway/post_notification.rb +29 -0
  60. data/lib/gateway/transaction_report_file.rb +45 -0
  61. data/lib/stone_ecommerce.rb +70 -0
  62. data/spec/integration/gateway_spec.rb +616 -0
  63. data/spec/integration/test_helper.rb +69 -0
  64. data/spec/spec_helper.rb +96 -0
  65. data/stone_ecommerce.gemspec +19 -0
  66. metadata +247 -0
@@ -0,0 +1,35 @@
1
+ class BoletoTransactionResult
2
+ # Url para visualiza��o do boleto
3
+ attr_accessor :BoletoUrl
4
+
5
+ # C�digo de barras
6
+ attr_accessor :Barcode
7
+
8
+ # Status do boleto
9
+ attr_accessor :BoletoTransactionStatus
10
+
11
+ # Chave da transa��o. Utilizada para identificar a transa��o de boleto no gateway
12
+ attr_accessor :TransactionKey
13
+
14
+ # Valor original da transa��o em centavos
15
+ attr_accessor :AmountInCents
16
+
17
+ # N�mero do documento
18
+ attr_accessor :DocumentNumber
19
+
20
+ # Identificador da transa��o no sistema da loja
21
+ attr_accessor :TransactionReference
22
+
23
+ # Indica se houve sucesso na gera��o do boleto
24
+ attr_accessor :Success
25
+
26
+ # N�mero de identifica��o do boleto
27
+ attr_accessor :NossoNumero
28
+
29
+ def to_json
30
+ hash = {}
31
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
32
+ hash
33
+ end
34
+
35
+ end
@@ -0,0 +1,30 @@
1
+ class CreditCard
2
+
3
+ attr_accessor :InstantBuyKey
4
+
5
+ attr_accessor :CreditCardNumber
6
+
7
+ attr_accessor :HolderName
8
+
9
+ attr_accessor :SecurityCode
10
+
11
+ attr_accessor :ExpMonth
12
+
13
+ attr_accessor :ExpYear
14
+
15
+ attr_accessor :CreditCardBrand
16
+
17
+ attr_accessor :BillingAddress
18
+
19
+ def initialize
20
+ @BillingAddress = BillingAddress.new
21
+ end
22
+
23
+ def to_json
24
+ hash = {}
25
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
26
+ hash
27
+ end
28
+
29
+
30
+ end
@@ -0,0 +1,32 @@
1
+ class CreditCardTransaction
2
+
3
+ attr_accessor :CreditCard
4
+
5
+ attr_accessor :Options
6
+
7
+ attr_accessor :Recurrency
8
+
9
+ attr_accessor :AmountInCents
10
+
11
+ attr_accessor :InstallmentCount
12
+
13
+ attr_accessor :CreditCardOperation
14
+
15
+ attr_accessor :TransactionReference
16
+
17
+ attr_accessor :TransactionDateInMerchant
18
+
19
+
20
+ def initialize
21
+ @Options = CreditCardTransactionOptions.new
22
+ @Recurrency = Recurrency.new
23
+ @CreditCard = CreditCard.new
24
+ end
25
+
26
+ def to_json
27
+ hash = {}
28
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
29
+ hash
30
+ end
31
+
32
+ end
@@ -0,0 +1,104 @@
1
+ require_relative '../../gateway/InstantBuy/credit_card_data'
2
+ class CreditCardTransactionData
3
+ # Dados do cart�o de cr�dito
4
+ attr_accessor :CreditCard
5
+
6
+ # Status da transa��o de cart�o de cr�dito
7
+ attr_accessor :CreditCardTransactionStatus
8
+
9
+ @@CreditCardTransactionStatusEnum = {
10
+ :AuthorizedPendingCapture => '1',
11
+ :NotAuthorized => '2',
12
+ :ChargebackPreview => '3',
13
+ :RefundPreview => '4',
14
+ :DepositPreview => '5',
15
+ :Captured => '6',
16
+ :PartialCapture => '7',
17
+ :Refunded => '8',
18
+ :Voided => '9',
19
+ :Deposited => '10',
20
+ :Chargeback => '12',
21
+ :PendingVoid => '13',
22
+ :Invalid => '14',
23
+ :PartialAlthorize => '15',
24
+ :PartialRefunded => '16',
25
+ :OverCapture => '17',
26
+ :PartialVoid => '18',
27
+ :PendingRefund => '19',
28
+ :UnScheduled => '20',
29
+ :Created => '21',
30
+ :PartialAuthorized => '22',
31
+ :NotFoundInAcquirer => '23',
32
+ :PendingAuthorize => '24',
33
+ :WithError => '99'
34
+ }
35
+
36
+ # Chave da transa��o. Utilizada para identificar a transa��o de cart�o de cr�dito no gateway
37
+ attr_accessor :TransactionKey
38
+
39
+ # Identificador da transa��o gerado pela loja.
40
+ attr_accessor :TransactionIdentifier
41
+
42
+ # C�digo de autoriza��o retornado pela adquirente
43
+ attr_accessor :AcquirerAuthorizationCode
44
+
45
+ # Identificador �nico retornado pela adquirente
46
+ attr_accessor :UniqueSequentialNumber
47
+
48
+ # Valor original da transa��o em centavos
49
+ attr_accessor :AmountInCents
50
+
51
+ # Valor autorizado em centavos
52
+ attr_accessor :AuthorizedAmountInCents
53
+
54
+ # Valor capturado em centavos
55
+ attr_accessor :CapturedAmountInCents
56
+
57
+ # Valor estornado em centavos
58
+ attr_accessor :RefundedAmountInCents
59
+
60
+ # Valor cancelado em centavos
61
+ attr_accessor :VoidedAmountInCents
62
+
63
+ # Data da recorr�ncia (poder� ser futura)
64
+ attr_accessor :DueDate
65
+
66
+ # Identificador da transa��o no sistema da loja
67
+ attr_accessor :TransactionReference
68
+
69
+ # Data de cria��o da transa��o no gatewaya
70
+ attr_accessor :CreateDate
71
+
72
+ # Nome da adquirente que processou a transa��o
73
+ attr_accessor :AcquirerName
74
+
75
+ # Indica se � uma recorr�ncia
76
+ attr_accessor :IsRecurrency
77
+
78
+ # Total de parcelas na transa��o
79
+ attr_accessor :InstallmentCount
80
+
81
+ # C�digo de filia��o da loja na adquirente
82
+ attr_accessor :AffiliationCode
83
+
84
+ # C�digo do m�todo de pagamento
85
+ attr_accessor :PaymentMethodName
86
+
87
+ # Chave da transa��o na adquirente, enviada pelo gateway
88
+ attr_accessor :TransactionKeyToAcquirer
89
+
90
+ # Data limite para a captura da transa��o na adquirente
91
+ attr_accessor :CaptureExpirationDate
92
+
93
+ def initialize
94
+ @CreditCard = CreditCardData.new
95
+ @CreditCardTransactionStatus = self.CreditCardTransactionStatusEnum
96
+ end
97
+
98
+ def to_json
99
+ hash = {}
100
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
101
+ hash
102
+ end
103
+
104
+ end
@@ -0,0 +1,27 @@
1
+ class CreditCardTransactionOptions
2
+
3
+ attr_accessor :PaymentMethodCode
4
+
5
+ attr_accessor :CurrencyIso
6
+
7
+ attr_accessor :IataAmountInCents
8
+
9
+ attr_accessor :CaptureDelayInMinutes
10
+
11
+ attr_accessor :MerchantCategoryCode
12
+
13
+ attr_accessor :SoftDescriptorText
14
+
15
+ attr_accessor :InterestRate
16
+
17
+ attr_accessor :ExtendedLimitEnabled
18
+
19
+ attr_accessor :ExtendedLimitCode
20
+
21
+ def to_json
22
+ hash = {}
23
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
24
+ hash
25
+ end
26
+
27
+ end
@@ -0,0 +1,29 @@
1
+ class CreditCardTransactionReportFile
2
+ attr_accessor :Order
3
+ attr_accessor :TransactionKey
4
+ attr_accessor :TransactionKeyToAcquirer
5
+ attr_accessor :CreditCardTransactionReference
6
+ attr_accessor :CreditCardBrand
7
+ attr_accessor :CreditCardNumber
8
+ attr_accessor :InstallmentCount
9
+ attr_accessor :AcquirerName
10
+ attr_accessor :Status
11
+ attr_accessor :AmountInCents
12
+ attr_accessor :IataAmountInCents
13
+ attr_accessor :AuthorizationCode
14
+ attr_accessor :TransactionIdentifier
15
+ attr_accessor :UniqueSequentialNumber
16
+ attr_accessor :AuthorizedAmountInCents
17
+ attr_accessor :CapturedAmountInCents
18
+ attr_accessor :VoidedAmountInCents
19
+ attr_accessor :RefundedAmountInCents
20
+ attr_accessor :AcquirerAuthorizationReturnCode
21
+ attr_accessor :AuthorizedDate
22
+ attr_accessor :CapturedDate
23
+ attr_accessor :VoidedDate
24
+ attr_accessor :LastProbeDate
25
+
26
+ def initialize
27
+ @Order = OrderTransactionReportFile.new
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ # classe para usar nos metodos de cancel e capture
2
+ class ManageCreditCardTransaction
3
+ attr_accessor :AmountInCents
4
+ attr_accessor :TransactionKey
5
+ attr_accessor :TransactionReference
6
+
7
+ def to_json
8
+ hash = {}
9
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
10
+ hash
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ class RetrySaleCreditCardTransaction
2
+
3
+ attr_accessor :TransactionKey
4
+
5
+ attr_accessor :SecurityCode
6
+
7
+ def to_json
8
+ hash = {}
9
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
10
+ hash
11
+ end
12
+
13
+ end
@@ -0,0 +1,17 @@
1
+ class ErrorItem
2
+
3
+ attr_accessor :ErrorCode
4
+
5
+ attr_accessor :ErrorField
6
+
7
+ attr_accessor :Description
8
+
9
+ attr_accessor :SeverityCode
10
+
11
+ def to_json
12
+ hash = {}
13
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
14
+ hash
15
+ end
16
+
17
+ end
@@ -0,0 +1,18 @@
1
+ class ErrorReport
2
+
3
+ attr_accessor :Category
4
+
5
+ attr_accessor :ErrorItemCollection
6
+
7
+
8
+ def initialize
9
+ @ErrorItemCollection = Array.new;
10
+ end
11
+
12
+ def to_json
13
+ hash = {}
14
+ instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) }
15
+ hash
16
+ end
17
+
18
+ end