mundipagg 1.2.8 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9d68e1da0f6670eebed3e2ae2502a32976cc4bc
4
- data.tar.gz: 5b191f42abe0e853e931af73758dc00eba25be10
3
+ metadata.gz: 7ec0842838bfd1ecefafea9fb980b7e200d0938c
4
+ data.tar.gz: dd723659ae333c357294cc7fb79b4fca8ea8c838
5
5
  SHA512:
6
- metadata.gz: 2099d0d00896b082978b575df2bdd96085a9a277488db6e1dad1ca6ac41725bd1be8c3ba57304443c87a94e797270fd04ab5f06b33d0e77454b0be73c069b385
7
- data.tar.gz: bce61ecba704296b931dc1e9ac949a95f1ccbb7e7f32ea90f4a7b4767fee4c91a86f890736b13993a4ac4abaee208cabfc1942e51db37d4987ecb29dafbf57dd
6
+ metadata.gz: d79ae0c1b7e3412953f9dbb2bb8783bc8bb5b448a5c567991f2c86ff111ece5b1816b1d929591975cbac453fe9536cc687e3c33140e31a2c42bd2d32b1aac564
7
+ data.tar.gz: 916f49119095083a89084588ffade571dba742c12d075fd0b1b24179dddccd93cee95cb8f702cb29ee47f67a8c4d9f94a269315347ac352f107042d8555b3d97
@@ -3,7 +3,10 @@ module Mundipagg
3
3
 
4
4
  # @return [Long] Transaction amount in cents
5
5
  attr_accessor :amountInCents
6
-
6
+
7
+ # @return [String] Instant buy key
8
+ attr_accessor :instantBuyKey
9
+
7
10
  # @return [String] Card brand. Use the static property <i>BrandEnum</i>.
8
11
  # @see BrandEnum
9
12
  attr_accessor :creditCardBrandEnum
@@ -75,4 +78,4 @@ module Mundipagg
75
78
  @@OPERATION
76
79
  end
77
80
  end
78
- end
81
+ end
@@ -261,21 +261,33 @@ module Mundipagg
261
261
  transaction.paymentMethodCode = 1 # Simulator payment code
262
262
  end
263
263
 
264
- transaction_hash = {
265
- 'mun:AmountInCents' => transaction.amountInCents,
266
- 'mun:CreditCardBrandEnum' => transaction.creditCardBrandEnum.to_s,
267
- 'mun:CreditCardNumber' => transaction.creditCardNumber,
268
- 'mun:CreditCardOperationEnum' => transaction.creditCardOperationEnum.to_s,
269
- 'mun:ExpMonth' => transaction.expirationMonth,
270
- 'mun:ExpYear' => transaction.expirationYear,
271
- 'mun:HolderName' => transaction.holderName,
272
- 'mun:InstallmentCount' => transaction.installmentCount,
273
- 'mun:PaymentMethodCode' => transaction.paymentMethodCode,
274
- 'mun:SecurityCode' => transaction.securityCode,
275
- 'mun:TransactionReference' => transaction.transactionReference
276
- }
277
-
278
- if transaction.recurrency.nil? == false
264
+ transaction_hash = if transaction.instantBuyKey
265
+ {
266
+ 'mun:AmountInCents' => transaction.amountInCents,
267
+ 'mun:CreditCardBrandEnum' => transaction.creditCardBrandEnum.to_s,
268
+ 'mun:InstantBuyKey' => transaction.instantBuyKey,
269
+ 'mun:CreditCardOperationEnum' => transaction.creditCardOperationEnum.to_s,
270
+ 'mun:InstallmentCount' => transaction.installmentCount,
271
+ 'mun:PaymentMethodCode' => transaction.paymentMethodCode,
272
+ 'mun:TransactionReference' => transaction.transactionReference
273
+ }
274
+ else
275
+ {
276
+ 'mun:AmountInCents' => transaction.amountInCents,
277
+ 'mun:CreditCardBrandEnum' => transaction.creditCardBrandEnum.to_s,
278
+ 'mun:CreditCardNumber' => transaction.creditCardNumber,
279
+ 'mun:CreditCardOperationEnum' => transaction.creditCardOperationEnum.to_s,
280
+ 'mun:ExpMonth' => transaction.expirationMonth,
281
+ 'mun:ExpYear' => transaction.expirationYear,
282
+ 'mun:HolderName' => transaction.holderName,
283
+ 'mun:InstallmentCount' => transaction.installmentCount,
284
+ 'mun:PaymentMethodCode' => transaction.paymentMethodCode,
285
+ 'mun:SecurityCode' => transaction.securityCode,
286
+ 'mun:TransactionReference' => transaction.transactionReference
287
+ }
288
+ end
289
+
290
+ if transaction.recurrency.nil? == false
279
291
 
280
292
  transaction_hash['mun:Recurrency'] = {
281
293
  'mun:DateToStartBilling' => transaction.recurrency.dateToStartBilling,
@@ -1,8 +1,8 @@
1
1
  module Mundipagg
2
2
  module Version
3
3
  Major = 1
4
- Minor = 2
5
- Revision = 8
4
+ Minor = 3
5
+ Revision = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Revision}"
8
8
  end
@@ -20,3 +20,10 @@ Feature: Credit Card Transaction
20
20
  And I will pay using a Visa credit card without installment
21
21
  And I will send to Mundipagg
22
22
  Then the log file doesn't contain sensible information
23
+
24
+ Scenario: Pay a order using credit card using instant buy key
25
+ Given I have purchase three products with a total cost of BRL 100,29
26
+ And I will pay using a Visa credit card without installment
27
+ And I will send to Mundipagg
28
+ When I pay another order with the instant buy key
29
+ Then the transaction status should be Captured
@@ -46,6 +46,7 @@ Given(/^I will send to Mundipagg$/) do
46
46
  end
47
47
 
48
48
  Then(/^the order amount in cents should be (\d+)$/) do |amountInCents|
49
+
49
50
  transaction = @response[:create_order_response][:create_order_result][:credit_card_transaction_result_collection][:credit_card_transaction_result]
50
51
  transaction[:amount_in_cents].to_s.should == amountInCents
51
52
  end
@@ -88,3 +89,33 @@ Then(/^the log file doesn't contain sensible information$/) do
88
89
  @stdout.string.should_not include(@transaction.securityCode)
89
90
  @stdout.string.should_not include(@order.merchantKey)
90
91
  end
92
+
93
+ #Scenario 4:
94
+ When(/^I pay another order with the instant buy key$/) do
95
+ @order = Mundipagg::CreateOrderRequest.new
96
+ @order.merchantKey = TestConfiguration::Merchant::MerchantKey
97
+ amount = 100
98
+ @transaction = Mundipagg::CreditCardTransaction.new
99
+ @order.creditCardTransactionCollection << @transaction
100
+
101
+ @order.amountInCents = (amount * 100).to_i
102
+ @order.amountInCentsToConsiderPaid = (amount * 100).to_i
103
+ @order.currencyIsoEnum = 'BRL'
104
+
105
+ @transaction.creditCardBrandEnum = 'Visa'
106
+ @transaction.instantBuyKey = @response[:create_order_response][:create_order_result][:credit_card_transaction_result_collection][:credit_card_transaction_result][:instant_buy_key]
107
+ @transaction.installmentCount = 1
108
+ @transaction.paymentMethodCode = 1
109
+ @transaction.amountInCents = @order.amountInCents
110
+ @transaction.creditCardOperationEnum = Mundipagg::CreditCardTransaction.OperationEnum[:AuthAndCapture]
111
+
112
+ old_stdout = $stdout
113
+ @stdout = StringIO.new
114
+ $stdout = @stdout
115
+ @client.log_level = :debug
116
+ begin
117
+ @response = @client.CreateOrder(@order)
118
+ ensure
119
+ $stdout = old_stdout
120
+ end
121
+ end
@@ -1,5 +1,5 @@
1
1
  module TestConfiguration
2
2
  module Merchant
3
- MerchantKey = '8a2dd57f-1ed9-4153-b4ce-69683efadad5'
3
+ MerchantKey = ''
4
4
  end
5
- end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mundipagg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MundiPagg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -79,3 +79,4 @@ signing_key:
79
79
  specification_version: 4
80
80
  summary: MundiPagg Ruby Client Library
81
81
  test_files: []
82
+ has_rdoc: