mymoip 0.1.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.
- data/.document +5 -0
- data/.rvmrc +40 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +20 -0
- data/README.md +88 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/lib/credit_card.rb +17 -0
- data/lib/credit_card_payment.rb +47 -0
- data/lib/instruction.rb +31 -0
- data/lib/json_parser.rb +13 -0
- data/lib/mymoip.rb +23 -0
- data/lib/payer.rb +47 -0
- data/lib/payment_request.rb +40 -0
- data/lib/request.rb +26 -0
- data/lib/transparent_request.rb +33 -0
- data/test/fixture.rb +41 -0
- data/test/helper.rb +20 -0
- data/test/test_credit_card_payment.rb +29 -0
- data/test/test_creditcard.rb +27 -0
- data/test/test_instruction.rb +28 -0
- data/test/test_mymoip.rb +49 -0
- data/test/test_payer.rb +35 -0
- data/test/test_payment_request.rb +73 -0
- data/test/test_request.rb +37 -0
- data/test/test_transparent_request.rb +56 -0
- metadata +189 -0
data/.document
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# Specify our desired <ruby>[@<gemset>]
|
7
|
+
environment_id="ruby-1.9.3-p194@mymoip"
|
8
|
+
|
9
|
+
# First we attempt to load the desired environment directly from the environment
|
10
|
+
# file. This is very fast and efficient compared to running through the entire
|
11
|
+
# CLI and selector. If you want feedback on which environment was used then
|
12
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
13
|
+
|
14
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
15
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
16
|
+
then
|
17
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
18
|
+
|
19
|
+
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
|
20
|
+
then
|
21
|
+
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
|
22
|
+
fi
|
23
|
+
else
|
24
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
25
|
+
if ! rvm --create "$environment_id"
|
26
|
+
then
|
27
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
28
|
+
return 1
|
29
|
+
fi
|
30
|
+
fi
|
31
|
+
|
32
|
+
# User feedback
|
33
|
+
|
34
|
+
if [[ $- == *i* ]] # check for interactive shells
|
35
|
+
then
|
36
|
+
echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
|
37
|
+
else
|
38
|
+
echo "Using: $GEM_HOME" # don't use colors in interactive shells
|
39
|
+
fi
|
40
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
|
9
|
+
gem "builder"
|
10
|
+
gem "httparty"
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem "rdoc", "~> 3.12"
|
14
|
+
gem "bundler", ">= 0"
|
15
|
+
gem "jeweler", "~> 1.8.4"
|
16
|
+
gem "turn"
|
17
|
+
gem "mocha", require: false
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ansi (1.4.3)
|
5
|
+
builder (3.0.0)
|
6
|
+
git (1.2.5)
|
7
|
+
httparty (0.8.3)
|
8
|
+
multi_json (~> 1.0)
|
9
|
+
multi_xml
|
10
|
+
jeweler (1.8.4)
|
11
|
+
bundler (~> 1.0)
|
12
|
+
git (>= 1.2.5)
|
13
|
+
rake
|
14
|
+
rdoc
|
15
|
+
json (1.7.4)
|
16
|
+
metaclass (0.0.1)
|
17
|
+
mocha (0.12.3)
|
18
|
+
metaclass (~> 0.0.1)
|
19
|
+
multi_json (1.3.6)
|
20
|
+
multi_xml (0.5.1)
|
21
|
+
rake (0.9.2.2)
|
22
|
+
rdoc (3.12)
|
23
|
+
json (~> 1.4)
|
24
|
+
turn (0.9.6)
|
25
|
+
ansi
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
builder
|
32
|
+
bundler
|
33
|
+
httparty
|
34
|
+
jeweler (~> 1.8.4)
|
35
|
+
mocha
|
36
|
+
rdoc (~> 3.12)
|
37
|
+
turn
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Irio Irineu Musskopf Junior
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
MyMoip
|
2
|
+
======
|
3
|
+
|
4
|
+
MoIP transactions in a gem to call your own.
|
5
|
+
|
6
|
+
Provides a implementation of MoIP's transparent checkout.
|
7
|
+
|
8
|
+
Contributing to MyMoip
|
9
|
+
----------------------
|
10
|
+
|
11
|
+
What would you do if you could make your own implementation of MoIP?
|
12
|
+
|
13
|
+
Any patch are welcome, even removing extra blank spaces.
|
14
|
+
|
15
|
+
1. Open a pull request.
|
16
|
+
2. Done.
|
17
|
+
|
18
|
+
Using
|
19
|
+
-----
|
20
|
+
|
21
|
+
Currently under active development.
|
22
|
+
|
23
|
+
**Bundler - Gemfile**
|
24
|
+
```ruby
|
25
|
+
gem 'mymoip'
|
26
|
+
```
|
27
|
+
|
28
|
+
**Configuration**
|
29
|
+
```ruby
|
30
|
+
MyMoip.token = "your_moip_dev_token"
|
31
|
+
MyMoip.key = "your_moip_dev_key"
|
32
|
+
```
|
33
|
+
|
34
|
+
**First request: what and from who**
|
35
|
+
```ruby
|
36
|
+
payer = MyMoip::Payer.new(
|
37
|
+
id: "your_own_id",
|
38
|
+
name: "Juquinha da Rocha",
|
39
|
+
email: "juquinha@rocha.com",
|
40
|
+
address_street: "Felipe Neri",
|
41
|
+
address_street_number: "406",
|
42
|
+
address_street_extra: "Sala 501",
|
43
|
+
address_neighbourhood: "Auxiliadora",
|
44
|
+
address_city: "Porto Alegre",
|
45
|
+
address_state: "RS",
|
46
|
+
address_country: "BRA",
|
47
|
+
address_cep: "90440-150",
|
48
|
+
address_phone: "(51)3040-5060"
|
49
|
+
) # 9 digit phones must be in "(11)93040-5060" format
|
50
|
+
|
51
|
+
instruction = MyMoip::Instruction.new(
|
52
|
+
id: "your_own_id",
|
53
|
+
payment_reason: "Order in Buy Everything Store",
|
54
|
+
values: [100.0],
|
55
|
+
payer: payer
|
56
|
+
)
|
57
|
+
|
58
|
+
transparent_request = MyMoip::TransparentRequest.new("your_own_id")
|
59
|
+
transparent_request.api_call(instruction)
|
60
|
+
```
|
61
|
+
|
62
|
+
**Second request: how**
|
63
|
+
```ruby
|
64
|
+
credit_card = MyMoip::CreditCard.new(
|
65
|
+
logo: :visa,
|
66
|
+
card_number: "4916654211627608",
|
67
|
+
expiration_date: "06/15",
|
68
|
+
security_code: "000",
|
69
|
+
owner_name: "Juquinha da Rocha",
|
70
|
+
owner_birthday: Date.new(1984, 11, 3),
|
71
|
+
owner_phone: "(51)3040-5060",
|
72
|
+
owner_rg: "1010202030"
|
73
|
+
)
|
74
|
+
|
75
|
+
credit_card_payment = MyMoip::CreditCardPayment.new(credit_card, 1)
|
76
|
+
payment_request = MyMoip::PaymentRequest.new("your_own_id")
|
77
|
+
payment_request.api_call(credit_card_payment, token: transparent_request.token)
|
78
|
+
```
|
79
|
+
|
80
|
+
**Success?**
|
81
|
+
```ruby
|
82
|
+
payment_request.success?
|
83
|
+
```
|
84
|
+
|
85
|
+
License
|
86
|
+
-------
|
87
|
+
|
88
|
+
MIT. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "mymoip"
|
18
|
+
gem.homepage = "http://github.com/Irio/mymoip"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = "MoIP transactions in a gem to call your own."
|
21
|
+
gem.description = "Provides a implementation of MoIP's transparent checkout."
|
22
|
+
gem.email = "irio.musskopf@caixadeideias.com.br"
|
23
|
+
gem.authors = ["Irio Irineu Musskopf Junior"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
require 'rdoc/task'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "mymoip #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/credit_card.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module MyMoip
|
2
|
+
class CreditCard
|
3
|
+
attr_accessor :logo, :card_number, :expiration_date, :security_code,
|
4
|
+
:owner_name, :owner_birthday, :owner_phone, :owner_rg
|
5
|
+
|
6
|
+
def initialize(params)
|
7
|
+
@logo = params[:logo] if params.has_key? :logo
|
8
|
+
@card_number = params[:card_number] if params.has_key? :card_number
|
9
|
+
@expiration_date = params[:expiration_date] if params.has_key? :expiration_date
|
10
|
+
@security_code = params[:security_code] if params.has_key? :security_code
|
11
|
+
@owner_name = params[:owner_name] if params.has_key? :owner_name
|
12
|
+
@owner_birthday = params[:owner_birthday] if params.has_key? :owner_birthday
|
13
|
+
@owner_phone = params[:owner_phone] if params.has_key? :owner_phone
|
14
|
+
@owner_rg = params[:owner_rg] if params.has_key? :owner_rg
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module MyMoip
|
2
|
+
class CreditCardPayment
|
3
|
+
attr_accessor :credit_card, :tranches
|
4
|
+
|
5
|
+
def initialize(credit_card, tranches = 1)
|
6
|
+
@credit_card, @tranches = credit_card, tranches
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_json
|
10
|
+
raise "No CreditCard provided" if credit_card.nil?
|
11
|
+
|
12
|
+
json = {
|
13
|
+
Forma: "CartaoCredito",
|
14
|
+
Parcelas: @tranches,
|
15
|
+
CartaoCredito: {
|
16
|
+
Numero: credit_card.card_number,
|
17
|
+
Expiracao: credit_card.expiration_date,
|
18
|
+
CodigoSeguranca: credit_card.security_code,
|
19
|
+
Portador: {
|
20
|
+
Nome: credit_card.owner_name,
|
21
|
+
DataNascimento: credit_card.owner_birthday.strftime("%d/%m/%Y"),
|
22
|
+
Telefone: credit_card.owner_phone,
|
23
|
+
Identidade: credit_card.owner_rg
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
json[:Instituicao] = {
|
29
|
+
american_express: "American Express",
|
30
|
+
diners: "Diners",
|
31
|
+
hipercard: "Hipercard",
|
32
|
+
mastercard: "Mastercard",
|
33
|
+
visa: "Visa"
|
34
|
+
}.fetch credit_card.logo
|
35
|
+
|
36
|
+
if cash?
|
37
|
+
json[:Recebimento] = "AVista"
|
38
|
+
end
|
39
|
+
|
40
|
+
json
|
41
|
+
end
|
42
|
+
|
43
|
+
def cash?
|
44
|
+
@tranches == 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/instruction.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module MyMoip
|
2
|
+
class Instruction
|
3
|
+
attr_accessor :id, :payment_reason, :values, :payer
|
4
|
+
|
5
|
+
def initialize(attrs)
|
6
|
+
@id = attrs[:id] if attrs.has_key?(:id)
|
7
|
+
@payment_reason = attrs[:payment_reason] if attrs.has_key?(:payment_reason)
|
8
|
+
@values = attrs[:values] if attrs.has_key?(:values)
|
9
|
+
@payer = attrs[:payer] if attrs.has_key?(:payer)
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_xml(root = nil)
|
13
|
+
|
14
|
+
xml = ""
|
15
|
+
root = Builder::XmlMarkup.new(target: xml)
|
16
|
+
|
17
|
+
root.EnviarInstrucao do |n1|
|
18
|
+
n1.InstrucaoUnica(TipoValidacao: "Transparente") do |n2|
|
19
|
+
n2.Razao(@payment_reason)
|
20
|
+
n2.Valores do |n3|
|
21
|
+
@values.each { |v| n3.Valor("%.2f" % v, moeda: "BRL") }
|
22
|
+
end
|
23
|
+
n2.IdProprio(@id)
|
24
|
+
n2.Pagador { |n3| @payer.to_xml(n3) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
xml
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/json_parser.rb
ADDED
data/lib/mymoip.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'builder'
|
2
|
+
require 'logger'
|
3
|
+
require 'httparty'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module MyMoip
|
7
|
+
class << self
|
8
|
+
attr_accessor :token, :key, :environment, :logger, :default_referer_url
|
9
|
+
|
10
|
+
def api_url
|
11
|
+
if environment == "sandbox"
|
12
|
+
"https://desenvolvedor.moip.com.br/sandbox"
|
13
|
+
else
|
14
|
+
"https://desenvolvedor.moip.com.br"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Dir[File.dirname(__FILE__) + "/../lib/*.rb"].each { |file| require file }
|
21
|
+
|
22
|
+
MyMoip.environment = "sandbox"
|
23
|
+
MyMoip.logger = Logger.new(STDOUT)
|
data/lib/payer.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
module MyMoip
|
2
|
+
class Payer
|
3
|
+
attr_accessor :id, :name, :email,
|
4
|
+
:address_street, :address_street_number, :address_street_extra,
|
5
|
+
:address_neighbourhood, :address_city, :address_state,
|
6
|
+
:address_country, :address_cep, :address_phone
|
7
|
+
|
8
|
+
def initialize(attrs)
|
9
|
+
@id = attrs[:id] if attrs.has_key?(:id)
|
10
|
+
@name = attrs[:name] if attrs.has_key?(:name)
|
11
|
+
@email = attrs[:email] if attrs.has_key?(:email)
|
12
|
+
@address_street = attrs[:address_street] if attrs.has_key?(:address_street)
|
13
|
+
@address_street_number = attrs[:address_street_number] if attrs.has_key?(:address_street_number)
|
14
|
+
@address_street_extra = attrs[:address_street_extra] if attrs.has_key?(:address_street_extra)
|
15
|
+
@address_neighbourhood = attrs[:address_neighbourhood] if attrs.has_key?(:address_neighbourhood)
|
16
|
+
@address_city = attrs[:address_city] if attrs.has_key?(:address_city)
|
17
|
+
@address_state = attrs[:address_state] if attrs.has_key?(:address_state)
|
18
|
+
@address_country = attrs[:address_country] if attrs.has_key?(:address_country)
|
19
|
+
@address_cep = attrs[:address_cep] if attrs.has_key?(:address_cep)
|
20
|
+
@address_phone = attrs[:address_phone] if attrs.has_key?(:address_phone)
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_xml(root = nil)
|
24
|
+
if root.nil?
|
25
|
+
xml = ""
|
26
|
+
root ||= Builder::XmlMarkup.new(target: xml)
|
27
|
+
end
|
28
|
+
|
29
|
+
root.Nome(@name)
|
30
|
+
root.Email(@email)
|
31
|
+
root.IdPagador(@id)
|
32
|
+
root.EnderecoCobranca do |n1|
|
33
|
+
n1.Logradouro(@address_street)
|
34
|
+
n1.Numero(@address_street_number)
|
35
|
+
n1.Complemento(@address_street_extra)
|
36
|
+
n1.Bairro(@address_neighbourhood)
|
37
|
+
n1.Cidade(@address_city)
|
38
|
+
n1.Estado(@address_state)
|
39
|
+
n1.Pais(@address_country)
|
40
|
+
n1.CEP(@address_cep)
|
41
|
+
n1.TelefoneFixo(@address_phone)
|
42
|
+
end
|
43
|
+
|
44
|
+
xml
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'request'
|
2
|
+
|
3
|
+
module MyMoip
|
4
|
+
class PaymentRequest < Request
|
5
|
+
|
6
|
+
HTTP_METHOD = :get
|
7
|
+
PATH = "/rest/pagamento?callback=?"
|
8
|
+
REQUIRES_AUTH = false
|
9
|
+
FORMAT = :json
|
10
|
+
|
11
|
+
def api_call(data, extra_attrs)
|
12
|
+
extra_attrs[:referer_url] ||= MyMoip.default_referer_url
|
13
|
+
extra_attrs[:parser] ||= MyMoip::JsonParser
|
14
|
+
|
15
|
+
json = JSON.generate({
|
16
|
+
pagamentoWidget: {
|
17
|
+
referer: extra_attrs[:referer_url],
|
18
|
+
token: extra_attrs[:token],
|
19
|
+
dadosPagamento: data.to_json
|
20
|
+
}
|
21
|
+
})
|
22
|
+
|
23
|
+
params = {
|
24
|
+
query: { pagamentoWidget: json },
|
25
|
+
http_method: HTTP_METHOD,
|
26
|
+
requires_auth: REQUIRES_AUTH,
|
27
|
+
path: PATH,
|
28
|
+
format: FORMAT
|
29
|
+
}
|
30
|
+
params[:parser] = extra_attrs.delete :parser unless extra_attrs[:parser].nil?
|
31
|
+
|
32
|
+
super params
|
33
|
+
end
|
34
|
+
|
35
|
+
def success?
|
36
|
+
@response && @response["StatusPagamento"] == "Sucesso"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/lib/request.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module MyMoip
|
2
|
+
class Request
|
3
|
+
include HTTParty
|
4
|
+
|
5
|
+
attr_reader :id, :data, :response
|
6
|
+
|
7
|
+
def initialize(id)
|
8
|
+
@id = id
|
9
|
+
end
|
10
|
+
|
11
|
+
def api_call(params, logger = nil, username = MyMoip.token, password = MyMoip.key)
|
12
|
+
logger ||= MyMoip.logger
|
13
|
+
username ||= MyMoip.token
|
14
|
+
password ||= MyMoip.key
|
15
|
+
|
16
|
+
logger.info "MyMoip::Request of ##{@id} with #{params[:body].inspect}"
|
17
|
+
|
18
|
+
url = MyMoip.api_url + params.delete(:path)
|
19
|
+
params[:basic_auth] = { username: username, password: password }
|
20
|
+
|
21
|
+
@response = HTTParty.send params.delete(:http_method), url, params
|
22
|
+
|
23
|
+
logger.info "MyMoip::Request of ##{@id} to #{url} had response #{@response}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module MyMoip
|
2
|
+
class TransparentRequest < Request
|
3
|
+
|
4
|
+
HTTP_METHOD = :post
|
5
|
+
PATH = "/ws/alpha/EnviarInstrucao/Unica"
|
6
|
+
REQUIRES_AUTH = true
|
7
|
+
|
8
|
+
def api_call(data, logger = MyMoip.logger)
|
9
|
+
params = {
|
10
|
+
body: data.to_xml,
|
11
|
+
http_method: HTTP_METHOD,
|
12
|
+
requires_auth: REQUIRES_AUTH,
|
13
|
+
path: PATH,
|
14
|
+
logger: logger
|
15
|
+
}
|
16
|
+
|
17
|
+
super params
|
18
|
+
end
|
19
|
+
|
20
|
+
def success?
|
21
|
+
@response && @response["EnviarInstrucaoUnicaResponse"]["Resposta"]["Status"] == "Sucesso"
|
22
|
+
rescue NoMethodError => e
|
23
|
+
false
|
24
|
+
end
|
25
|
+
|
26
|
+
def token
|
27
|
+
@response["EnviarInstrucaoUnicaResponse"]["Resposta"]["Token"] || nil
|
28
|
+
rescue NoMethodError => e
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/test/fixture.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
class Fixture
|
2
|
+
def self.payer
|
3
|
+
MyMoip::Payer.new(
|
4
|
+
id: "some id",
|
5
|
+
name: "some name",
|
6
|
+
email: "some email",
|
7
|
+
address_street: "some address_street",
|
8
|
+
address_street_number: "some address_street_number",
|
9
|
+
address_street_extra: "some address_street_extra",
|
10
|
+
address_neighbourhood: "some address_neighbourhood",
|
11
|
+
address_city: "some address_city",
|
12
|
+
address_state: "some address_state",
|
13
|
+
address_country: "some address_country",
|
14
|
+
address_cep: "some address_cep",
|
15
|
+
address_phone: "some address_phone"
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.instruction(payer)
|
20
|
+
MyMoip::Instruction.new(
|
21
|
+
id: "some id",
|
22
|
+
payment_reason: "some payment_reason",
|
23
|
+
values: [100.0, 200.0],
|
24
|
+
payer: payer
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.credit_card
|
29
|
+
MyMoip::CreditCard.new(
|
30
|
+
logo: :visa,
|
31
|
+
card_number: "4916654211627608",
|
32
|
+
expiration_date: "06/15",
|
33
|
+
security_code: "000",
|
34
|
+
owner_name: "Juquinha da Rocha",
|
35
|
+
owner_birthday: Date.new(1984, 11, 3),
|
36
|
+
owner_phone: "(51)3040-5060",
|
37
|
+
owner_rg: "1010202030"
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'turn/autorun'
|
12
|
+
require 'mocha'
|
13
|
+
|
14
|
+
require 'fixture'
|
15
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
16
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
17
|
+
|
18
|
+
Dir[File.dirname(__FILE__) + "/../lib/*.rb"].each { |file| require file }
|
19
|
+
|
20
|
+
MyMoip.logger = Logger.new "/dev/null"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestCreditCardPayment < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_initialization_and_getters
|
6
|
+
credit_card = Fixture.credit_card
|
7
|
+
subject = MyMoip::CreditCardPayment.new(credit_card, 1)
|
8
|
+
assert_equal credit_card, subject.credit_card
|
9
|
+
assert_equal 1, subject.tranches
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_cash_method_with_one_tranch
|
13
|
+
credit_card = Fixture.credit_card
|
14
|
+
subject = MyMoip::CreditCardPayment.new(credit_card, 1)
|
15
|
+
assert_equal true, subject.cash?
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_cash_method_with_more_than_one_tranches
|
19
|
+
credit_card = Fixture.credit_card
|
20
|
+
subject = MyMoip::CreditCardPayment.new(credit_card, 3)
|
21
|
+
assert_equal false, subject.cash?
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_default_initialization_with_one_tranch
|
25
|
+
credit_card = Fixture.credit_card
|
26
|
+
subject = MyMoip::CreditCardPayment.new(credit_card)
|
27
|
+
assert_equal 1, subject.tranches
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestCreditCard < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_initialization_and_setters
|
6
|
+
subject = MyMoip::CreditCard.new(
|
7
|
+
logo: :visa,
|
8
|
+
card_number: "4916654211627608",
|
9
|
+
expiration_date: "06/15",
|
10
|
+
security_code: "000",
|
11
|
+
owner_name: "Juquinha da Rocha",
|
12
|
+
owner_birthday: Date.new(1984, 11, 3),
|
13
|
+
owner_phone: "(51)3040-5060",
|
14
|
+
owner_rg: "1010202030"
|
15
|
+
)
|
16
|
+
|
17
|
+
assert_equal :visa, subject.logo
|
18
|
+
assert_equal "4916654211627608", subject.card_number
|
19
|
+
assert_equal "06/15", subject.expiration_date
|
20
|
+
assert_equal "000", subject.security_code
|
21
|
+
assert_equal "Juquinha da Rocha", subject.owner_name
|
22
|
+
assert_equal Date.new(1984, 11, 3), subject.owner_birthday
|
23
|
+
assert_equal "(51)3040-5060", subject.owner_phone
|
24
|
+
assert_equal "1010202030", subject.owner_rg
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestInstruction < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_getters_for_attributes
|
6
|
+
|
7
|
+
payer = Fixture.payer
|
8
|
+
instruction = MyMoip::Instruction.new(
|
9
|
+
id: "some id",
|
10
|
+
payment_reason: "some payment_reason",
|
11
|
+
values: [100.0, 200.0],
|
12
|
+
payer: payer
|
13
|
+
)
|
14
|
+
|
15
|
+
assert_equal "some id", instruction.id
|
16
|
+
assert_equal "some payment_reason", instruction.payment_reason
|
17
|
+
assert_equal [100.0, 200.0], instruction.values
|
18
|
+
assert_equal payer, instruction.payer
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_generate_a_string_when_converting_to_xml
|
22
|
+
payer = Fixture.payer
|
23
|
+
instruction = Fixture.instruction(payer)
|
24
|
+
|
25
|
+
assert_equal String, instruction.to_xml.class
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/test/test_mymoip.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestMymoip < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_default_environment_is_sandbox
|
6
|
+
assert_equal "sandbox", MyMoip.environment
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_set_auth_configuration
|
10
|
+
default_env = MyMoip.environment
|
11
|
+
MyMoip.token = "my_token"
|
12
|
+
MyMoip.key = "my_key"
|
13
|
+
MyMoip.environment = "production"
|
14
|
+
MyMoip.default_referer_url = "http://localhost"
|
15
|
+
|
16
|
+
assert_equal "my_token", MyMoip.token
|
17
|
+
assert_equal "my_key", MyMoip.key
|
18
|
+
assert_equal "production", MyMoip.environment
|
19
|
+
assert_equal "http://localhost", MyMoip.default_referer_url
|
20
|
+
|
21
|
+
MyMoip.environment = default_env
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_choose_right_api_url_by_sandbox_environment
|
25
|
+
MyMoip.environment = "sandbox"
|
26
|
+
|
27
|
+
assert_equal "https://desenvolvedor.moip.com.br/sandbox", MyMoip.api_url
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_choose_right_api_url_by_production_environment
|
31
|
+
default_env = MyMoip.environment
|
32
|
+
MyMoip.environment = "production"
|
33
|
+
|
34
|
+
assert_equal "https://desenvolvedor.moip.com.br", MyMoip.api_url
|
35
|
+
MyMoip.environment = default_env
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_logger_initialization
|
39
|
+
assert MyMoip.logger.instance_of? Logger
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_attribution_of_new_logger
|
43
|
+
default_logger = MyMoip.logger
|
44
|
+
MyMoip.logger = my_string = ""
|
45
|
+
assert_equal my_string, MyMoip.logger
|
46
|
+
MyMoip.logger = default_logger
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/test/test_payer.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestPayer < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_getters_for_attributes
|
6
|
+
payer = MyMoip::Payer.new(
|
7
|
+
id: "some id",
|
8
|
+
name: "some name",
|
9
|
+
email: "some email",
|
10
|
+
address_street: "some address_street",
|
11
|
+
address_street_number: "some address_street_number",
|
12
|
+
address_street_extra: "some address_street_extra",
|
13
|
+
address_neighbourhood: "some address_neighbourhood",
|
14
|
+
address_city: "some address_city",
|
15
|
+
address_state: "some address_state",
|
16
|
+
address_country: "some address_country",
|
17
|
+
address_cep: "some address_cep",
|
18
|
+
address_phone: "some address_phone"
|
19
|
+
)
|
20
|
+
|
21
|
+
assert_equal "some id", payer.id
|
22
|
+
assert_equal "some name", payer.name
|
23
|
+
assert_equal "some email", payer.email
|
24
|
+
assert_equal "some address_street", payer.address_street
|
25
|
+
assert_equal "some address_street_number", payer.address_street_number
|
26
|
+
assert_equal "some address_street_extra", payer.address_street_extra
|
27
|
+
assert_equal "some address_neighbourhood", payer.address_neighbourhood
|
28
|
+
assert_equal "some address_city", payer.address_city
|
29
|
+
assert_equal "some address_state", payer.address_state
|
30
|
+
assert_equal "some address_country", payer.address_country
|
31
|
+
assert_equal "some address_cep", payer.address_cep
|
32
|
+
assert_equal "some address_phone", payer.address_phone
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestPaymentRequest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_http_method_as_get
|
7
|
+
assert_equal :get, MyMoip::PaymentRequest::HTTP_METHOD
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_path
|
11
|
+
assert_equal "/rest/pagamento?callback=?", MyMoip::PaymentRequest::PATH
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_non_auth_requirement
|
15
|
+
assert_equal false, MyMoip::PaymentRequest::REQUIRES_AUTH
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_generate_json
|
19
|
+
HTTParty.stubs(:send).returns("<html>some_result</html>")
|
20
|
+
request = MyMoip::PaymentRequest.new("id")
|
21
|
+
|
22
|
+
JSON.expects(:generate).with(
|
23
|
+
pagamentoWidget: {
|
24
|
+
referer: "http://localhost",
|
25
|
+
token: "big_transparent_token",
|
26
|
+
dadosPagamento: {payment: "attributes"}
|
27
|
+
}
|
28
|
+
)
|
29
|
+
request_data = stub(to_json: {payment: "attributes"})
|
30
|
+
request.api_call(request_data, token: "big_transparent_token", referer_url: "http://localhost")
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_gets_default_referer_if_another_isnt_passed
|
34
|
+
MyMoip.default_referer_url = "http://localhost/default"
|
35
|
+
HTTParty.stubs(:send).returns("<html>some_result</html>")
|
36
|
+
request = MyMoip::PaymentRequest.new("id")
|
37
|
+
|
38
|
+
JSON.expects(:generate).with(
|
39
|
+
pagamentoWidget: {
|
40
|
+
referer: MyMoip.default_referer_url,
|
41
|
+
token: "big_transparent_token",
|
42
|
+
dadosPagamento: {payment: "attributes"}
|
43
|
+
}
|
44
|
+
)
|
45
|
+
request_data = stub(to_json: {payment: "attributes"})
|
46
|
+
request.api_call(request_data, token: "big_transparent_token")
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_succesful_status
|
50
|
+
MyMoip.default_referer_url = "http://localhost/default"
|
51
|
+
HTTParty.stubs(:send).returns(
|
52
|
+
JSON.parse '{"Status":"EmAnalise","Codigo":0,"CodigoRetorno":"","TaxaMoIP":"7.79","StatusPagamento":"Sucesso","Classificacao":{"Codigo":999,"Descricao":"Não suportado no ambiente Sandbox"},"CodigoMoIP":77316,"Mensagem":"Requisição processada com sucesso","TotalPago":"100.00"}'
|
53
|
+
)
|
54
|
+
request = MyMoip::PaymentRequest.new("id")
|
55
|
+
|
56
|
+
request_data = stub(to_json: {payment: "attributes"})
|
57
|
+
request.api_call(request_data, token: "big_transparent_token")
|
58
|
+
assert request.success?
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_success_method_returns_false_in_payments_already_made
|
62
|
+
MyMoip.default_referer_url = "http://localhost/default"
|
63
|
+
HTTParty.stubs(:send).returns(
|
64
|
+
JSON.parse '{"Codigo":236,"StatusPagamento":"Falha","Mensagem":"Pagamento já foi realizado"}'
|
65
|
+
)
|
66
|
+
request = MyMoip::PaymentRequest.new("id")
|
67
|
+
|
68
|
+
request_data = stub(to_json: {payment: "attributes"})
|
69
|
+
request.api_call(request_data, token: "big_transparent_token")
|
70
|
+
assert !request.success?
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestRequest < Test::Unit::TestCase
|
4
|
+
def test_initializes_receiving_data_and_optional_id
|
5
|
+
request = MyMoip::Request.new("request_id")
|
6
|
+
assert_equal "request_id", request.id
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_logs_api_call_method
|
10
|
+
logger = stub_everything
|
11
|
+
request = MyMoip::Request.new("request_id")
|
12
|
+
params = {
|
13
|
+
http_method: :post, body: "<pretty><xml></xml></pretty>", path: "/ws/alpha/EnviarInstrucao/Unica"
|
14
|
+
}
|
15
|
+
|
16
|
+
HTTParty.stubs(:send).returns("<html>some_result</html>")
|
17
|
+
logger.expects(:info).at_least_once.
|
18
|
+
with(regexp_matches(/request_id.+<html>some_result<\/html>/))
|
19
|
+
|
20
|
+
request.api_call(params, logger)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_logs_api_call_response
|
24
|
+
logger = stub_everything
|
25
|
+
request = MyMoip::Request.new("request_id")
|
26
|
+
params = {
|
27
|
+
http_method: :post, body: "<pretty><xml></xml></pretty>", path: "/ws/alpha/EnviarInstrucao/Unica"
|
28
|
+
}
|
29
|
+
|
30
|
+
HTTParty.stubs(:send).returns("<html>some_result</html>")
|
31
|
+
logger.expects(:info).at_least_once.
|
32
|
+
with(regexp_matches(/request_id.+<html>some_result<\/html>/))
|
33
|
+
|
34
|
+
request.api_call(params, logger)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestTransparentRequest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_http_method_as_post
|
6
|
+
assert_equal :post, MyMoip::TransparentRequest::HTTP_METHOD
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_path
|
10
|
+
assert_equal "/ws/alpha/EnviarInstrucao/Unica", MyMoip::TransparentRequest::PATH
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_auth_requirement
|
14
|
+
assert_equal true, MyMoip::TransparentRequest::REQUIRES_AUTH
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_success_method_with_valid_json
|
18
|
+
HTTParty.stubs(:send).returns(
|
19
|
+
{"EnviarInstrucaoUnicaResponse"=>{"xmlns:ns1"=>"http://www.moip.com.br/ws/alpha/", "Resposta"=>{"ID"=>"201208081614306080000000928569", "Status"=>"Sucesso", "Token"=>"G290E1H230N8L0M8J1K6F1F4B3T0N610K8B0S0H0I0T0T0E029Y2R8H5Y6H9"}}}
|
20
|
+
)
|
21
|
+
request = MyMoip::TransparentRequest.new("some_id")
|
22
|
+
request_data = stub(to_xml: "<anydata></anydata>")
|
23
|
+
request.api_call request_data
|
24
|
+
assert request.success?
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_success_method_with_failed_response
|
28
|
+
HTTParty.stubs(:send).returns(
|
29
|
+
{"EnviarInstrucaoUnicaResponse"=>{"xmlns:ns1"=>"http://www.moip.com.br/ws/alpha/", "Resposta"=>{"Status"=>"Falha"}}}
|
30
|
+
)
|
31
|
+
request = MyMoip::TransparentRequest.new("some_id")
|
32
|
+
request_data = stub(to_xml: "<anydata></anydata>")
|
33
|
+
request.api_call request_data
|
34
|
+
assert !request.success?
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_success_method_with_requests_that_hasnt_be_made
|
38
|
+
request = MyMoip::TransparentRequest.new("some_id")
|
39
|
+
assert !request.success?
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_provides_token_when_has_a_valid_response
|
43
|
+
HTTParty.stubs(:send).returns(
|
44
|
+
{"EnviarInstrucaoUnicaResponse"=>{"xmlns:ns1"=>"http://www.moip.com.br/ws/alpha/", "Resposta"=>{"ID"=>"201208081614306080000000928569", "Status"=>"Sucesso", "Token"=>"token"}}}
|
45
|
+
)
|
46
|
+
request = MyMoip::TransparentRequest.new("some_id")
|
47
|
+
request_data = stub(to_xml: "<anydata></anydata>")
|
48
|
+
request.api_call request_data
|
49
|
+
assert_equal "token", request.token
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_provides_token_with_requests_that_hasnt_be_made
|
53
|
+
request = MyMoip::TransparentRequest.new("some_id")
|
54
|
+
assert_equal nil, request.token
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mymoip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Irio Irineu Musskopf Junior
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: builder
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: httparty
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rdoc
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.12'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.12'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bundler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: jeweler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.8.4
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.8.4
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: turn
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: mocha
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Provides a implementation of MoIP's transparent checkout.
|
127
|
+
email: irio.musskopf@caixadeideias.com.br
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files:
|
131
|
+
- LICENSE.txt
|
132
|
+
- README.md
|
133
|
+
files:
|
134
|
+
- .document
|
135
|
+
- .rvmrc
|
136
|
+
- Gemfile
|
137
|
+
- Gemfile.lock
|
138
|
+
- LICENSE.txt
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- VERSION
|
142
|
+
- lib/credit_card.rb
|
143
|
+
- lib/credit_card_payment.rb
|
144
|
+
- lib/instruction.rb
|
145
|
+
- lib/json_parser.rb
|
146
|
+
- lib/mymoip.rb
|
147
|
+
- lib/payer.rb
|
148
|
+
- lib/payment_request.rb
|
149
|
+
- lib/request.rb
|
150
|
+
- lib/transparent_request.rb
|
151
|
+
- test/fixture.rb
|
152
|
+
- test/helper.rb
|
153
|
+
- test/test_credit_card_payment.rb
|
154
|
+
- test/test_creditcard.rb
|
155
|
+
- test/test_instruction.rb
|
156
|
+
- test/test_mymoip.rb
|
157
|
+
- test/test_payer.rb
|
158
|
+
- test/test_payment_request.rb
|
159
|
+
- test/test_request.rb
|
160
|
+
- test/test_transparent_request.rb
|
161
|
+
homepage: http://github.com/Irio/mymoip
|
162
|
+
licenses:
|
163
|
+
- MIT
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
hash: 2380345948559102713
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ! '>='
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 1.8.24
|
186
|
+
signing_key:
|
187
|
+
specification_version: 3
|
188
|
+
summary: MoIP transactions in a gem to call your own.
|
189
|
+
test_files: []
|