zip_money 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/README.md +128 -0
- data/Rakefile +8 -0
- data/docs/Address.md +15 -0
- data/docs/Authority.md +9 -0
- data/docs/CaptureChargeRequest.md +8 -0
- data/docs/Charge.md +17 -0
- data/docs/ChargeCollection.md +8 -0
- data/docs/ChargeOrder.md +11 -0
- data/docs/ChargesApi.md +307 -0
- data/docs/Checkout.md +18 -0
- data/docs/CheckoutConfiguration.md +8 -0
- data/docs/CheckoutFeatures.md +8 -0
- data/docs/CheckoutFeaturesTokenisation.md +8 -0
- data/docs/CheckoutOrder.md +13 -0
- data/docs/CheckoutsApi.md +119 -0
- data/docs/CreateChargeRequest.md +14 -0
- data/docs/CreateCheckoutRequest.md +13 -0
- data/docs/CreateCheckoutRequestFeatures.md +8 -0
- data/docs/CreateCheckoutRequestFeaturesTokenisation.md +8 -0
- data/docs/CreateRefundRequest.md +11 -0
- data/docs/CreateTokenRequest.md +8 -0
- data/docs/Customer.md +15 -0
- data/docs/CustomersApi.md +96 -0
- data/docs/ErrorResponse.md +8 -0
- data/docs/ErrorResponseError.md +10 -0
- data/docs/ErrorResponseErrorDetails.md +9 -0
- data/docs/InlineResponse200.md +8 -0
- data/docs/Metadata.md +7 -0
- data/docs/OrderItem.md +16 -0
- data/docs/OrderShipping.md +10 -0
- data/docs/OrderShippingTracking.md +10 -0
- data/docs/Refund.md +13 -0
- data/docs/RefundsApi.md +181 -0
- data/docs/SettlementsApi.md +96 -0
- data/docs/Shopper.md +17 -0
- data/docs/ShopperStatistics.md +16 -0
- data/docs/Token.md +11 -0
- data/docs/TokensApi.md +66 -0
- data/lib/zip_money.rb +68 -0
- data/lib/zip_money/api/charges_api.rb +301 -0
- data/lib/zip_money/api/checkouts_api.rb +120 -0
- data/lib/zip_money/api/customers_api.rb +116 -0
- data/lib/zip_money/api/refunds_api.rb +181 -0
- data/lib/zip_money/api/settlements_api.rb +116 -0
- data/lib/zip_money/api/tokens_api.rb +70 -0
- data/lib/zip_money/api_client.rb +386 -0
- data/lib/zip_money/api_error.rb +31 -0
- data/lib/zip_money/configuration.rb +238 -0
- data/lib/zip_money/models/address.rb +413 -0
- data/lib/zip_money/models/authority.rb +235 -0
- data/lib/zip_money/models/capture_charge_request.rb +206 -0
- data/lib/zip_money/models/charge.rb +369 -0
- data/lib/zip_money/models/charge_collection.rb +188 -0
- data/lib/zip_money/models/charge_order.rb +250 -0
- data/lib/zip_money/models/checkout.rb +344 -0
- data/lib/zip_money/models/checkout_configuration.rb +187 -0
- data/lib/zip_money/models/checkout_features.rb +181 -0
- data/lib/zip_money/models/checkout_features_tokenisation.rb +184 -0
- data/lib/zip_money/models/checkout_order.rb +299 -0
- data/lib/zip_money/models/create_charge_request.rb +289 -0
- data/lib/zip_money/models/create_checkout_request.rb +272 -0
- data/lib/zip_money/models/create_checkout_request_features.rb +181 -0
- data/lib/zip_money/models/create_checkout_request_features_tokenisation.rb +189 -0
- data/lib/zip_money/models/create_refund_request.rb +246 -0
- data/lib/zip_money/models/create_token_request.rb +186 -0
- data/lib/zip_money/models/customer.rb +310 -0
- data/lib/zip_money/models/error_response.rb +181 -0
- data/lib/zip_money/models/error_response_error.rb +211 -0
- data/lib/zip_money/models/error_response_error_details.rb +190 -0
- data/lib/zip_money/models/inline_response_200.rb +188 -0
- data/lib/zip_money/models/metadata.rb +172 -0
- data/lib/zip_money/models/order_item.rb +333 -0
- data/lib/zip_money/models/order_shipping.rb +200 -0
- data/lib/zip_money/models/order_shipping_tracking.rb +247 -0
- data/lib/zip_money/models/refund.rb +252 -0
- data/lib/zip_money/models/shopper.rb +339 -0
- data/lib/zip_money/models/shopper_statistics.rb +295 -0
- data/lib/zip_money/models/token.rb +228 -0
- data/lib/zip_money/version.rb +8 -0
- data/spec/api/charges_api_spec.rb +114 -0
- data/spec/api/checkouts_api_spec.rb +54 -0
- data/spec/api/customers_api_spec.rb +51 -0
- data/spec/api/refunds_api_spec.rb +67 -0
- data/spec/api/settlements_api_spec.rb +51 -0
- data/spec/api/tokens_api_spec.rb +41 -0
- data/spec/api_client_spec.rb +219 -0
- data/spec/configuration_spec.rb +50 -0
- data/spec/models/address_spec.rb +77 -0
- data/spec/models/authority_spec.rb +45 -0
- data/spec/models/capture_charge_request_spec.rb +35 -0
- data/spec/models/charge_collection_spec.rb +35 -0
- data/spec/models/charge_order_spec.rb +53 -0
- data/spec/models/charge_spec.rb +93 -0
- data/spec/models/checkout_configuration_spec.rb +35 -0
- data/spec/models/checkout_features_spec.rb +35 -0
- data/spec/models/checkout_features_tokenisation_spec.rb +35 -0
- data/spec/models/checkout_order_spec.rb +65 -0
- data/spec/models/checkout_spec.rb +103 -0
- data/spec/models/create_charge_request_spec.rb +75 -0
- data/spec/models/create_checkout_request_features_spec.rb +35 -0
- data/spec/models/create_checkout_request_features_tokenisation_spec.rb +35 -0
- data/spec/models/create_checkout_request_spec.rb +69 -0
- data/spec/models/create_refund_request_spec.rb +53 -0
- data/spec/models/create_token_request_spec.rb +35 -0
- data/spec/models/customer_spec.rb +81 -0
- data/spec/models/error_response_error_details_spec.rb +41 -0
- data/spec/models/error_response_error_spec.rb +47 -0
- data/spec/models/error_response_spec.rb +35 -0
- data/spec/models/inline_response_200_spec.rb +35 -0
- data/spec/models/metadata_spec.rb +29 -0
- data/spec/models/order_item_spec.rb +87 -0
- data/spec/models/order_shipping_spec.rb +47 -0
- data/spec/models/order_shipping_tracking_spec.rb +47 -0
- data/spec/models/refund_spec.rb +65 -0
- data/spec/models/shopper_spec.rb +92 -0
- data/spec/models/shopper_statistics_spec.rb +86 -0
- data/spec/models/token_spec.rb +52 -0
- data/spec/payload_helper.rb +96 -0
- data/spec/spec_helper.rb +104 -0
- data/zip_money.gemspec +38 -0
- metadata +380 -0
@@ -0,0 +1,228 @@
|
|
1
|
+
#Merchant API
|
2
|
+
#ZipMoney Merchant API Initial build
|
3
|
+
#zipMoney Merchant API version: 2017-03-01
|
4
|
+
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
|
8
|
+
module ZipMoney
|
9
|
+
|
10
|
+
class Token
|
11
|
+
attr_accessor :id
|
12
|
+
|
13
|
+
attr_accessor :value
|
14
|
+
|
15
|
+
attr_accessor :active
|
16
|
+
|
17
|
+
attr_accessor :created_date
|
18
|
+
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'id' => :'id',
|
24
|
+
:'value' => :'value',
|
25
|
+
:'active' => :'active',
|
26
|
+
:'created_date' => :'created_date'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.zip_types
|
32
|
+
{
|
33
|
+
:'id' => :'String',
|
34
|
+
:'value' => :'String',
|
35
|
+
:'active' => :'BOOLEAN',
|
36
|
+
:'created_date' => :'DateTime'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
|
+
def initialize(attributes = {})
|
43
|
+
return unless attributes.is_a?(Hash)
|
44
|
+
|
45
|
+
# convert string to symbol for hash key
|
46
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
47
|
+
|
48
|
+
if attributes.has_key?(:'id')
|
49
|
+
self.id = attributes[:'id']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.has_key?(:'value')
|
53
|
+
self.value = attributes[:'value']
|
54
|
+
end
|
55
|
+
|
56
|
+
if attributes.has_key?(:'active')
|
57
|
+
self.active = attributes[:'active']
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.has_key?(:'created_date')
|
61
|
+
self.created_date = attributes[:'created_date']
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
+
# @return Array for valid properies with the reasons
|
68
|
+
def list_invalid_properties
|
69
|
+
invalid_properties = Array.new
|
70
|
+
if @id.nil?
|
71
|
+
invalid_properties.push("invalid value for 'id', id cannot be nil.")
|
72
|
+
end
|
73
|
+
|
74
|
+
if @value.nil?
|
75
|
+
invalid_properties.push("invalid value for 'value', value cannot be nil.")
|
76
|
+
end
|
77
|
+
|
78
|
+
if @active.nil?
|
79
|
+
invalid_properties.push("invalid value for 'active', active cannot be nil.")
|
80
|
+
end
|
81
|
+
|
82
|
+
if @created_date.nil?
|
83
|
+
invalid_properties.push("invalid value for 'created_date', created_date cannot be nil.")
|
84
|
+
end
|
85
|
+
|
86
|
+
return invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
return false if @id.nil?
|
93
|
+
return false if @value.nil?
|
94
|
+
return false if @active.nil?
|
95
|
+
return false if @created_date.nil?
|
96
|
+
return true
|
97
|
+
end
|
98
|
+
|
99
|
+
# Checks equality by comparing each attribute.
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def ==(o)
|
102
|
+
return true if self.equal?(o)
|
103
|
+
self.class == o.class &&
|
104
|
+
id == o.id &&
|
105
|
+
value == o.value &&
|
106
|
+
active == o.active &&
|
107
|
+
created_date == o.created_date
|
108
|
+
end
|
109
|
+
|
110
|
+
# @see the `==` method
|
111
|
+
# @param [Object] Object to be compared
|
112
|
+
def eql?(o)
|
113
|
+
self == o
|
114
|
+
end
|
115
|
+
|
116
|
+
# Calculates hash code according to all attributes.
|
117
|
+
# @return [Fixnum] Hash code
|
118
|
+
def hash
|
119
|
+
[id, value, active, created_date].hash
|
120
|
+
end
|
121
|
+
|
122
|
+
# Builds the object from hash
|
123
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
124
|
+
# @return [Object] Returns the model itself
|
125
|
+
def build_from_hash(attributes)
|
126
|
+
return nil unless attributes.is_a?(Hash)
|
127
|
+
self.class.zip_types.each_pair do |key, type|
|
128
|
+
if type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
132
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
133
|
+
end
|
134
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
135
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
136
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
137
|
+
end
|
138
|
+
|
139
|
+
self
|
140
|
+
end
|
141
|
+
|
142
|
+
# Deserializes the data based on type
|
143
|
+
# @param string type Data type
|
144
|
+
# @param string value Value to be deserialized
|
145
|
+
# @return [Object] Deserialized data
|
146
|
+
def _deserialize(type, value)
|
147
|
+
case type.to_sym
|
148
|
+
when :DateTime
|
149
|
+
DateTime.parse(value)
|
150
|
+
when :Date
|
151
|
+
Date.parse(value)
|
152
|
+
when :String
|
153
|
+
value.to_s
|
154
|
+
when :Integer
|
155
|
+
value.to_i
|
156
|
+
when :Float
|
157
|
+
value.to_f
|
158
|
+
when :BOOLEAN
|
159
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
160
|
+
true
|
161
|
+
else
|
162
|
+
false
|
163
|
+
end
|
164
|
+
when :Object
|
165
|
+
# generic object (usually a Hash), return directly
|
166
|
+
value
|
167
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
168
|
+
inner_type = Regexp.last_match[:inner_type]
|
169
|
+
value.map { |v| _deserialize(inner_type, v) }
|
170
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
171
|
+
k_type = Regexp.last_match[:k_type]
|
172
|
+
v_type = Regexp.last_match[:v_type]
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each do |k, v|
|
175
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
else # model
|
179
|
+
temp_model = ZipMoney.const_get(type).new
|
180
|
+
temp_model.build_from_hash(value)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the string representation of the object
|
185
|
+
# @return [String] String presentation of the object
|
186
|
+
def to_s
|
187
|
+
to_hash.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_body
|
193
|
+
to_hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns the object in the form of hash
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_hash
|
199
|
+
hash = {}
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
201
|
+
value = self.send(attr)
|
202
|
+
next if value.nil?
|
203
|
+
hash[param] = _to_hash(value)
|
204
|
+
end
|
205
|
+
hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Outputs non-array value in the form of hash
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
210
|
+
# @param [Object] value Any valid value
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
212
|
+
def _to_hash(value)
|
213
|
+
if value.is_a?(Array)
|
214
|
+
value.compact.map{ |v| _to_hash(v) }
|
215
|
+
elsif value.is_a?(Hash)
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
218
|
+
end
|
219
|
+
elsif value.respond_to? :to_hash
|
220
|
+
value.to_hash
|
221
|
+
else
|
222
|
+
value
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#Merchant API
|
2
|
+
#ZipMoney Merchant API Initial build
|
3
|
+
#zipMoney Merchant API version: 2017-03-01
|
4
|
+
|
5
|
+
|
6
|
+
require 'spec_helper'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
# Unit tests for ZipMoney::ChargesApi
|
10
|
+
# Please update as you see appropriate
|
11
|
+
describe 'ChargesApi' do
|
12
|
+
before do
|
13
|
+
auth = JSON.parse(File.read('./spec/auth.json'))
|
14
|
+
|
15
|
+
ZipMoney.configure do |c|
|
16
|
+
c.environment = :sandbox;
|
17
|
+
c.host = "api.sandbox.zipmoney.com.au"
|
18
|
+
c.api_key['Authorization'] = auth["api_key"];
|
19
|
+
c.api_key_prefix['Authorization'] = "Bearer";
|
20
|
+
#c.debugging = true;
|
21
|
+
end
|
22
|
+
@instance = ZipMoney::ChargesApi.new
|
23
|
+
@payload_helper = ZipMoney::PayloadHelper.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of ChargesApi' do
|
31
|
+
it 'should create an instact of ChargesApi' do
|
32
|
+
expect(@instance).to be_instance_of(ZipMoney::ChargesApi)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# unit tests for charges_cancel
|
37
|
+
# Cancel a charge
|
38
|
+
# Cancels an authorised charge. | Error code | Description | |------------------------------------|--------------------------------------------------------------------------------------------------| | invalid_state | The charge is not in authorised state |
|
39
|
+
# @param id The id of the authorised charge
|
40
|
+
# @param [Hash] opts the optional parameters
|
41
|
+
# @option opts [String] :idempotency_key The unique idempotency key.
|
42
|
+
# @return [Charge]
|
43
|
+
describe 'charges_cancel test' do
|
44
|
+
it "should work" do
|
45
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# unit tests for charges_capture
|
50
|
+
# Capture a charge
|
51
|
+
# | Error code | Description | |------------------------------------|--------------------------------------------------------------------------------------------------| | amount_invalid | Capture amount greater than authorised amount | | invalid_state | The charge is not in authorised state |
|
52
|
+
# @param id The id of the authorised charge
|
53
|
+
# @param [Hash] opts the optional parameters
|
54
|
+
# @option opts [CaptureChargeRequest] :body
|
55
|
+
# @option opts [String] :idempotency_key The unique idempotency key.
|
56
|
+
# @return [Charge]
|
57
|
+
describe 'charges_capture test' do
|
58
|
+
it "should work" do
|
59
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# unit tests for charges_create
|
64
|
+
# Create a charge
|
65
|
+
# Creates a #model:ehEN48PET29iNdex3 which represents a charge against a customer's account. To execute this endpoint you must first obtain customer approval by implementing the #docTextSection:43C79g2JjeGs8AHWi as a part of your online store. This endpoint will return 201 if successful otherwise 402 with a specific error response. ## Capture or authorisation A charge can be created as either an authorisation or an immediate capture. This can be controlled in the initial request to the charge. In most cases you will want to immediately capture the payment, this will mark the debit for settlement into your account the very same day and will immediately deduct the funds from the customer's account. In some cases you may wish to delay the settlement of funds until a later date, perhaps until the goods are shipped to the customer. In this scenario you should send { capture: false } in the request to the #endpoint:dtmp3HxaHKjewvvGW endpoint and the charge will be created in an authorised state. An authorised charge will place a hold for the specified amount on the customer's account in the form of a pending debit. Once authorised you are guaranteed the funds are available and awaiting a capture request to the #endpoint:wReod3JtbzNutMSXj endpoint, at which point the charge will move to the captured state and the funds will be settled into your account. It is at this point the customer's interest free period will start if applicable for the selected account. ## Specific error responses If a charge was not able to be performed a \"402 - Request Failed\" status code will be returned as detailed in #docTextSection:fJYHM2ZKtEui8RrAM. The error object can contain more specific error reason codes, which are detailed below. | Error code | Description | |------------------------------------|--------------------------------------------------------------------------------------------------| | account_insufficient_funds | Customer does not have sufficient funds to perform the charge | | account_inoperative | The account is in arrears or closed and cannot be charged | | account_locked | The account is locked | | amount_invalid | The amount provided does not match the approved checkout amount | | fraud_check | Fraud checks resulted in payment failure |
|
66
|
+
# @param [Hash] opts the optional parameters
|
67
|
+
# @option opts [CreateChargeRequest] :body
|
68
|
+
# @option opts [String] :idempotency_key The unique idempotency key.
|
69
|
+
# @return [Charge]
|
70
|
+
describe 'charges_create test' do
|
71
|
+
it "should work" do
|
72
|
+
@checkoutapi = ZipMoney::CheckoutsApi.new
|
73
|
+
@payload = @payload_helper.checkout_request;
|
74
|
+
result = @checkoutapi.checkouts_create(@payload);
|
75
|
+
@payload = @payload_helper.charge_request;
|
76
|
+
#@payload[:idempotency_key] = 1111
|
77
|
+
@payload[:body].authority.value = result.id;
|
78
|
+
begin
|
79
|
+
result = @instance.charges_create(@payload);
|
80
|
+
rescue ZipMoney::ApiError => e
|
81
|
+
puts e.response_body
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# unit tests for charges_list
|
87
|
+
# List charges
|
88
|
+
# Lists all charges matching search criteria.
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @option opts [String] :state The state filter
|
91
|
+
# @option opts [Integer] :skip Number of items to skip when paging
|
92
|
+
# @option opts [Integer] :limit Number of items to retrieve when paging
|
93
|
+
# @option opts [String] :expand Allows expanding related entities in the response. Only valid entry is 'customer'
|
94
|
+
# @return [ChargeCollection]
|
95
|
+
describe 'charges_list test' do
|
96
|
+
it "should work" do
|
97
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# unit tests for charges_retrieve
|
102
|
+
# Retrieve a charge
|
103
|
+
# Retrieve details of a previously created charge.
|
104
|
+
# @param id The id of the charge
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @option opts [String] :expand Allows expanding related entities in the response. Only valid entry is 'customer'
|
107
|
+
# @return [Charge]
|
108
|
+
describe 'charges_retrieve test' do
|
109
|
+
it "should work" do
|
110
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#Merchant API
|
2
|
+
#ZipMoney Merchant API Initial build
|
3
|
+
#zipMoney Merchant API version: 2017-03-01
|
4
|
+
|
5
|
+
|
6
|
+
require 'spec_helper'
|
7
|
+
require 'payload_helper'
|
8
|
+
require 'json'
|
9
|
+
|
10
|
+
# Unit tests for ZipMoney::CheckoutsApi
|
11
|
+
|
12
|
+
# Please update as you see appropriate
|
13
|
+
describe 'CheckoutsApi' do
|
14
|
+
before do
|
15
|
+
# run before each test
|
16
|
+
auth = JSON.parse(File.read('./spec/auth.json'))
|
17
|
+
|
18
|
+
ZipMoney.configure do |c|
|
19
|
+
c.environment = :sandbox;
|
20
|
+
c.api_key['Authorization'] = auth["api_key"];
|
21
|
+
c.api_key_prefix['Authorization'] = "Bearer";
|
22
|
+
end
|
23
|
+
|
24
|
+
@instance = ZipMoney::CheckoutsApi.new
|
25
|
+
@payload_helper = ZipMoney::PayloadHelper.new
|
26
|
+
end
|
27
|
+
|
28
|
+
after do
|
29
|
+
# run after each test
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'test an instance of CheckoutsApi' do
|
33
|
+
it 'should create an instact of CheckoutsApi' do
|
34
|
+
expect(@instance).to be_instance_of(ZipMoney::CheckoutsApi)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# unit tests for checkouts_create
|
39
|
+
# Create a checkout
|
40
|
+
# Creates a zipMoney checkout. During the checkout process a customer can apply for credit decisioning in real-time. This means the checkout needs to represent a good picture of known customer details along with order information and the checkout entity represents this as a resource. For more information on how to checkout with zipMoney see the #model:Z2QcrzRGHACY8wM6G guide.
|
41
|
+
# @param [Hash] opts the optional parameters
|
42
|
+
# @option opts [CreateCheckoutRequest] :body
|
43
|
+
# @return [Checkout]
|
44
|
+
# describe 'checkouts_create test' do
|
45
|
+
# it "should work" do
|
46
|
+
# @payload = @payload_helper.checkout_request;
|
47
|
+
|
48
|
+
# result = @instance.checkouts_create(@payload);
|
49
|
+
|
50
|
+
# expect(result.uri.nil?).to eq false
|
51
|
+
# expect(result.id.nil?).to eq false
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#Merchant API
|
2
|
+
#ZipMoney Merchant API Initial build
|
3
|
+
#zipMoney Merchant API version: 2017-03-01
|
4
|
+
|
5
|
+
|
6
|
+
require 'spec_helper'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
# Unit tests for ZipMoney::CustomersApi
|
10
|
+
|
11
|
+
# Please update as you see appropriate
|
12
|
+
describe 'CustomersApi' do
|
13
|
+
before do
|
14
|
+
# run before each test
|
15
|
+
@instance = ZipMoney::CustomersApi.new
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
# run after each test
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'test an instance of CustomersApi' do
|
23
|
+
it 'should create an instact of CustomersApi' do
|
24
|
+
expect(@instance).to be_instance_of(ZipMoney::CustomersApi)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# unit tests for customers_get
|
29
|
+
# Retrieve customer
|
30
|
+
# Retrieves the details of a customer by id. This will only return customer details for customers who have transacted previously via the zip Merchant API.
|
31
|
+
# @param id
|
32
|
+
# @param [Hash] opts the optional parameters
|
33
|
+
# @return [nil]
|
34
|
+
describe 'customers_get test' do
|
35
|
+
it "should work" do
|
36
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# unit tests for customers_list
|
41
|
+
# List customers
|
42
|
+
# Returns a list of all customers who have transacted previously with your merchant account.
|
43
|
+
# @param [Hash] opts the optional parameters
|
44
|
+
# @return [nil]
|
45
|
+
describe 'customers_list test' do
|
46
|
+
it "should work" do
|
47
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|