fat_zebra 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -1
- data/fat_zebra.gemspec +4 -4
- data/lib/fat_zebra/api_helper.rb +95 -0
- data/lib/fat_zebra/api_operation/find.rb +18 -11
- data/lib/fat_zebra/api_operation/save.rb +2 -2
- data/lib/fat_zebra/api_operation/search.rb +19 -12
- data/lib/fat_zebra/api_operation/void.rb +1 -1
- data/lib/fat_zebra/api_resource.rb +7 -73
- data/lib/fat_zebra/bank_account.rb +1 -2
- data/lib/fat_zebra/batch.rb +5 -3
- data/lib/fat_zebra/card.rb +5 -4
- data/lib/fat_zebra/config.rb +31 -18
- data/lib/fat_zebra/customer.rb +2 -3
- data/lib/fat_zebra/direct_credit.rb +2 -3
- data/lib/fat_zebra/direct_debit.rb +2 -3
- data/lib/fat_zebra/errors.rb +22 -4
- data/lib/fat_zebra/fat_zebra_object.rb +4 -115
- data/lib/fat_zebra/object_helper.rb +118 -0
- data/lib/fat_zebra/payment_plan.rb +1 -2
- data/lib/fat_zebra/purchase.rb +3 -6
- data/lib/fat_zebra/refund.rb +2 -4
- data/lib/fat_zebra/request.rb +12 -8
- data/lib/fat_zebra/util.rb +17 -1
- data/lib/fat_zebra/version.rb +1 -1
- data/lib/fat_zebra/web_hook.rb +1 -2
- data/lib/fat_zebra.rb +2 -0
- data/spec/cassettes/FatZebra_BankAccount/_create/1_1_3.yml +55 -0
- data/spec/cassettes/FatZebra_Batch/_create/with_file/1_1_1_3.yml +65 -0
- data/spec/cassettes/FatZebra_Batch/_create/with_path/1_1_2_3.yml +65 -0
- data/spec/cassettes/FatZebra_Batch/_find/1_2_3.yml +118 -0
- data/spec/cassettes/FatZebra_Card/_create/1_1_7.yml +55 -0
- data/spec/cassettes/FatZebra_Card/_update/1_2_4.yml +105 -0
- data/spec/cassettes/FatZebra_Card/_update/validations/1_2_5_1.yml +55 -0
- data/spec/cassettes/FatZebra_Customer/_create/1_1_7.yml +57 -0
- data/spec/cassettes/FatZebra_Customer/_delete/1_5_2.yml +107 -0
- data/spec/cassettes/FatZebra_Customer/_find/1_3_3.yml +111 -0
- data/spec/cassettes/FatZebra_Customer/_update/1_4_3.yml +108 -0
- data/spec/cassettes/FatZebra_DirectCredit/_create/1_1_5.yml +54 -0
- data/spec/cassettes/FatZebra_DirectCredit/_delete/1_4_2.yml +103 -0
- data/spec/cassettes/FatZebra_DirectCredit/_find/1_2_3.yml +107 -0
- data/spec/cassettes/FatZebra_DirectDebit/_create/1_1_5.yml +54 -0
- data/spec/cassettes/FatZebra_DirectDebit/_delete/1_4_2.yml +103 -0
- data/spec/cassettes/FatZebra_DirectDebit/_find/1_2_3.yml +107 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_create/1_1_4.yml +114 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_delete/1_5_2.yml +164 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_find/1_2_4.yml +173 -0
- data/spec/cassettes/FatZebra_PaymentPlan/_update/1_3_4.yml +164 -0
- data/spec/cassettes/FatZebra_Purchase/_capture/1_5_3.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_capture/1_6_3.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_create/1_1_13.yml +55 -0
- data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_1.yml +57 -0
- data/spec/cassettes/FatZebra_Purchase/_create/bad_request/1_1_14_2.yml +57 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_2_4.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_3_1.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_3_2.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_3_3.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_find/1_3_4.yml +109 -0
- data/spec/cassettes/FatZebra_Purchase/_refund/1_4_3.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_refund/1_5_3.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_3_4.yml +170 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_4_1.yml +170 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_4_2.yml +170 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_4_3.yml +170 -0
- data/spec/cassettes/FatZebra_Purchase/_search/1_4_4.yml +170 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_8_4.yml +842 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_9_1.yml +828 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_9_2.yml +830 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_9_3.yml +832 -0
- data/spec/cassettes/FatZebra_Purchase/_settlement/1_9_4.yml +834 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_6_4.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_7_4.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_8_1.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_8_2.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_8_3.yml +107 -0
- data/spec/cassettes/FatZebra_Purchase/_void/1_8_4.yml +107 -0
- data/spec/cassettes/FatZebra_Refund/_create/1_1_10.yml +107 -0
- data/spec/cassettes/FatZebra_Refund/_find/1_2_3.yml +161 -0
- data/spec/cassettes/FatZebra_Refund/_void/1_4_4.yml +159 -0
- data/spec/cassettes/FatZebra_WebHook/_create/1_1_4.yml +55 -0
- data/spec/cassettes/FatZebra_WebHook/_delete/1_4_2.yml +105 -0
- data/spec/cassettes/FatZebra_WebHook/_update/1_3_3.yml +106 -0
- data/spec/lib/fat_zebra/bank_account_spec.rb +2 -2
- data/spec/lib/fat_zebra/batch_spec.rb +4 -4
- data/spec/lib/fat_zebra/card_spec.rb +2 -2
- data/spec/lib/fat_zebra/config_spec.rb +22 -4
- data/spec/lib/fat_zebra/customer_spec.rb +5 -5
- data/spec/lib/fat_zebra/direct_credit_spec.rb +4 -4
- data/spec/lib/fat_zebra/direct_debit_spec.rb +4 -4
- data/spec/lib/fat_zebra/fat_zebra_object_spec.rb +3 -2
- data/spec/lib/fat_zebra/payment_plan_spec.rb +4 -4
- data/spec/lib/fat_zebra/purchase_spec.rb +16 -3
- data/spec/lib/fat_zebra/refund_spec.rb +5 -2
- data/spec/lib/fat_zebra/util_spec.rb +5 -0
- data/spec/lib/fat_zebra/web_hook_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- metadata +76 -19
@@ -4,20 +4,11 @@ module FatZebra
|
|
4
4
|
#
|
5
5
|
# Define the API objects
|
6
6
|
class FatZebraObject
|
7
|
+
include ObjectHelper
|
7
8
|
extend Validation
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
attr_reader :raw
|
12
|
-
|
13
|
-
##
|
14
|
-
# @return [Hash] JSON parsed response
|
15
|
-
attr_reader :data
|
16
|
-
|
17
|
-
attr_reader :successful
|
18
|
-
alias successful? successful
|
19
|
-
|
20
|
-
attr_reader :errors
|
10
|
+
attr_reader :accepted
|
11
|
+
alias accepted? accepted
|
21
12
|
|
22
13
|
class << self
|
23
14
|
|
@@ -45,17 +36,6 @@ module FatZebra
|
|
45
36
|
|
46
37
|
end
|
47
38
|
|
48
|
-
##
|
49
|
-
# Initialize and create accessor for values
|
50
|
-
#
|
51
|
-
# @params [Hash] values
|
52
|
-
def initialize(values = {})
|
53
|
-
@data = []
|
54
|
-
@values = {}
|
55
|
-
|
56
|
-
update_attributes(values)
|
57
|
-
end
|
58
|
-
|
59
39
|
##
|
60
40
|
# Update the object based on the response from the API
|
61
41
|
# Remove and new acessor
|
@@ -74,106 +54,15 @@ module FatZebra
|
|
74
54
|
self
|
75
55
|
end
|
76
56
|
|
77
|
-
##
|
78
|
-
# get attribute value
|
79
|
-
def [](key)
|
80
|
-
@values[key.to_sym]
|
81
|
-
end
|
82
|
-
|
83
|
-
##
|
84
|
-
# set attribute value
|
85
|
-
def []=(key, value)
|
86
|
-
send(:"#{key}=", value)
|
87
|
-
end
|
88
|
-
|
89
|
-
##
|
90
|
-
# @return [Array] all the keys
|
91
|
-
def keys
|
92
|
-
@values.keys
|
93
|
-
end
|
94
|
-
|
95
|
-
##
|
96
|
-
# @return [Hash] values to hash
|
97
|
-
def to_hash
|
98
|
-
@values
|
99
|
-
end
|
100
|
-
|
101
|
-
##
|
102
|
-
# @return [JSON] values to JSON
|
103
|
-
def to_json
|
104
|
-
JSON.generate(@values)
|
105
|
-
end
|
106
|
-
|
107
|
-
##
|
108
|
-
# Update the attribute and add accessor for new attributes
|
109
|
-
#
|
110
|
-
# @param [Hash] values
|
111
|
-
def update_attributes(attributes)
|
112
|
-
attributes.each do |(key, value)|
|
113
|
-
add_accessor(key, value)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
57
|
##
|
118
58
|
# Load the root components for the API response
|
119
59
|
#
|
120
60
|
# @param [Hash] values
|
121
61
|
def load_response_api(response)
|
122
62
|
@raw = response
|
123
|
-
@
|
63
|
+
@accepted = response['successful']
|
124
64
|
@errors = response['errors']
|
125
65
|
end
|
126
66
|
|
127
|
-
##
|
128
|
-
# Add data for sub-object
|
129
|
-
#
|
130
|
-
# @param [Object] data
|
131
|
-
def add_data(data)
|
132
|
-
@data << data
|
133
|
-
end
|
134
|
-
|
135
|
-
protected
|
136
|
-
|
137
|
-
def inspect
|
138
|
-
id_string = respond_to?(:id) && !id.nil? ? " id=#{id}" : ''
|
139
|
-
"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(@values)
|
140
|
-
end
|
141
|
-
|
142
|
-
def method_missing(name, *args)
|
143
|
-
super unless name.to_s.end_with?('=')
|
144
|
-
|
145
|
-
attribute = name.to_s[0...-1].to_sym
|
146
|
-
value = args.first
|
147
|
-
|
148
|
-
add_accessor(attribute, value)
|
149
|
-
end
|
150
|
-
|
151
|
-
private
|
152
|
-
|
153
|
-
def add_accessors(keys, payload = raw)
|
154
|
-
keys.each do |key|
|
155
|
-
add_accessor(key, payload[key])
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def add_accessor(name, value)
|
160
|
-
@values[name] = value
|
161
|
-
|
162
|
-
define_singleton_method(name) { @values[name] }
|
163
|
-
define_singleton_method(:"#{name}=") do |v|
|
164
|
-
@values[name] = v
|
165
|
-
end
|
166
|
-
|
167
|
-
define_singleton_method(:"#{name}?") { value } if [FalseClass, TrueClass].include?(value.class)
|
168
|
-
end
|
169
|
-
|
170
|
-
def remove_accessor(name)
|
171
|
-
@values.delete(name)
|
172
|
-
|
173
|
-
singleton_class.class_eval { remove_method name.to_sym } if singleton_methods.include?(name.to_sym)
|
174
|
-
singleton_class.class_eval { remove_method "#{name}=".to_sym } if singleton_methods.include?("#{name}=".to_sym)
|
175
|
-
singleton_class.class_eval { remove_method "#{name}?".to_sym } if singleton_methods.include?("#{name}?".to_sym)
|
176
|
-
end
|
177
|
-
|
178
67
|
end
|
179
68
|
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module FatZebra
|
2
|
+
##
|
3
|
+
# == Object \Helper
|
4
|
+
#
|
5
|
+
# API objects helper
|
6
|
+
module ObjectHelper
|
7
|
+
|
8
|
+
##
|
9
|
+
# @return [Hash] JSON parsed response
|
10
|
+
attr_reader :raw
|
11
|
+
|
12
|
+
##
|
13
|
+
# @return [Hash] JSON parsed response
|
14
|
+
attr_reader :data
|
15
|
+
|
16
|
+
attr_reader :errors
|
17
|
+
|
18
|
+
##
|
19
|
+
# Initialize and create accessor for values
|
20
|
+
#
|
21
|
+
# @params [Hash] values
|
22
|
+
def initialize(values = {})
|
23
|
+
@data = []
|
24
|
+
@values = {}
|
25
|
+
@errors = []
|
26
|
+
|
27
|
+
update_attributes(values)
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# get attribute value
|
32
|
+
def [](key)
|
33
|
+
@values[key.to_sym]
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# set attribute value
|
38
|
+
def []=(key, value)
|
39
|
+
send(:"#{key}=", value)
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# @return [Array] all the keys
|
44
|
+
def keys
|
45
|
+
@values.keys
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# @return [Hash] values to hash
|
50
|
+
def to_hash
|
51
|
+
@values
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# @return [JSON] values to JSON
|
56
|
+
def to_json(_object = nil)
|
57
|
+
JSON.generate(@values)
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Update the attribute and add accessor for new attributes
|
62
|
+
#
|
63
|
+
# @param [Hash] values
|
64
|
+
def update_attributes(attributes)
|
65
|
+
attributes.each do |(key, value)|
|
66
|
+
add_accessor(key, value)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Add data for sub-object
|
72
|
+
#
|
73
|
+
# @param [Object] data
|
74
|
+
def add_data(data)
|
75
|
+
@data << data
|
76
|
+
end
|
77
|
+
|
78
|
+
def inspect
|
79
|
+
id_string = respond_to?(:id) && !id.nil? ? " id=#{id}" : ''
|
80
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(@values)
|
81
|
+
end
|
82
|
+
|
83
|
+
def method_missing(name, *args)
|
84
|
+
super unless name.to_s.end_with?('=')
|
85
|
+
|
86
|
+
attribute = name.to_s[0...-1].to_sym
|
87
|
+
value = args.first
|
88
|
+
|
89
|
+
add_accessor(attribute, value)
|
90
|
+
end
|
91
|
+
|
92
|
+
def add_accessors(keys, payload = raw)
|
93
|
+
keys.each do |key|
|
94
|
+
add_accessor(key, payload[key])
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def add_accessor(name, value)
|
99
|
+
@values[name] = value
|
100
|
+
|
101
|
+
define_singleton_method(name) { @values[name] }
|
102
|
+
define_singleton_method(:"#{name}=") do |v|
|
103
|
+
@values[name] = v
|
104
|
+
end
|
105
|
+
|
106
|
+
define_singleton_method(:"#{name}?") { value } if [FalseClass, TrueClass].include?(value.class)
|
107
|
+
end
|
108
|
+
|
109
|
+
def remove_accessor(name)
|
110
|
+
@values.delete(name)
|
111
|
+
|
112
|
+
singleton_class.class_eval { remove_method name.to_sym } if singleton_methods.include?(name.to_sym)
|
113
|
+
singleton_class.class_eval { remove_method "#{name}=".to_sym } if singleton_methods.include?("#{name}=".to_sym)
|
114
|
+
singleton_class.class_eval { remove_method "#{name}?".to_sym } if singleton_methods.include?("#{name}?".to_sym)
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
end
|
data/lib/fat_zebra/purchase.rb
CHANGED
@@ -14,9 +14,8 @@ module FatZebra
|
|
14
14
|
#
|
15
15
|
class Purchase < APIResource
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
include FatZebra::APIOperation::Find
|
18
|
+
include FatZebra::APIOperation::Search
|
20
19
|
include FatZebra::APIOperation::Save
|
21
20
|
include FatZebra::APIOperation::Void
|
22
21
|
|
@@ -54,9 +53,7 @@ module FatZebra
|
|
54
53
|
#
|
55
54
|
# @return [FatZebra::Purchase]
|
56
55
|
def settlement(params = {}, options = {})
|
57
|
-
valid!(params, :settlement)
|
58
|
-
|
59
|
-
params = Util.format_dates_in_hash(params)
|
56
|
+
valid!(params, :settlement) if respond_to?(:valid!)
|
60
57
|
|
61
58
|
response = request(:get, "#{resource_path}/settlement", params, options)
|
62
59
|
initialize_from(response)
|
data/lib/fat_zebra/refund.rb
CHANGED
@@ -11,13 +11,11 @@ module FatZebra
|
|
11
11
|
#
|
12
12
|
class Refund < APIResource
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
include FatZebra::APIOperation::Find
|
15
|
+
include FatZebra::APIOperation::Search
|
17
16
|
include FatZebra::APIOperation::Save
|
18
17
|
include FatZebra::APIOperation::Void
|
19
18
|
|
20
|
-
validates :transaction_id, required: true, on: :create
|
21
19
|
validates :amount, required: true, on: :create
|
22
20
|
validates :reference, required: true, on: :create
|
23
21
|
|
data/lib/fat_zebra/request.rb
CHANGED
@@ -102,18 +102,20 @@ module FatZebra
|
|
102
102
|
response = http.request(request)
|
103
103
|
|
104
104
|
case [response.code_type]
|
105
|
-
when [Net::
|
106
|
-
|
105
|
+
when [Net::HTTPOK], [Net::HTTPCreated], [Net::HTTPAccepted]
|
106
|
+
response
|
107
107
|
when [Net::HTTPUnauthorized]
|
108
|
-
raise RequestError, 'Unauthorized, please check your username
|
108
|
+
raise RequestError.new(response, message: 'Unauthorized, please check your authentication username or token')
|
109
109
|
when [Net::HTTPNotFound]
|
110
|
-
raise RequestError, 'Requested Resource not found'
|
110
|
+
raise RequestError.new(response, message: 'Requested Resource not found')
|
111
|
+
when [Net::HTTPRequestTimeOut]
|
112
|
+
raise RequestError.new(response, message: 'Verify the address for the service')
|
111
113
|
when [Net::HTTPInternalServerError]
|
112
|
-
raise RequestError, 'Server Error, please check with
|
114
|
+
raise RequestError.new(response, message: 'Server Error, please check with service')
|
113
115
|
when [Net::HTTPNotImplemented]
|
114
|
-
raise RequestError, 'Problem processing your request - please check your data'
|
116
|
+
raise RequestError.new(response, message: 'Problem processing your request - please check your data')
|
115
117
|
else
|
116
|
-
response
|
118
|
+
raise RequestError, response
|
117
119
|
end
|
118
120
|
end
|
119
121
|
|
@@ -135,7 +137,9 @@ module FatZebra
|
|
135
137
|
|
136
138
|
def set_header
|
137
139
|
params[:headers].each do |(type, value)|
|
138
|
-
|
140
|
+
formated_type = type.to_s.split(/_/).map(&:capitalize).join('-')
|
141
|
+
|
142
|
+
request[formated_type] = value
|
139
143
|
end
|
140
144
|
end
|
141
145
|
|
data/lib/fat_zebra/util.rb
CHANGED
@@ -3,6 +3,11 @@ module FatZebra
|
|
3
3
|
class << self
|
4
4
|
|
5
5
|
DATE_FORMAT = '%Y/%m/%d'.freeze
|
6
|
+
REGEXP_HTTP = %r{http[s]?\:\/\/}
|
7
|
+
|
8
|
+
def cleanup_host(uri)
|
9
|
+
uri.gsub(REGEXP_HTTP, '')
|
10
|
+
end
|
6
11
|
|
7
12
|
##
|
8
13
|
# Remove nil value from hash
|
@@ -12,12 +17,23 @@ module FatZebra
|
|
12
17
|
hash.reject { |_, value| value.nil? }
|
13
18
|
end
|
14
19
|
|
20
|
+
##
|
21
|
+
# Convert string to camelize
|
22
|
+
#
|
23
|
+
# @param [String]
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# camelize('my_model') => 'MyModel'
|
27
|
+
def camelize(string)
|
28
|
+
string.split('_').map(&:capitalize).join
|
29
|
+
end
|
30
|
+
|
15
31
|
##
|
16
32
|
# Encodes a hash of parameters in a way that's suitable for use as query
|
17
33
|
# parameters in a URI or as form parameters in a request body. This mainly
|
18
34
|
# involves escaping special characters from parameter keys and values (e.g.
|
19
35
|
# `&`).
|
20
|
-
def encode_parameters(params)
|
36
|
+
def encode_parameters(params = {})
|
21
37
|
params.map { |k, v| "#{url_encode(k)}=#{url_encode(v)}" }.join('&')
|
22
38
|
end
|
23
39
|
|
data/lib/fat_zebra/version.rb
CHANGED
data/lib/fat_zebra/web_hook.rb
CHANGED
data/lib/fat_zebra.rb
CHANGED
@@ -6,8 +6,10 @@ require 'fat_zebra/util'
|
|
6
6
|
require 'fat_zebra/config'
|
7
7
|
require 'fat_zebra/errors'
|
8
8
|
require 'fat_zebra/validation'
|
9
|
+
require 'fat_zebra/object_helper'
|
9
10
|
require 'fat_zebra/fat_zebra_object'
|
10
11
|
require 'fat_zebra/request'
|
12
|
+
require 'fat_zebra/api_helper'
|
11
13
|
require 'fat_zebra/api_resource'
|
12
14
|
|
13
15
|
# API Operations
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://gateway.sandbox.fatzebra.com.au/v1.0/bank_accounts
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"bsb":"123-123","account_name":"Test name","account_number":"012345678","test":true}'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Authorization:
|
17
|
+
- Basic VEVTVDpURVNU
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Wed, 05 Jul 2017 05:53:07 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Status:
|
34
|
+
- 201 Created
|
35
|
+
X-Rack-Cache:
|
36
|
+
- invalidate, pass
|
37
|
+
Cache-Control:
|
38
|
+
- no-store
|
39
|
+
X-Request-Version:
|
40
|
+
- 1.19.41
|
41
|
+
X-Runtime:
|
42
|
+
- '0.035026'
|
43
|
+
Pragma:
|
44
|
+
- no-cache
|
45
|
+
X-Request-Id:
|
46
|
+
- bcad35c76e583e129d7d5dfa8f1bc793
|
47
|
+
X-Backend:
|
48
|
+
- sbox-priv-gateway-a
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"successful":true,"response":{"id":"071-B-YO282XDY","account_name":"Test
|
52
|
+
name","account_number":"012345678","bsb":"123-123","created_at":"2017-07-05T15:53:07+10:00"},"errors":[],"test":true}'
|
53
|
+
http_version:
|
54
|
+
recorded_at: Wed, 05 Jul 2017 05:53:07 GMT
|
55
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://gateway.sandbox.fatzebra.com.au/v1.0/batches
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "------FatZebraMultipartPost\r\nContent-Disposition: form-data; name=\"BATCH-v1-PURCHASE-TEST-20170705-016bcc0661feae5d0219ab95fadb7e6b.csv\";
|
9
|
+
filename=\"BATCH-v1-PURCHASE-TEST-20170705-016bcc0661feae5d0219ab95fadb7e6b.csv\"\r\nContent-Length:
|
10
|
+
\r\nContent-Type: text/csv\r\nContent-Transfer-Encoding: binary\r\n\r\n1000,AUD,Order12345,John
|
11
|
+
Doe 1,4444333322221111,12/2020,,Gizmo ABC 1\n2051,AUD,Order22345,John Doe
|
12
|
+
2,4444333322221111,12/2020,,Gizmo ABC 2\n3000,AUD,Order32345,John Doe 3,4444333322221111,12/2020,,Gizmo
|
13
|
+
ABC 3\n4000,AUD,Order42345,John Doe 4,4444333322221111,12/2020,,Gizmo ABC
|
14
|
+
4\n\r\n------FatZebraMultipartPost\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\nBATCH-v1-PURCHASE-TEST-20170705-016bcc0661feae5d0219ab95fadb7e6b.csv------FatZebraMultipartPost\r\nContent-Disposition:
|
15
|
+
form-data; name=\"test\"\r\n\r\ntrue------FatZebraMultipartPost--\r\n"
|
16
|
+
headers:
|
17
|
+
Accept-Encoding:
|
18
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
+
Accept:
|
20
|
+
- "*/*"
|
21
|
+
User-Agent:
|
22
|
+
- Ruby
|
23
|
+
Authorization:
|
24
|
+
- Basic VEVTVDpURVNU
|
25
|
+
Content-Length:
|
26
|
+
- '835'
|
27
|
+
Content-Type:
|
28
|
+
- multipart/form-data; boundary=----FatZebraMultipartPost
|
29
|
+
response:
|
30
|
+
status:
|
31
|
+
code: 201
|
32
|
+
message: Created
|
33
|
+
headers:
|
34
|
+
Date:
|
35
|
+
- Wed, 05 Jul 2017 05:53:07 GMT
|
36
|
+
Content-Type:
|
37
|
+
- application/json; charset=utf-8
|
38
|
+
Transfer-Encoding:
|
39
|
+
- chunked
|
40
|
+
Connection:
|
41
|
+
- keep-alive
|
42
|
+
Status:
|
43
|
+
- 201 Created
|
44
|
+
X-Rack-Cache:
|
45
|
+
- invalidate, pass
|
46
|
+
Cache-Control:
|
47
|
+
- no-store
|
48
|
+
X-Request-Version:
|
49
|
+
- 1.19.41
|
50
|
+
X-Runtime:
|
51
|
+
- '0.064812'
|
52
|
+
Pragma:
|
53
|
+
- no-cache
|
54
|
+
X-Purge-File:
|
55
|
+
- 'false'
|
56
|
+
X-Request-Id:
|
57
|
+
- a9a9e729847e1c03f2447852998a6582
|
58
|
+
X-Backend:
|
59
|
+
- sbox-priv-gateway-a
|
60
|
+
body:
|
61
|
+
encoding: UTF-8
|
62
|
+
string: '{"successful":true,"response":{"id":"071-BF-SU4GOW5I","filename":"BATCH-v1-PURCHASE-TEST-20170705-016bcc0661feae5d0219ab95fadb7e6b.csv","created_at":"2017-07-05T15:53:07+10:00","process_date":"2017-07-05","start_date":null,"completed_date":null,"status":"New","type":"PURCHASE","reference":"016bcc0661feae5d0219ab95fadb7e6b"},"errors":[],"test":false}'
|
63
|
+
http_version:
|
64
|
+
recorded_at: Wed, 05 Jul 2017 05:53:07 GMT
|
65
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://gateway.sandbox.fatzebra.com.au/v1.0/batches
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "------FatZebraMultipartPost\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\nBATCH-v1-PURCHASE-TEST-20170705-06bde31e33f2417ec7a57eb9f996eaa6.csv------FatZebraMultipartPost\r\nContent-Disposition:
|
9
|
+
form-data; name=\"BATCH-v1-PURCHASE-TEST-20170705-06bde31e33f2417ec7a57eb9f996eaa6.csv\";
|
10
|
+
filename=\"BATCH-v1-PURCHASE-TEST-20170705-06bde31e33f2417ec7a57eb9f996eaa6.csv\"\r\nContent-Length:
|
11
|
+
\r\nContent-Type: text/csv\r\nContent-Transfer-Encoding: binary\r\n\r\n1000,AUD,Order12345,John
|
12
|
+
Doe 1,4444333322221111,12/2020,,Gizmo ABC 1\n2051,AUD,Order22345,John Doe
|
13
|
+
2,4444333322221111,12/2020,,Gizmo ABC 2\n3000,AUD,Order32345,John Doe 3,4444333322221111,12/2020,,Gizmo
|
14
|
+
ABC 3\n4000,AUD,Order42345,John Doe 4,4444333322221111,12/2020,,Gizmo ABC
|
15
|
+
4\n\r\n------FatZebraMultipartPost\r\nContent-Disposition: form-data; name=\"test\"\r\n\r\ntrue------FatZebraMultipartPost--\r\n"
|
16
|
+
headers:
|
17
|
+
Accept-Encoding:
|
18
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
+
Accept:
|
20
|
+
- "*/*"
|
21
|
+
User-Agent:
|
22
|
+
- Ruby
|
23
|
+
Authorization:
|
24
|
+
- Basic VEVTVDpURVNU
|
25
|
+
Content-Length:
|
26
|
+
- '835'
|
27
|
+
Content-Type:
|
28
|
+
- multipart/form-data; boundary=----FatZebraMultipartPost
|
29
|
+
response:
|
30
|
+
status:
|
31
|
+
code: 201
|
32
|
+
message: Created
|
33
|
+
headers:
|
34
|
+
Date:
|
35
|
+
- Wed, 05 Jul 2017 05:53:08 GMT
|
36
|
+
Content-Type:
|
37
|
+
- application/json; charset=utf-8
|
38
|
+
Transfer-Encoding:
|
39
|
+
- chunked
|
40
|
+
Connection:
|
41
|
+
- keep-alive
|
42
|
+
Status:
|
43
|
+
- 201 Created
|
44
|
+
Cache-Control:
|
45
|
+
- no-store
|
46
|
+
X-Request-Version:
|
47
|
+
- 1.19.41
|
48
|
+
Pragma:
|
49
|
+
- no-cache
|
50
|
+
X-Request-Id:
|
51
|
+
- 21f2aa35b9f2c324344231a5e81b04f6
|
52
|
+
X-Runtime:
|
53
|
+
- '0.032829'
|
54
|
+
X-Purge-File:
|
55
|
+
- 'false'
|
56
|
+
X-Rack-Cache:
|
57
|
+
- invalidate, pass
|
58
|
+
X-Backend:
|
59
|
+
- sbox-priv-gateway-a
|
60
|
+
body:
|
61
|
+
encoding: UTF-8
|
62
|
+
string: '{"successful":true,"response":{"id":"071-BF-20AR3L72","filename":"BATCH-v1-PURCHASE-TEST-20170705-06bde31e33f2417ec7a57eb9f996eaa6.csv","created_at":"2017-07-05T15:53:08+10:00","process_date":"2017-07-05","start_date":null,"completed_date":null,"status":"New","type":"PURCHASE","reference":"06bde31e33f2417ec7a57eb9f996eaa6"},"errors":[],"test":false}'
|
63
|
+
http_version:
|
64
|
+
recorded_at: Wed, 05 Jul 2017 05:53:08 GMT
|
65
|
+
recorded_with: VCR 3.0.3
|