mundipagg 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +191 -191
- data/README.md +118 -118
- data/lib/mundipagg.rb +13 -11
- data/lib/mundipagg/BoletoTransaction.rb +30 -30
- data/lib/mundipagg/Buyer.rb +81 -81
- data/lib/mundipagg/BuyerAddress.rb +68 -68
- data/lib/mundipagg/CreateOrderRequest.rb +66 -62
- data/lib/mundipagg/CreditCardTransaction.rb +81 -81
- data/lib/mundipagg/ManageOrderRequest.rb +51 -51
- data/lib/mundipagg/QueryOrderRequest.rb +26 -26
- data/lib/mundipagg/Recurrency.rb +38 -38
- data/lib/mundipagg/ShoppingCart.rb +15 -0
- data/lib/mundipagg/ShoppingCartItem.rb +23 -0
- data/lib/mundipagg/gateway.rb +400 -365
- data/lib/mundipagg/post_notification.rb +30 -30
- data/lib/mundipagg/version.rb +8 -8
- data/mundipagg.gemspec +18 -18
- data/tests/features/boleto.feature +9 -9
- data/tests/features/credit_card.feature +37 -29
- data/tests/features/post_notification.feature +9 -9
- data/tests/features/step_definitions/boleto_steps.rb +50 -50
- data/tests/features/step_definitions/credit_card_steps.rb +145 -121
- data/tests/features/step_definitions/post_notification.rb +92 -92
- data/tests/features/support/env.rb +6 -6
- data/tests/test_configuration.rb +5 -5
- data/tests/test_helper.rb +68 -68
- metadata +17 -12
- checksums.yaml +0 -7
data/lib/mundipagg.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
require 'savon'
|
2
|
-
require 'mundipagg/gateway'
|
3
|
-
require 'mundipagg/CreateOrderRequest'
|
4
|
-
require 'mundipagg/BoletoTransaction'
|
5
|
-
require 'mundipagg/CreditCardTransaction'
|
6
|
-
require 'mundipagg/Buyer'
|
7
|
-
require 'mundipagg/BuyerAddress'
|
8
|
-
require 'mundipagg/QueryOrderRequest'
|
9
|
-
require 'mundipagg/ManageOrderRequest'
|
10
|
-
require 'mundipagg/Recurrency'
|
11
|
-
require 'mundipagg/post_notification'
|
1
|
+
require 'savon'
|
2
|
+
require 'mundipagg/gateway'
|
3
|
+
require 'mundipagg/CreateOrderRequest'
|
4
|
+
require 'mundipagg/BoletoTransaction'
|
5
|
+
require 'mundipagg/CreditCardTransaction'
|
6
|
+
require 'mundipagg/Buyer'
|
7
|
+
require 'mundipagg/BuyerAddress'
|
8
|
+
require 'mundipagg/QueryOrderRequest'
|
9
|
+
require 'mundipagg/ManageOrderRequest'
|
10
|
+
require 'mundipagg/Recurrency'
|
11
|
+
require 'mundipagg/post_notification'
|
12
|
+
require 'mundipagg/ShoppingCart'
|
13
|
+
require 'mundipagg/ShoppingCartItem'
|
@@ -1,31 +1,31 @@
|
|
1
|
-
module Mundipagg
|
2
|
-
class BoletoTransaction
|
3
|
-
|
4
|
-
# @return [Long] Transaction amount in cents
|
5
|
-
attr_accessor :amountInCents
|
6
|
-
|
7
|
-
# @return [Integer] Bank code
|
8
|
-
attr_accessor :bankNumber
|
9
|
-
|
10
|
-
# @return [Integer] How many days after the creation the boleto will be valid.
|
11
|
-
# @param Default: 7
|
12
|
-
attr_accessor :daysToAddInBoletoExpirationDate
|
13
|
-
|
14
|
-
# @return [Integer] Number used to identify the boleto
|
15
|
-
attr_accessor :nossoNumero
|
16
|
-
|
17
|
-
# @return [Long] Text with payment instructions. Limit: 120 characters.
|
18
|
-
attr_accessor :instructions
|
19
|
-
|
20
|
-
# @return [Long] Custom transaction identifier.
|
21
|
-
attr_accessor :transactionReference
|
22
|
-
|
23
|
-
# Initialize class with default values
|
24
|
-
def initialize
|
25
|
-
@amountInCents = 0
|
26
|
-
@daysToAddInBoletoExpirationDate = 7
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
end
|
1
|
+
module Mundipagg
|
2
|
+
class BoletoTransaction
|
3
|
+
|
4
|
+
# @return [Long] Transaction amount in cents
|
5
|
+
attr_accessor :amountInCents
|
6
|
+
|
7
|
+
# @return [Integer] Bank code
|
8
|
+
attr_accessor :bankNumber
|
9
|
+
|
10
|
+
# @return [Integer] How many days after the creation the boleto will be valid.
|
11
|
+
# @param Default: 7
|
12
|
+
attr_accessor :daysToAddInBoletoExpirationDate
|
13
|
+
|
14
|
+
# @return [Integer] Number used to identify the boleto
|
15
|
+
attr_accessor :nossoNumero
|
16
|
+
|
17
|
+
# @return [Long] Text with payment instructions. Limit: 120 characters.
|
18
|
+
attr_accessor :instructions
|
19
|
+
|
20
|
+
# @return [Long] Custom transaction identifier.
|
21
|
+
attr_accessor :transactionReference
|
22
|
+
|
23
|
+
# Initialize class with default values
|
24
|
+
def initialize
|
25
|
+
@amountInCents = 0
|
26
|
+
@daysToAddInBoletoExpirationDate = 7
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
31
|
end
|
data/lib/mundipagg/Buyer.rb
CHANGED
@@ -1,82 +1,82 @@
|
|
1
|
-
module Mundipagg
|
2
|
-
class Buyer
|
3
|
-
|
4
|
-
# @return [Guid] Buyer unique idenfitication. Generated by MundiPagg.
|
5
|
-
# param Default: 00000000-0000-0000-0000-000000000000 (Guid empty)
|
6
|
-
attr_accessor :buyerKey
|
7
|
-
# @return [String] Buyer custom idenfitication.
|
8
|
-
attr_accessor :buyerReference
|
9
|
-
# @return [String] Email address.
|
10
|
-
attr_accessor :email
|
11
|
-
# @return [String] Facebook ID.
|
12
|
-
attr_accessor :facebookId
|
13
|
-
# @return [String] Gender.
|
14
|
-
attr_accessor :genderEnum
|
15
|
-
# @return [String] Home phone.
|
16
|
-
attr_accessor :homePhone
|
17
|
-
# @return [String] IP Address.
|
18
|
-
attr_accessor :ipAddress
|
19
|
-
# @return [String] Mobile phone.
|
20
|
-
attr_accessor :mobilePhone
|
21
|
-
# @return [String] Work phone.
|
22
|
-
attr_accessor :workPhone
|
23
|
-
# @return [String] Buyer full name.
|
24
|
-
attr_accessor :name
|
25
|
-
# <i>Person</i> for individual people information and <i>Company</i> for enterprise information
|
26
|
-
# @return [String] Type.
|
27
|
-
# @param Default: Person
|
28
|
-
attr_accessor :personTypeEnum
|
29
|
-
# @return [String] Document number.
|
30
|
-
attr_accessor :taxDocumentNumber
|
31
|
-
#<i>CPF<i> for person document number or <i>CNPJ</i> for company document number.
|
32
|
-
# @return [String] Document type.
|
33
|
-
# @param Default: CPF
|
34
|
-
attr_accessor :taxDocumentTypeEnum
|
35
|
-
# @return [String] Twitter ID.
|
36
|
-
attr_accessor :twitterId
|
37
|
-
# @return [Array] Array of addresses.
|
38
|
-
# @see BuyerAddress
|
39
|
-
attr_accessor :addressCollection
|
40
|
-
|
41
|
-
# Gender
|
42
|
-
@@Gender = {
|
43
|
-
:Male => 'M',
|
44
|
-
:Female => 'F'
|
45
|
-
}
|
46
|
-
|
47
|
-
# Person Type
|
48
|
-
@@PersonType = {
|
49
|
-
:Person => 'Person',
|
50
|
-
:Company => 'Company'
|
51
|
-
}
|
52
|
-
|
53
|
-
# Document Type
|
54
|
-
@@DocumentType = {
|
55
|
-
:CPF => 'CPF',
|
56
|
-
:CNPJ => 'CNPJ'
|
57
|
-
}
|
58
|
-
|
59
|
-
# Initialize class with properties
|
60
|
-
def initialize
|
61
|
-
@addressCollection = Array.new
|
62
|
-
@buyerKey = '00000000-0000-0000-0000-000000000000'
|
63
|
-
@personTypeEnum = Buyer.PersonTypeEnum[:Person]
|
64
|
-
@taxDocumentTypeEnum = Buyer.DocumentTypeEnum[:CPF]
|
65
|
-
end
|
66
|
-
|
67
|
-
# Gender enum
|
68
|
-
def self.GenderEnum
|
69
|
-
@@Gender
|
70
|
-
end
|
71
|
-
|
72
|
-
# Person type enum
|
73
|
-
def self.PersonTypeEnum
|
74
|
-
@@PersonType
|
75
|
-
end
|
76
|
-
|
77
|
-
# Document type enum
|
78
|
-
def self.DocumentTypeEnum
|
79
|
-
@@DocumentType
|
80
|
-
end
|
81
|
-
end
|
1
|
+
module Mundipagg
|
2
|
+
class Buyer
|
3
|
+
|
4
|
+
# @return [Guid] Buyer unique idenfitication. Generated by MundiPagg.
|
5
|
+
# param Default: 00000000-0000-0000-0000-000000000000 (Guid empty)
|
6
|
+
attr_accessor :buyerKey
|
7
|
+
# @return [String] Buyer custom idenfitication.
|
8
|
+
attr_accessor :buyerReference
|
9
|
+
# @return [String] Email address.
|
10
|
+
attr_accessor :email
|
11
|
+
# @return [String] Facebook ID.
|
12
|
+
attr_accessor :facebookId
|
13
|
+
# @return [String] Gender.
|
14
|
+
attr_accessor :genderEnum
|
15
|
+
# @return [String] Home phone.
|
16
|
+
attr_accessor :homePhone
|
17
|
+
# @return [String] IP Address.
|
18
|
+
attr_accessor :ipAddress
|
19
|
+
# @return [String] Mobile phone.
|
20
|
+
attr_accessor :mobilePhone
|
21
|
+
# @return [String] Work phone.
|
22
|
+
attr_accessor :workPhone
|
23
|
+
# @return [String] Buyer full name.
|
24
|
+
attr_accessor :name
|
25
|
+
# <i>Person</i> for individual people information and <i>Company</i> for enterprise information
|
26
|
+
# @return [String] Type.
|
27
|
+
# @param Default: Person
|
28
|
+
attr_accessor :personTypeEnum
|
29
|
+
# @return [String] Document number.
|
30
|
+
attr_accessor :taxDocumentNumber
|
31
|
+
#<i>CPF<i> for person document number or <i>CNPJ</i> for company document number.
|
32
|
+
# @return [String] Document type.
|
33
|
+
# @param Default: CPF
|
34
|
+
attr_accessor :taxDocumentTypeEnum
|
35
|
+
# @return [String] Twitter ID.
|
36
|
+
attr_accessor :twitterId
|
37
|
+
# @return [Array] Array of addresses.
|
38
|
+
# @see BuyerAddress
|
39
|
+
attr_accessor :addressCollection
|
40
|
+
|
41
|
+
# Gender
|
42
|
+
@@Gender = {
|
43
|
+
:Male => 'M',
|
44
|
+
:Female => 'F'
|
45
|
+
}
|
46
|
+
|
47
|
+
# Person Type
|
48
|
+
@@PersonType = {
|
49
|
+
:Person => 'Person',
|
50
|
+
:Company => 'Company'
|
51
|
+
}
|
52
|
+
|
53
|
+
# Document Type
|
54
|
+
@@DocumentType = {
|
55
|
+
:CPF => 'CPF',
|
56
|
+
:CNPJ => 'CNPJ'
|
57
|
+
}
|
58
|
+
|
59
|
+
# Initialize class with properties
|
60
|
+
def initialize
|
61
|
+
@addressCollection = Array.new
|
62
|
+
@buyerKey = '00000000-0000-0000-0000-000000000000'
|
63
|
+
@personTypeEnum = Buyer.PersonTypeEnum[:Person]
|
64
|
+
@taxDocumentTypeEnum = Buyer.DocumentTypeEnum[:CPF]
|
65
|
+
end
|
66
|
+
|
67
|
+
# Gender enum
|
68
|
+
def self.GenderEnum
|
69
|
+
@@Gender
|
70
|
+
end
|
71
|
+
|
72
|
+
# Person type enum
|
73
|
+
def self.PersonTypeEnum
|
74
|
+
@@PersonType
|
75
|
+
end
|
76
|
+
|
77
|
+
# Document type enum
|
78
|
+
def self.DocumentTypeEnum
|
79
|
+
@@DocumentType
|
80
|
+
end
|
81
|
+
end
|
82
82
|
end
|
@@ -1,69 +1,69 @@
|
|
1
|
-
module Mundipagg
|
2
|
-
class BuyerAddress
|
3
|
-
|
4
|
-
# @return [String] Address Type.
|
5
|
-
# @see AddressTypeEnum
|
6
|
-
# @param Default: Residential
|
7
|
-
attr_accessor :addressTypeEnum
|
8
|
-
# @return [String] City.
|
9
|
-
attr_accessor :city
|
10
|
-
# @return [String] Address complement.
|
11
|
-
attr_accessor :complement
|
12
|
-
# @return [String] Address country.
|
13
|
-
# @param Default: Brazil
|
14
|
-
# @see CountryEnum
|
15
|
-
attr_accessor :countryEnum
|
16
|
-
# @return [String] District.
|
17
|
-
attr_accessor :district
|
18
|
-
# @return [String] Address number.
|
19
|
-
attr_accessor :number
|
20
|
-
# @return [String] Address state.
|
21
|
-
attr_accessor :state
|
22
|
-
# @return [String] Street.
|
23
|
-
attr_accessor :street
|
24
|
-
# @return [String] Zip Code.
|
25
|
-
attr_accessor :zipCode
|
26
|
-
|
27
|
-
|
28
|
-
#Address Type Enum
|
29
|
-
@@ADDRESS_TYPE={
|
30
|
-
:Billing => 'Billing',
|
31
|
-
:Shipping => 'Shipping',
|
32
|
-
:Work => 'Comercial',
|
33
|
-
:Home => 'Residential'
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
# Country Enum
|
38
|
-
@@COUNTRY = {
|
39
|
-
:Brazil => 'Brazil',
|
40
|
-
:UnitedStates => 'USA',
|
41
|
-
:Argentina => 'Argentina',
|
42
|
-
:Bolivia => 'Bolivia',
|
43
|
-
:Chile => 'Chile',
|
44
|
-
:Colombia => 'Colombia',
|
45
|
-
:Uruguay => 'Uruguay',
|
46
|
-
:Mexico => 'Mexico',
|
47
|
-
:Paraguay => 'Paraguay'
|
48
|
-
}
|
49
|
-
|
50
|
-
#Initialize class with properties
|
51
|
-
def initialize
|
52
|
-
@addressTypeEnum = BuyerAddress.AddressTypeEnum[:Home]
|
53
|
-
@countryEnum = BuyerAddress.CountryEnum[:Brazil]
|
54
|
-
end
|
55
|
-
|
56
|
-
#Address Type Enum
|
57
|
-
# @see @@ADDRESS_TYPE
|
58
|
-
def self.AddressTypeEnum
|
59
|
-
@@ADDRESS_TYPE
|
60
|
-
end
|
61
|
-
|
62
|
-
# Country Enum
|
63
|
-
# @see @@COUNTRY
|
64
|
-
def self.CountryEnum
|
65
|
-
@@COUNTRY
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
1
|
+
module Mundipagg
|
2
|
+
class BuyerAddress
|
3
|
+
|
4
|
+
# @return [String] Address Type.
|
5
|
+
# @see AddressTypeEnum
|
6
|
+
# @param Default: Residential
|
7
|
+
attr_accessor :addressTypeEnum
|
8
|
+
# @return [String] City.
|
9
|
+
attr_accessor :city
|
10
|
+
# @return [String] Address complement.
|
11
|
+
attr_accessor :complement
|
12
|
+
# @return [String] Address country.
|
13
|
+
# @param Default: Brazil
|
14
|
+
# @see CountryEnum
|
15
|
+
attr_accessor :countryEnum
|
16
|
+
# @return [String] District.
|
17
|
+
attr_accessor :district
|
18
|
+
# @return [String] Address number.
|
19
|
+
attr_accessor :number
|
20
|
+
# @return [String] Address state.
|
21
|
+
attr_accessor :state
|
22
|
+
# @return [String] Street.
|
23
|
+
attr_accessor :street
|
24
|
+
# @return [String] Zip Code.
|
25
|
+
attr_accessor :zipCode
|
26
|
+
|
27
|
+
|
28
|
+
#Address Type Enum
|
29
|
+
@@ADDRESS_TYPE={
|
30
|
+
:Billing => 'Billing',
|
31
|
+
:Shipping => 'Shipping',
|
32
|
+
:Work => 'Comercial',
|
33
|
+
:Home => 'Residential'
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
# Country Enum
|
38
|
+
@@COUNTRY = {
|
39
|
+
:Brazil => 'Brazil',
|
40
|
+
:UnitedStates => 'USA',
|
41
|
+
:Argentina => 'Argentina',
|
42
|
+
:Bolivia => 'Bolivia',
|
43
|
+
:Chile => 'Chile',
|
44
|
+
:Colombia => 'Colombia',
|
45
|
+
:Uruguay => 'Uruguay',
|
46
|
+
:Mexico => 'Mexico',
|
47
|
+
:Paraguay => 'Paraguay'
|
48
|
+
}
|
49
|
+
|
50
|
+
#Initialize class with properties
|
51
|
+
def initialize
|
52
|
+
@addressTypeEnum = BuyerAddress.AddressTypeEnum[:Home]
|
53
|
+
@countryEnum = BuyerAddress.CountryEnum[:Brazil]
|
54
|
+
end
|
55
|
+
|
56
|
+
#Address Type Enum
|
57
|
+
# @see @@ADDRESS_TYPE
|
58
|
+
def self.AddressTypeEnum
|
59
|
+
@@ADDRESS_TYPE
|
60
|
+
end
|
61
|
+
|
62
|
+
# Country Enum
|
63
|
+
# @see @@COUNTRY
|
64
|
+
def self.CountryEnum
|
65
|
+
@@COUNTRY
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
69
|
end
|
@@ -1,62 +1,66 @@
|
|
1
|
-
module Mundipagg
|
2
|
-
class CreateOrderRequest
|
3
|
-
# @return [Long] Order amount in cents
|
4
|
-
attr_accessor :amountInCents
|
5
|
-
|
6
|
-
# @return [Long] Amount (in cents) to consider the order is paid
|
7
|
-
attr_accessor :amountInCentsToConsiderPaid
|
8
|
-
|
9
|
-
# @return [String] Order amount currency.
|
10
|
-
# @param Default: BRL
|
11
|
-
# @see CurrencyIsoEnum
|
12
|
-
attr_accessor :currencyIsoEnum
|
13
|
-
|
14
|
-
# @return [Buyer] Buyer instance
|
15
|
-
# @see Buyer
|
16
|
-
attr_accessor :buyer
|
17
|
-
|
18
|
-
# @return [
|
19
|
-
attr_accessor :
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# @return [
|
26
|
-
attr_accessor :
|
27
|
-
|
28
|
-
# @return [Array] Array with all
|
29
|
-
attr_accessor :
|
30
|
-
|
31
|
-
#
|
32
|
-
|
33
|
-
|
34
|
-
#
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
#
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
1
|
+
module Mundipagg
|
2
|
+
class CreateOrderRequest
|
3
|
+
# @return [Long] Order amount in cents
|
4
|
+
attr_accessor :amountInCents
|
5
|
+
|
6
|
+
# @return [Long] Amount (in cents) to consider the order is paid
|
7
|
+
attr_accessor :amountInCentsToConsiderPaid
|
8
|
+
|
9
|
+
# @return [String] Order amount currency.
|
10
|
+
# @param Default: BRL
|
11
|
+
# @see CurrencyIsoEnum
|
12
|
+
attr_accessor :currencyIsoEnum
|
13
|
+
|
14
|
+
# @return [Buyer] Buyer instance
|
15
|
+
# @see Buyer
|
16
|
+
attr_accessor :buyer
|
17
|
+
|
18
|
+
# @return [Array] Array with all Shopping Carts
|
19
|
+
attr_accessor :shoppingCartCollection
|
20
|
+
|
21
|
+
# @return [Guid] MundiPagg merchant identification
|
22
|
+
attr_accessor :merchantKey
|
23
|
+
|
24
|
+
# If merchant not send OrderReference, Mundipagg will generate and return in the response.
|
25
|
+
# @return [String] Custom order identification.
|
26
|
+
attr_accessor :orderReference
|
27
|
+
|
28
|
+
# @return [Array] Array with all credit card transactions
|
29
|
+
attr_accessor :creditCardTransactionCollection
|
30
|
+
|
31
|
+
# @return [Array] Array with all boleto transactions
|
32
|
+
attr_accessor :boletoTransactionCollection
|
33
|
+
|
34
|
+
# If not send, it will be generate automatically in the webservice and returned in response.
|
35
|
+
# Web service request identification, it is used for investigate problems with webservice requests.
|
36
|
+
# @return [Guid] Globally Unique Identifier.
|
37
|
+
# @param Optional
|
38
|
+
# @param Default: 00000000-0000-0000-0000-000000000000
|
39
|
+
attr_accessor :requestKey
|
40
|
+
|
41
|
+
# Currency Enum
|
42
|
+
# @returns [Hash<Symbol, String>]
|
43
|
+
@@CURRENCY_ISO ={
|
44
|
+
:BrazillianReal => 'BRL',
|
45
|
+
:AmericanDollar => 'USD'
|
46
|
+
}
|
47
|
+
|
48
|
+
# Initialize class and properties
|
49
|
+
def initialize
|
50
|
+
@shoppingCartCollection = Array.new;
|
51
|
+
@creditCardTransactionCollection = Array.new;
|
52
|
+
@boletoTransactionCollection = Array.new;
|
53
|
+
@currencyIsoEnum = CreateOrderRequest.CurrencyIsoEnum[:BrazillianReal]
|
54
|
+
@requestKey = '00000000-0000-0000-0000-000000000000'
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# Currency Enum
|
59
|
+
# @returns [Hash<Symbol, String>]
|
60
|
+
# @see @@CURRENCY_ISO
|
61
|
+
def self.CurrencyIsoEnum
|
62
|
+
@@CURRENCY_ISO
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|