spec/integration/gateway_spec.rb in mundipagg_api-1.1.0 vs spec/integration/gateway_spec.rb in mundipagg_api-1.1.1

- old
+ new

@@ -1,9 +1,9 @@ require_relative '../../lib/mundipagg_api' require_relative 'test_helper' -merchant_key = '8A2DD57F-1ED9-4153-B4CE-69683EFADAD5' +merchant_key = 'merchantKey' gateway = MundipaggApi.new(:production, merchant_key) RSpec.describe MundipaggApi do it 'should create a sale with boleto' do createSaleRequest = CreateSaleRequest.new @@ -143,11 +143,11 @@ creditCardTransactionItem.CreditCard.CreditCardBrand = 'Visa' creditCardTransactionItem.CreditCard.CreditCardNumber = '4111111111111111' creditCardTransactionItem.CreditCard.ExpMonth = 10 creditCardTransactionItem.CreditCard.ExpYear = 19 creditCardTransactionItem.CreditCard.HolderName = 'Maria do Carmo' - creditCardTransactionItem.CreditCard.InstantBuyerKey = '00000000-0000-0000-0000-000000000000' + creditCardTransactionItem.CreditCard.InstantBuyKey = '00000000-0000-0000-0000-000000000000' creditCardTransactionItem.CreditCard.SecurityCode = '123' shoppingCartItem = ShoppingCartItemCollection.new shoppingCartItem.Description = 'Descricao do Produto' shoppingCartItem.DiscountAmountInCents = 120 @@ -528,6 +528,23 @@ it 'should consult transaction with buyer key' do response = gateway.BuyerKey('EF42EDE1-D482-4A13-84F2-637A201AA4F2') expect(response['ErrorReport']).to eq nil end + + it 'should do a credit card transaction with instant buy key' do + # coleta dados do cartao + creditCardTransaction = CreditCardTransaction.new + creditCardTransaction.AmountInCents = 100 + creditCardTransaction.CreditCard.InstantBuyKey = '1A045F96-B640-44E6-95F3-FFFC5A2F7D18' + + # cria a transacao + createSaleRequest = CreateSaleRequest.new + createSaleRequest.CreditCardTransactionCollection << creditCardTransaction + + # faz a requisicao de criação de transacao, retorna um hash com a resposta + response = gateway.CreateSale(createSaleRequest) + + expect(response['ErrorReport']).to eq nil + end + end \ No newline at end of file