simplify 1.0.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/lib/simplify.rb +41 -0
- data/lib/simplify/apiexception.rb +160 -0
- data/lib/simplify/cardtoken.rb +102 -0
- data/lib/simplify/chargeback.rb +95 -0
- data/lib/simplify/constants.rb +56 -0
- data/lib/simplify/coupon.rb +143 -0
- data/lib/simplify/customer.rb +169 -0
- data/lib/simplify/deposit.rb +95 -0
- data/lib/simplify/event.rb +65 -0
- data/lib/simplify/invoice.rb +105 -0
- data/lib/simplify/invoiceitem.rb +140 -0
- data/lib/simplify/payment.rb +133 -0
- data/lib/simplify/paymentsapi.rb +411 -0
- data/lib/simplify/plan.rb +138 -0
- data/lib/simplify/refund.rb +120 -0
- data/lib/simplify/subscription.rb +149 -0
- data/lib/simplify/webhook.rb +135 -0
- metadata +113 -0
data/lib/simplify.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013, MasterCard International Incorporated
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification, are
|
6
|
+
# permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list of
|
9
|
+
# conditions and the following disclaimer.
|
10
|
+
# Redistributions in binary form must reproduce the above copyright notice, this list of
|
11
|
+
# conditions and the following disclaimer in the documentation and/or other materials
|
12
|
+
# provided with the distribution.
|
13
|
+
# Neither the name of the MasterCard International Incorporated nor the names of its
|
14
|
+
# contributors may be used to endorse or promote products derived from this software
|
15
|
+
# without specific prior written permission.
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
17
|
+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
19
|
+
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
21
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
22
|
+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
23
|
+
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
24
|
+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
# SUCH DAMAGE.
|
26
|
+
#
|
27
|
+
|
28
|
+
require File.dirname(__FILE__) + '/simplify/cardtoken'
|
29
|
+
require File.dirname(__FILE__) + '/simplify/chargeback'
|
30
|
+
require File.dirname(__FILE__) + '/simplify/coupon'
|
31
|
+
require File.dirname(__FILE__) + '/simplify/customer'
|
32
|
+
require File.dirname(__FILE__) + '/simplify/deposit'
|
33
|
+
require File.dirname(__FILE__) + '/simplify/event'
|
34
|
+
require File.dirname(__FILE__) + '/simplify/invoice'
|
35
|
+
require File.dirname(__FILE__) + '/simplify/invoiceitem'
|
36
|
+
require File.dirname(__FILE__) + '/simplify/payment'
|
37
|
+
require File.dirname(__FILE__) + '/simplify/plan'
|
38
|
+
require File.dirname(__FILE__) + '/simplify/refund'
|
39
|
+
require File.dirname(__FILE__) + '/simplify/subscription'
|
40
|
+
require File.dirname(__FILE__) + '/simplify/webhook'
|
41
|
+
|
@@ -0,0 +1,160 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013, MasterCard International Incorporated
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification, are
|
6
|
+
# permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list of
|
9
|
+
# conditions and the following disclaimer.
|
10
|
+
# Redistributions in binary form must reproduce the above copyright notice, this list of
|
11
|
+
# conditions and the following disclaimer in the documentation and/or other materials
|
12
|
+
# provided with the distribution.
|
13
|
+
# Neither the name of the MasterCard International Incorporated nor the names of its
|
14
|
+
# contributors may be used to endorse or promote products derived from this software
|
15
|
+
# without specific prior written permission.
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
17
|
+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
19
|
+
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
21
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
22
|
+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
23
|
+
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
24
|
+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
# SUCH DAMAGE.
|
26
|
+
#
|
27
|
+
|
28
|
+
module Simplify
|
29
|
+
|
30
|
+
|
31
|
+
# Base class for all API exceptions.
|
32
|
+
class ApiException < Exception
|
33
|
+
|
34
|
+
# HTML status code (or nil if there is no status code)
|
35
|
+
attr_reader :status
|
36
|
+
|
37
|
+
# Error data returned from the API represented as a map.
|
38
|
+
attr_reader :errorData
|
39
|
+
|
40
|
+
# Unique reference ID for the API error.
|
41
|
+
attr_reader :reference
|
42
|
+
|
43
|
+
# API code for the error.
|
44
|
+
attr_reader :errorCode
|
45
|
+
|
46
|
+
# Description of the error.
|
47
|
+
attr_reader :errorMessage
|
48
|
+
|
49
|
+
def initialize(message, status, errorData)
|
50
|
+
super(message)
|
51
|
+
|
52
|
+
@status = status
|
53
|
+
@errorMessage = message
|
54
|
+
@fieldErrors = []
|
55
|
+
if errorData != nil
|
56
|
+
@errorData = errorData
|
57
|
+
@reference = errorData.has_key?('reference') ? errorData['reference'] : nil
|
58
|
+
|
59
|
+
if errorData.has_key?('error')
|
60
|
+
error = errorData['error']
|
61
|
+
@errorCode = error['code']
|
62
|
+
if error.has_key?('message')
|
63
|
+
message = error['message']
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
super(message)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Returns a string descrption of the error.
|
71
|
+
def describe()
|
72
|
+
return "#{self.class}: \"#{self.to_s()}\" (status: #{@status}, error code #{@errorCode}, reference: #{@reference})"
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
# Exception representing API authentication errors.
|
78
|
+
class AuthenticationException < ApiException
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
# Exception representing invalid requests made to the API.
|
83
|
+
class BadRequestException < ApiException
|
84
|
+
|
85
|
+
|
86
|
+
# A single error on a field of an API request.
|
87
|
+
class FieldError
|
88
|
+
|
89
|
+
|
90
|
+
# The name of the field with the error.
|
91
|
+
attr_reader :fieldName
|
92
|
+
|
93
|
+
# The code for the field error.
|
94
|
+
attr_reader :errorCode
|
95
|
+
|
96
|
+
# Description of the error.
|
97
|
+
attr_reader :message
|
98
|
+
|
99
|
+
def initialize(errorData)
|
100
|
+
@fieldName = errorData['field']
|
101
|
+
@errorCode = errorData['code']
|
102
|
+
@message = errorData['message']
|
103
|
+
end
|
104
|
+
|
105
|
+
# Returns string representation of the error.
|
106
|
+
def to_s()
|
107
|
+
return "Field error: #{@fieldName} \"#{@message}\" (#{@errorCode})"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# List of field errors associatied with this error (empty if there are no field errors).
|
112
|
+
attr_reader :fieldErrors
|
113
|
+
|
114
|
+
alias :super_describe :describe
|
115
|
+
|
116
|
+
def initialize(message, status, errorData)
|
117
|
+
|
118
|
+
super(message, status, errorData)
|
119
|
+
|
120
|
+
@fieldErrors = []
|
121
|
+
if errorData.has_key?('error')
|
122
|
+
error = errorData['error']
|
123
|
+
if error.has_key?('fieldErrors')
|
124
|
+
fieldErrors = error['fieldErrors']
|
125
|
+
fieldErrors.each do |fieldError|
|
126
|
+
@fieldErrors << FieldError.new(fieldError)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Returns boolean indicating if there are field errors associated with this API error.
|
133
|
+
def hasFieldErrors?
|
134
|
+
return @fieldErrors.length > 1
|
135
|
+
end
|
136
|
+
|
137
|
+
# Returns a string description of the error including any field errors.
|
138
|
+
def describe()
|
139
|
+
s = super_describe()
|
140
|
+
@fieldErrors.each do |fieldError|
|
141
|
+
s = s + "\n" + fieldError.to_s
|
142
|
+
end
|
143
|
+
return s + "\n"
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
# Exception representing a object not found for an API request.
|
149
|
+
class ObjectNotFoundException < ApiException
|
150
|
+
end
|
151
|
+
|
152
|
+
# Exception representing an invalid operation request.
|
153
|
+
class NotAllowedException < ApiException
|
154
|
+
end
|
155
|
+
|
156
|
+
# Exception representing a system error during processing of an API request.
|
157
|
+
class SystemException < ApiException
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013, MasterCard International Incorporated
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification, are
|
6
|
+
# permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list of
|
9
|
+
# conditions and the following disclaimer.
|
10
|
+
# Redistributions in binary form must reproduce the above copyright notice, this list of
|
11
|
+
# conditions and the following disclaimer in the documentation and/or other materials
|
12
|
+
# provided with the distribution.
|
13
|
+
# Neither the name of the MasterCard International Incorporated nor the names of its
|
14
|
+
# contributors may be used to endorse or promote products derived from this software
|
15
|
+
# without specific prior written permission.
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
17
|
+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
19
|
+
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
21
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
22
|
+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
23
|
+
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
24
|
+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
# SUCH DAMAGE.
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'simplify/paymentsapi'
|
29
|
+
|
30
|
+
module Simplify
|
31
|
+
|
32
|
+
# A CardToken object.
|
33
|
+
#
|
34
|
+
class CardToken < Hash
|
35
|
+
|
36
|
+
# Public key used to access the API.
|
37
|
+
attr_accessor :public_key
|
38
|
+
|
39
|
+
# Private key used to access the API.
|
40
|
+
attr_accessor :private_key
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
# Creates an CardToken object
|
45
|
+
#
|
46
|
+
# parms:: a hash of parameters; valid keys are:
|
47
|
+
# * <code>callback</code> The URL callback for the cardtoken
|
48
|
+
# * <code>card => addressCity</code> City of the cardholder.
|
49
|
+
# * <code>card => addressCountry</code> Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
|
50
|
+
# * <code>card => addressLine1</code> Address of the cardholder.
|
51
|
+
# * <code>card => addressLine2</code> Address of the cardholder if needed.
|
52
|
+
# * <code>card => addressState</code> State code (USPS code) of residence of the cardholder.
|
53
|
+
# * <code>card => addressZip</code> Postal code of the cardholder.
|
54
|
+
# * <code>card => cvc</code> CVC security code of the card. This is the code on the back of the card. Example: 123
|
55
|
+
# * <code>card => expMonth</code> Expiration month of the card. Format is MM. Example: January = 01 <b>required </b>
|
56
|
+
# * <code>card => expYear</code> Expiration year of the card. Format is YY. Example: 2013 = 13 <b>required </b>
|
57
|
+
# * <code>card => name</code> Name as appears on the card.
|
58
|
+
# * <code>card => number</code> Card number as it appears on the card. <b>required </b>
|
59
|
+
# * <code>key</code> Key used to create the card token.
|
60
|
+
# public_key:: Public to use for the API call. If nil, the value of Simplify::public_key will be used.
|
61
|
+
# private_key:: Private key to use for the API call. If nil, the value of Simplify::private_key will be used.
|
62
|
+
# Returns a CardToken object.
|
63
|
+
def self.create(parms, public_key = nil, private_key = nil)
|
64
|
+
if public_key == nil then
|
65
|
+
public_key = Simplify::public_key
|
66
|
+
end
|
67
|
+
if private_key == nil then
|
68
|
+
private_key = Simplify::private_key
|
69
|
+
end
|
70
|
+
|
71
|
+
h = Simplify::PaymentsApi.execute("cardToken", 'create', parms, public_key, private_key)
|
72
|
+
obj = CardToken.new()
|
73
|
+
obj.public_key = public_key
|
74
|
+
obj.private_key = private_key
|
75
|
+
obj = obj.merge(h)
|
76
|
+
obj
|
77
|
+
end
|
78
|
+
|
79
|
+
# Retrieve a CardToken object from the API
|
80
|
+
#
|
81
|
+
# id:: ID of object to retrieve
|
82
|
+
# public_key:: Public to use for the API call. If nil, the value of Simplify::public_key will be used.
|
83
|
+
# private_key:: Private key to use for the API call. If nil, the value of Simplify::private_key will be used.
|
84
|
+
# Returns a CardToken object.
|
85
|
+
def self.find(id, public_key = nil, private_key = nil)
|
86
|
+
if public_key == nil then
|
87
|
+
public_key = Simplify::public_key
|
88
|
+
end
|
89
|
+
if private_key == nil then
|
90
|
+
private_key = Simplify::private_key
|
91
|
+
end
|
92
|
+
|
93
|
+
h = Simplify::PaymentsApi.execute("cardToken", 'show', {"id" => id}, public_key, private_key)
|
94
|
+
obj = CardToken.new()
|
95
|
+
obj.public_key = public_key
|
96
|
+
obj.private_key = private_key
|
97
|
+
obj = obj.merge(h)
|
98
|
+
obj
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013, MasterCard International Incorporated
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification, are
|
6
|
+
# permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list of
|
9
|
+
# conditions and the following disclaimer.
|
10
|
+
# Redistributions in binary form must reproduce the above copyright notice, this list of
|
11
|
+
# conditions and the following disclaimer in the documentation and/or other materials
|
12
|
+
# provided with the distribution.
|
13
|
+
# Neither the name of the MasterCard International Incorporated nor the names of its
|
14
|
+
# contributors may be used to endorse or promote products derived from this software
|
15
|
+
# without specific prior written permission.
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
17
|
+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
19
|
+
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
21
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
22
|
+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
23
|
+
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
24
|
+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
# SUCH DAMAGE.
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'simplify/paymentsapi'
|
29
|
+
|
30
|
+
module Simplify
|
31
|
+
|
32
|
+
# A Chargeback object.
|
33
|
+
#
|
34
|
+
class Chargeback < Hash
|
35
|
+
|
36
|
+
# Public key used to access the API.
|
37
|
+
attr_accessor :public_key
|
38
|
+
|
39
|
+
# Private key used to access the API.
|
40
|
+
attr_accessor :private_key
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
# Retrieve Chargeback objects.
|
45
|
+
# criteria:: a hash of parameters; valid keys are:
|
46
|
+
# * <code>filter</code> Filters to apply to the list.
|
47
|
+
# * <code>max</code> Allows up to a max of 50 list items to return. <b>default:20</b>
|
48
|
+
# * <code>offset</code> Used in paging of the list. This is the start offset of the page. <b>default:0</b>
|
49
|
+
# * <code>sorting</code> Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending). Sortable properties are: <code> id</code><code> amount</code><code> description</code><code> dateCreated</code><code> paymentDate</code>.
|
50
|
+
# public_key:: Public to use for the API call. If nil, the value of Simplify::public_key will be used.
|
51
|
+
# private_key:: Private key to use for the API call. If nil, the value of Simplify::private_key will be used.
|
52
|
+
# Returns an object where the <code>list</code> property contains the list of Chargeback objects and the <code>total</code>
|
53
|
+
# property contains the total number of Chargeback objects available for the given criteria.
|
54
|
+
def self.list(criteria = nil, public_key = nil, private_key = nil)
|
55
|
+
|
56
|
+
if public_key == nil then
|
57
|
+
public_key = Simplify::public_key
|
58
|
+
end
|
59
|
+
if private_key == nil then
|
60
|
+
private_key = Simplify::private_key
|
61
|
+
end
|
62
|
+
|
63
|
+
h = Simplify::PaymentsApi.execute("chargeback", 'list', criteria, public_key, private_key)
|
64
|
+
obj = Chargeback.new()
|
65
|
+
obj.public_key = public_key
|
66
|
+
obj.private_key = private_key
|
67
|
+
obj = obj.merge(h)
|
68
|
+
obj
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
# Retrieve a Chargeback object from the API
|
73
|
+
#
|
74
|
+
# id:: ID of object to retrieve
|
75
|
+
# public_key:: Public to use for the API call. If nil, the value of Simplify::public_key will be used.
|
76
|
+
# private_key:: Private key to use for the API call. If nil, the value of Simplify::private_key will be used.
|
77
|
+
# Returns a Chargeback object.
|
78
|
+
def self.find(id, public_key = nil, private_key = nil)
|
79
|
+
if public_key == nil then
|
80
|
+
public_key = Simplify::public_key
|
81
|
+
end
|
82
|
+
if private_key == nil then
|
83
|
+
private_key = Simplify::private_key
|
84
|
+
end
|
85
|
+
|
86
|
+
h = Simplify::PaymentsApi.execute("chargeback", 'show', {"id" => id}, public_key, private_key)
|
87
|
+
obj = Chargeback.new()
|
88
|
+
obj.public_key = public_key
|
89
|
+
obj.private_key = private_key
|
90
|
+
obj = obj.merge(h)
|
91
|
+
obj
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013, MasterCard International Incorporated
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification, are
|
6
|
+
# permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list of
|
9
|
+
# conditions and the following disclaimer.
|
10
|
+
# Redistributions in binary form must reproduce the above copyright notice, this list of
|
11
|
+
# conditions and the following disclaimer in the documentation and/or other materials
|
12
|
+
# provided with the distribution.
|
13
|
+
# Neither the name of the MasterCard International Incorporated nor the names of its
|
14
|
+
# contributors may be used to endorse or promote products derived from this software
|
15
|
+
# without specific prior written permission.
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
17
|
+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
19
|
+
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
21
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
22
|
+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
23
|
+
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
24
|
+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
# SUCH DAMAGE.
|
26
|
+
#
|
27
|
+
|
28
|
+
module Simplify
|
29
|
+
|
30
|
+
# Constants.
|
31
|
+
class Constants
|
32
|
+
|
33
|
+
@@version = '1.0.0'
|
34
|
+
@@api_base_live_url = 'https://api.simplify.com/v1/api'
|
35
|
+
@@api_base_sandbox_url = 'https://sandbox.simplify.com/v1/api'
|
36
|
+
|
37
|
+
|
38
|
+
# Returns the base URL for the live API.
|
39
|
+
def self.api_base_live_url
|
40
|
+
@@api_base_live_url
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns the base URL for the sandbox API.
|
44
|
+
def self.api_base_sandbox_url
|
45
|
+
@@api_base_sandbox_url
|
46
|
+
end
|
47
|
+
|
48
|
+
# Returns the SDK version.
|
49
|
+
def self.version
|
50
|
+
@@version
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|