MundiPagg Ruby Client Library
Ruby API for integration with MundiPagg payment web services.
Dependencies
Unit tests made with Cucumber and RSpec
Documentation
Tests
After get your MerchantKey you can run the unit tests in our simulator environment, all you need to do is put your MerchantKey in the TestConfiguration.rb file and execute cucumber tests with the command below:
“ $ bundle exec rake integration
“
Usage
Below a simple exemple of an order with one credit card transaction.
“ $ gem install mundipagg
“
“by require ‘mundipagg’
Create the client instance
client = Mundipagg::Gateway.new :production
Create the order
order = Mundipagg::CreateOrderRequest.new
Fill order information
order.amountInCents = 1000 # R$ 10,00 order.amountInCentsToConsiderPaid = 1000 order.merchantKey = ‘00000000-0000-0000-0000-000000000000’ order.orderReference = ‘Custom Order 42’
Credit card transaction information
credit = Mundipagg::CreditCardTransaction.new
credit.amountInCents = 1000; # R$ 10,00 credit.creditCardBrandEnum = Mundipagg::CreditCardTransaction.BrandEnum[:Visa] credit.creditCardOperationEnum = Mundipagg::CreditCardTransaction.OperationEnum[:AuthAndCapture] credit.creditCardNumber = ‘4111111111111111’ credit.holderName = ‘Anthony Edward Stark’ credit.installmentCount = 1 credit.paymentMethodCode = 1 #Simulator credit.securityCode = 123 credit.transactionReference = ‘Custom Transaction Identifier’ credit.expirationMonth = 5 credit.expirationYear = 2020
Add transaction to order
order.creditCardTransactionCollection « credit
response = client.CreateOrder(order)
“
The response variable will contain a Hash like the one below.
“by }, :boleto_transaction_result_collection=>nil, :mundi_pagg_suggestion=>nil, :error_report=>nil, :“@xmlns:a”=>“http://schemas.datacontract.org/2004/07/MundiPagg.One.Service.DataContracts”, :“@xmlns:i”=>“http://www.w3.org/2001/XMLSchema-instance”}, :@xmlns=>“http://tempuri.org/”}}
“
LICENSE
See the LICENSE file.