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 +4 -4
- data/lib/mundipagg/CreditCardTransaction.rb +5 -2
- data/lib/mundipagg/gateway.rb +27 -15
- data/lib/mundipagg/version.rb +2 -2
- data/tests/features/credit_card.feature +7 -0
- data/tests/features/step_definitions/credit_card_steps.rb +31 -0
- data/tests/test_configuration.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ec0842838bfd1ecefafea9fb980b7e200d0938c
|
4
|
+
data.tar.gz: dd723659ae333c357294cc7fb79b4fca8ea8c838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/mundipagg/gateway.rb
CHANGED
@@ -261,21 +261,33 @@ module Mundipagg
|
|
261
261
|
transaction.paymentMethodCode = 1 # Simulator payment code
|
262
262
|
end
|
263
263
|
|
264
|
-
transaction_hash =
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
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,
|
data/lib/mundipagg/version.rb
CHANGED
@@ -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
|
data/tests/test_configuration.rb
CHANGED
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.
|
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-
|
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:
|