klarna 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.travis.yml +13 -0
- data/Gemfile +14 -0
- data/Guardfile +16 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +139 -0
- data/Rakefile +22 -0
- data/TODO +30 -0
- data/examples/Gemfile +8 -0
- data/examples/config/initializer.rb +15 -0
- data/examples/console.rb +71 -0
- data/examples/public/images/klarna.png +0 -0
- data/examples/public/images/ruby.png +0 -0
- data/examples/views/_address.haml +22 -0
- data/examples/views/_articles.haml +21 -0
- data/examples/views/checkout_page_example.haml +2 -0
- data/examples/views/essential/add_transaction/_form.haml +32 -0
- data/examples/views/essential/add_transaction/result.haml +7 -0
- data/examples/views/essential/calculate_monthly_cost/_form.haml +16 -0
- data/examples/views/essential/calculate_monthly_cost/result.haml +7 -0
- data/examples/views/essential/get_addresses/_form.haml +9 -0
- data/examples/views/essential/get_addresses/result.haml +8 -0
- data/examples/views/index.haml +296 -0
- data/examples/views/layout.haml +48 -0
- data/examples/views/payment_terms_example.haml +102 -0
- data/examples/views/product_page_example.haml +2 -0
- data/examples/views/reservation/activate_reservation/_form.haml +54 -0
- data/examples/views/reservation/activate_reservation/result.haml +7 -0
- data/examples/views/reservation/cancel_reservation/_form.haml +8 -0
- data/examples/views/reservation/cancel_reservation/result.haml +7 -0
- data/examples/views/reservation/change_reservation/_form.haml +10 -0
- data/examples/views/reservation/change_reservation/result.haml +7 -0
- data/examples/views/reservation/reserve_amount/_form.haml +58 -0
- data/examples/views/reservation/reserve_amount/result.haml +7 -0
- data/examples/views/reservation/reserve_ocr_numbers/_form.haml +8 -0
- data/examples/views/reservation/reserve_ocr_numbers/result.haml +7 -0
- data/examples/views/reservation/split_reservation/_form.haml +14 -0
- data/examples/views/reservation/split_reservation/result.haml +7 -0
- data/examples/views/special/get_pclasses/_form.haml +8 -0
- data/examples/views/special/get_pclasses/result.haml +7 -0
- data/examples/views/special/invoice_address/_form.haml +8 -0
- data/examples/views/special/invoice_address/result.haml +7 -0
- data/examples/views/special/invoice_amount/_form.haml +8 -0
- data/examples/views/special/invoice_amount/result.haml +7 -0
- data/examples/views/special/is_invoice_paid/_form.haml +8 -0
- data/examples/views/special/is_invoice_paid/result.haml +7 -0
- data/examples/views/special/update_charge_amount/_form.haml +15 -0
- data/examples/views/special/update_charge_amount/result.haml +7 -0
- data/examples/views/special/update_goods_quantity/_form.haml +17 -0
- data/examples/views/special/update_goods_quantity/result.haml +7 -0
- data/examples/views/special/update_order_number/_form.haml +10 -0
- data/examples/views/special/update_order_number/result.haml +7 -0
- data/examples/views/useful/activate_invoice/_form.haml +9 -0
- data/examples/views/useful/activate_invoice/result.haml +7 -0
- data/examples/views/useful/credit_invoice/_form.haml +11 -0
- data/examples/views/useful/credit_invoice/result.haml +7 -0
- data/examples/views/useful/delete_invoice/_form.haml +9 -0
- data/examples/views/useful/delete_invoice/result.haml +7 -0
- data/examples/views/useful/email_invoice/_form.haml +9 -0
- data/examples/views/useful/email_invoice/result.haml +7 -0
- data/examples/views/useful/has_account/_form.haml +9 -0
- data/examples/views/useful/has_account/result.haml +7 -0
- data/examples/views/useful/return_amount/_form.haml +15 -0
- data/examples/views/useful/return_amount/result.haml +7 -0
- data/examples/views/useful/send_invoice/_form.haml +9 -0
- data/examples/views/useful/send_invoice/result.haml +7 -0
- data/examples/web.rb +349 -0
- data/klarna.gemspec +34 -0
- data/lib/klarna.rb +175 -0
- data/lib/klarna/api.rb +170 -0
- data/lib/klarna/api/client.rb +128 -0
- data/lib/klarna/api/constants.rb +638 -0
- data/lib/klarna/api/errors.rb +154 -0
- data/lib/klarna/api/methods.rb +16 -0
- data/lib/klarna/api/methods/cost_calculations.rb +134 -0
- data/lib/klarna/api/methods/invoicing.rb +304 -0
- data/lib/klarna/api/methods/reservation.rb +149 -0
- data/lib/klarna/api/methods/standard.rb +123 -0
- data/lib/klarna/version.rb +5 -0
- data/test/fixtures/api/companies.yml +97 -0
- data/test/fixtures/api/pclasses.yml +37 -0
- data/test/fixtures/api/persons.yml +144 -0
- data/test/fixtures/api/stores.yml +6 -0
- data/test/fixtures/klarna.yml +10 -0
- data/test/klarna/api/client_test.rb +272 -0
- data/test/klarna/api/errors_test.rb +46 -0
- data/test/klarna/api/methods/cost_calculations_test.rb +78 -0
- data/test/klarna/api/methods/invoicing_test.rb +409 -0
- data/test/klarna/api/methods/reservation_test.rb +66 -0
- data/test/klarna/api/methods/standard_test.rb +244 -0
- data/test/klarna/api_test.rb +137 -0
- data/test/klarna_test.rb +204 -0
- data/test/support/assertions_helper.rb +40 -0
- data/test/test_helper.rb +55 -0
- metadata +312 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
%h3 Return Amount
|
2
|
+
%p Enter an invoice number and the amount you will return from the invoice.
|
3
|
+
|
4
|
+
%form{:action => '/invoicing/return_amount'}
|
5
|
+
%p
|
6
|
+
= field "Invoice ID:", :invoice_no, :text, :size => 10
|
7
|
+
*
|
8
|
+
%p
|
9
|
+
= field "Amount:", :amount, :text, :size => 6
|
10
|
+
*
|
11
|
+
%p
|
12
|
+
= field "VAT:", :vat, :text, :size => 4, :value => '25,00'
|
13
|
+
*
|
14
|
+
%p
|
15
|
+
= submit_button "Return"
|
data/examples/web.rb
ADDED
@@ -0,0 +1,349 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.require(:default, :development)
|
4
|
+
require 'active_support/all'
|
5
|
+
require 'sinatra'
|
6
|
+
require 'sinatra/mapping'
|
7
|
+
require 'haml'
|
8
|
+
|
9
|
+
require File.expand_path("config/initializer", File.dirname(__FILE__)).to_s
|
10
|
+
|
11
|
+
# CAUTION: This code haven't been updated to reflect the library - TODO.
|
12
|
+
|
13
|
+
# == Initialize a Klarna API-client.
|
14
|
+
|
15
|
+
begin
|
16
|
+
@@klarna = ::Klarna::API::Client.new(::Klarna.store_id, ::Klarna.store_secret)
|
17
|
+
rescue Klarna::API::Errors::KlarnaCredentialsError => e
|
18
|
+
puts e
|
19
|
+
rescue ::Klarna::API::Errors::KlarnaServiceError => e
|
20
|
+
puts e
|
21
|
+
end
|
22
|
+
|
23
|
+
# == Helpers to DRY up the views.
|
24
|
+
|
25
|
+
helpers do
|
26
|
+
def partial(*args)
|
27
|
+
locals = args.last.is_a?(Hash) ? args.pop : {}
|
28
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
29
|
+
options.merge!(:layout => false)
|
30
|
+
|
31
|
+
template_file = "_#{args.pop}"
|
32
|
+
template_path = args.join('/')
|
33
|
+
template = [template_path, template_file].join('/')
|
34
|
+
|
35
|
+
haml(:"#{template}", options, locals)
|
36
|
+
end
|
37
|
+
|
38
|
+
def field(label, name, type, options = {})
|
39
|
+
tag, type =
|
40
|
+
case type.to_sym
|
41
|
+
when :select
|
42
|
+
[:select, nil]
|
43
|
+
when :textarea
|
44
|
+
[:textarea, nil]
|
45
|
+
else
|
46
|
+
[:input, type]
|
47
|
+
end
|
48
|
+
capture_haml do
|
49
|
+
haml_tag(:label, label, :for => name)
|
50
|
+
end <<
|
51
|
+
capture_haml do
|
52
|
+
haml_tag(tag, options.merge(:type => type, :name => name))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def currency_selector(label = "Currency:")
|
57
|
+
capture_haml do
|
58
|
+
haml_tag(:label, label, :for => :currency)
|
59
|
+
end <<
|
60
|
+
capture_haml do
|
61
|
+
haml_tag(:select, :name => :currency) do
|
62
|
+
haml_tag(:option, "Sweden (SEK)", :value => 'SEK')
|
63
|
+
haml_tag(:option, "Norway (NOK)", :value => 'NOK')
|
64
|
+
haml_tag(:option, "Finland (EUR)", :value => 'EUR')
|
65
|
+
haml_tag(:option, "Denmark (DKK)", :value => 'DKK')
|
66
|
+
haml_tag(:option, "Germany (EUR)", :value => 'EUR')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def country_selector(label = "Country:", options = {})
|
72
|
+
prefix = options[:prefix] || ""
|
73
|
+
capture_haml do
|
74
|
+
haml_tag(:label, label, :for => :country)
|
75
|
+
end <<
|
76
|
+
capture_haml do
|
77
|
+
haml_tag(:select, :name => :"#{prefix}country") do
|
78
|
+
haml_tag(:option, "Sweden (SE)", :value => 'SE')
|
79
|
+
haml_tag(:option, "Norway (NO)", :value => 'NO')
|
80
|
+
haml_tag(:option, "Finland (FI)", :value => 'FI')
|
81
|
+
haml_tag(:option, "Denmark (DK)", :value => 'DK')
|
82
|
+
haml_tag(:option, "Germany (DE)", :value => 'DE')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def ssn_encoding_selector(label = "SSN Encoding:")
|
88
|
+
capture_haml do
|
89
|
+
haml_tag(:label, label, :for => :pno_encoding)
|
90
|
+
end <<
|
91
|
+
capture_haml do
|
92
|
+
haml_tag(:select, :name => :pno_encoding) do
|
93
|
+
haml_tag(:option, "Swedish", :value => 'SV')
|
94
|
+
haml_tag(:option, "Norwegian", :value => 'NO')
|
95
|
+
haml_tag(:option, "Finnish", :value => 'FI')
|
96
|
+
haml_tag(:option, "Danish", :value => 'DA')
|
97
|
+
haml_tag(:option, "German", :value => 'DE')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def language_selector(label = "Language:")
|
103
|
+
capture_haml do
|
104
|
+
haml_tag(:label, label, :for => :language)
|
105
|
+
end <<
|
106
|
+
capture_haml do
|
107
|
+
haml_tag(:select, :name => :language) do
|
108
|
+
haml_tag(:option, "Swedish (SV)", :value => 'SV')
|
109
|
+
haml_tag(:option, "Norwegian (NO)", :value => 'NO')
|
110
|
+
haml_tag(:option, "Finnish (FI)", :value => 'FI')
|
111
|
+
haml_tag(:option, "Danish (DA)", :value => 'DA')
|
112
|
+
haml_tag(:option, "German (DE)", :value => 'DE')
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def shipment_type_selector(label = "Shipment type:")
|
118
|
+
capture_haml do
|
119
|
+
haml_tag(:label, label, :for => :shipment_type)
|
120
|
+
end <<
|
121
|
+
capture_haml do
|
122
|
+
haml_tag(:select, :name => :shipment_type) do
|
123
|
+
haml_tag(:option, "Standard", :value => ::Klarna::API::SHIPMENT_TYPES[:NORMAL])
|
124
|
+
haml_tag(:option, "Express", :value => ::Klarna::API::SHIPMENT_TYPES[:EXPRESS])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def submit_button(label = "Submit")
|
130
|
+
capture_haml do
|
131
|
+
haml_tag(:input, :type => :submit, :value => label)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def button(label, link)
|
136
|
+
capture_haml do
|
137
|
+
haml_tag(:input, :type => 'button', :value => label, :onclick => link)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def process_reservation_details(params)
|
142
|
+
line_items = []
|
143
|
+
line_items << ::Klarna.make_goods(params[:'product[0]_quantity'], params[:'product[0]_article_no]'], params[:'product[0]_title'], params[:'product[0]_price'], params[:'product[0]_vat'], params[:'product[0]_discout'])
|
144
|
+
line_items << ::Klarna.make_goods(params[:'product[1]_quantity'], params[:'product[1]_article_no]'], params[:'product[1]_title'], params[:'product[1]_price'], params[:'product[1]_vat'], params[:'product[1]_discout'])
|
145
|
+
|
146
|
+
delivery_address = ::Klarna::API.make_reservation_address(params[:delivery_first_name], params[:delivery_last_name], params[:delivery_street_address], params[:delivery_postal_code], params[:delivery_city], params[:delivery_country], params[:delivery_house_number])
|
147
|
+
invoicing_address = ::Klarna::API.make_reservation_address(params[:invoicing_first_name], params[:invoicing_last_name], params[:invoicing_street_address], params[:invoicing_postal_code], params[:invoicing_city], params[:invoicing_country], params[:delivery_house_number])
|
148
|
+
|
149
|
+
country = ::Klarna::API.id_for(:country, params[:currency])
|
150
|
+
language = ::Klarna::API.id_for(:language, params[:language])
|
151
|
+
currency = ::Klarna::API.id_for(:currency, params[:currency])
|
152
|
+
|
153
|
+
client_ip = @env['REMOTE_ADDR']
|
154
|
+
pclass = -1
|
155
|
+
|
156
|
+
[line_items, delivery_address, invoicing_address, country, language, currency, client_ip, pclass]
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# == Mappings.
|
161
|
+
|
162
|
+
map :root, ""
|
163
|
+
|
164
|
+
# == General.
|
165
|
+
|
166
|
+
get '/' do
|
167
|
+
haml :index
|
168
|
+
end
|
169
|
+
get '/favicon.ico' do
|
170
|
+
nil
|
171
|
+
end
|
172
|
+
get '/:action' do
|
173
|
+
haml params[:action].to_sym
|
174
|
+
end
|
175
|
+
|
176
|
+
# == Essential
|
177
|
+
|
178
|
+
# FIXME
|
179
|
+
get '/essential/calculate_monthly_cost' do
|
180
|
+
@result = @@klarna.calculate_monthly_cost(params[:sum] * 100, params[:currency], params[:months], params[:month_fee])
|
181
|
+
haml :"essential/calculate_monthly_cost/result"
|
182
|
+
end
|
183
|
+
|
184
|
+
# FIXME: Port to new API.
|
185
|
+
get '/essential/get_addresses' do
|
186
|
+
@result = @@klarna.get_addresses(
|
187
|
+
params[:pno],
|
188
|
+
::Klarna::API::PNO_FORMATS[:SE]
|
189
|
+
)
|
190
|
+
haml :"essential/get_addresses/result"
|
191
|
+
end
|
192
|
+
|
193
|
+
get '/essential/add_transaction' do
|
194
|
+
goods_list = nil # ::Klarna.make_goods(params[:quantity], params[:article_no], t, price, vat, discount)
|
195
|
+
address = ::Klarna::API.make_address(params[:care_of], params[:street_address], params[:postal_code], params[:city], params[:country], params[:phone], params[:mobile], params[:email])
|
196
|
+
ip = @env['REMOTE_ADDR']
|
197
|
+
password = nil
|
198
|
+
new_password = nil
|
199
|
+
currency = ::Klarna::API.id_for(:currency, params[:currency])
|
200
|
+
country = ::Klarna::API.id_for(:country, params[:country])
|
201
|
+
language = ::Klarna::API.id_for(:language, params[:language])
|
202
|
+
|
203
|
+
@result = @@klarna.add_transaction(
|
204
|
+
params[:invoicing],
|
205
|
+
params[:order_id],
|
206
|
+
goods_list,
|
207
|
+
params[:shipping_fee],
|
208
|
+
params[:shipment_type],
|
209
|
+
params[:handling_fee],
|
210
|
+
params[:pno],
|
211
|
+
params[:first_name],
|
212
|
+
params[:last_name],
|
213
|
+
address,
|
214
|
+
ip,
|
215
|
+
currency,
|
216
|
+
country,
|
217
|
+
language
|
218
|
+
)
|
219
|
+
haml :"essential/add_transaction/result"
|
220
|
+
end
|
221
|
+
|
222
|
+
# == Invoicing
|
223
|
+
|
224
|
+
get '/invoicing/has_account' do
|
225
|
+
@result = @@klarna.has_account?(params[:pno])
|
226
|
+
haml :"essential/send_invoice/result"
|
227
|
+
end
|
228
|
+
|
229
|
+
get '/invoicing/activate_invoice' do
|
230
|
+
@result = @@klarna.activate_invoice(params[:invoice_no])
|
231
|
+
haml :"essential/activate_invoice/result"
|
232
|
+
end
|
233
|
+
|
234
|
+
get '/invoicing/credit_invoice' do
|
235
|
+
@result = @@klarna.credit_invoice(params[:invoice_no], params[:credit_id])
|
236
|
+
haml :"essential/credit_invoice/result"
|
237
|
+
end
|
238
|
+
|
239
|
+
get '/invoicing/delete_invoice' do
|
240
|
+
@result = @@klarna.delete_invoice(params[:invoice_no])
|
241
|
+
haml :"essential/delete_invoice/result"
|
242
|
+
end
|
243
|
+
|
244
|
+
get '/invoicing/return_amount' do
|
245
|
+
@result = @@klarna.return_amount(params[:invoice_no], params[:amount], params[:vat])
|
246
|
+
haml :"essential/return_amount/result"
|
247
|
+
end
|
248
|
+
|
249
|
+
get '/invoicing/email_invoice' do
|
250
|
+
@result = @@klarna.email_invoice(params[:invoice_no])
|
251
|
+
haml :"essential/email_invoice/result"
|
252
|
+
end
|
253
|
+
|
254
|
+
get '/invoicing/send_invoice' do
|
255
|
+
@result = @@klarna.send_invoice(params[:invoice_no])
|
256
|
+
haml :"essential/send_invoice/result"
|
257
|
+
end
|
258
|
+
|
259
|
+
# == Special
|
260
|
+
|
261
|
+
get '/special/update_charge_amount' do
|
262
|
+
@result = @@klarna.update_charge_amount(params[:invoice_no], params[:charge_type], params[:new_amount])
|
263
|
+
haml :"special/update_charge_amount/result"
|
264
|
+
end
|
265
|
+
|
266
|
+
get '/special/update_goods_quantity' do
|
267
|
+
@result = @@klarna.update_goods_quantity(params[:invoice_no], params[:article_no], params[:quantity])
|
268
|
+
haml :"special/update_goods_quantity/result"
|
269
|
+
end
|
270
|
+
|
271
|
+
get '/special/update_order_number' do
|
272
|
+
@result = @@klarna.update_order_number(params[:invoice_no], params[:new_order_id])
|
273
|
+
haml :"special/update_order_number/result"
|
274
|
+
end
|
275
|
+
|
276
|
+
get '/special/invoice_address' do
|
277
|
+
@result = @@klarna.get_invoice_address(params[:invoice_no])
|
278
|
+
haml :"special/invoice_address/result"
|
279
|
+
end
|
280
|
+
|
281
|
+
get '/special/invoice_amount' do
|
282
|
+
@result = @@klarna.get_invoice_amount(params[:invoice_no])
|
283
|
+
haml :"special/invoice_amount/result"
|
284
|
+
end
|
285
|
+
|
286
|
+
get '/special/is_invoice_paid' do
|
287
|
+
@result = @@klarna.invoice_paid?(params[:invoice_no])
|
288
|
+
haml :"special/is_invoice_paid/result"
|
289
|
+
end
|
290
|
+
|
291
|
+
get '/special/get_pclasses' do
|
292
|
+
currency = ::Klarna::API.id_for(:currency, params[:currency])
|
293
|
+
@result = @@klarna.get_pclasses(currency)
|
294
|
+
haml :"special/get_pclasses/result"
|
295
|
+
end
|
296
|
+
|
297
|
+
# == Reservation
|
298
|
+
|
299
|
+
get '/reservation/reserve_amount' do
|
300
|
+
line_items = []
|
301
|
+
line_items << ::Klarna.make_goods(params[:'product[0]_quantity'], params[:'product[0]_article_no]'], params[:'product[0]_title'], params[:'product[0]_price'], params[:'product[0]_vat'], params[:'product[0]_discout'])
|
302
|
+
line_items << ::Klarna.make_goods(params[:'product[1]_quantity'], params[:'product[1]_article_no]'], params[:'product[1]_title'], params[:'product[1]_price'], params[:'product[1]_vat'], params[:'product[1]_discout'])
|
303
|
+
|
304
|
+
delivery_address = ::Klarna::API.make_reservation_address(params[:delivery_first_name], params[:delivery_last_name], params[:delivery_street_address], params[:delivery_postal_code], params[:delivery_city], params[:delivery_country], params[:delivery_house_number])
|
305
|
+
invoicing_address = ::Klarna::API.make_reservation_address(params[:invoicing_first_name], params[:invoicing_last_name], params[:invoicing_street_address], params[:invoicing_postal_code], params[:invoicing_city], params[:invoicing_country], params[:delivery_house_number])
|
306
|
+
|
307
|
+
country = ::Klarna::API.id_for(:country, params[:currency])
|
308
|
+
language = ::Klarna::API.id_for(:language, params[:language])
|
309
|
+
currency = ::Klarna::API.id_for(:currency, params[:currency])
|
310
|
+
|
311
|
+
client_ip = @env['REMOTE_ADDR']
|
312
|
+
pclass = -1
|
313
|
+
|
314
|
+
# Q: What is order_id_X?
|
315
|
+
@result = @@klarna.reserve_amount(params[:pno], params[:amount], line_items, params[:reference], params[:reference_id], params[:order_id_1], params[:order_id_1],
|
316
|
+
client_ip, delivery_address, invoicing_address, params[:email], params[:phone], params[:mobile],
|
317
|
+
currency, country, language, params[:pno_encoding], pclass, params[:annual_salary])
|
318
|
+
haml :"special/reserve_amount/result"
|
319
|
+
end
|
320
|
+
|
321
|
+
get '/reservation/activate_reservation' do
|
322
|
+
# Q: Same as reserve_amount...?
|
323
|
+
line_items, delivery_address, invoicing_address, country, language, currency, client_ip, pclass = process_reservation_details(params)
|
324
|
+
|
325
|
+
@result = @@klarna.activate_reservation(params[:pno], params[:amount], line_items, params[:reference], params[:reference_id], params[:order_id_1], params[:order_id_1],
|
326
|
+
client_ip, delivery_address, invoicing_address, params[:email], params[:phone], params[:mobile],
|
327
|
+
currency, country, language, params[:pno_encoding], pclass, params[:annual_salary])
|
328
|
+
haml :"special/activate_reservation/result"
|
329
|
+
end
|
330
|
+
|
331
|
+
get '/reservation/cancel_reservation' do
|
332
|
+
@result = @@klarna.cancel_reservation(params[:reservation_id])
|
333
|
+
haml :"special/cancel_reservation/result"
|
334
|
+
end
|
335
|
+
|
336
|
+
get '/reservation/change_reservation' do
|
337
|
+
@result = @@klarna.change_reservation(params[:reservation_id], params[:new_amount])
|
338
|
+
haml :"special/change_reservation/result"
|
339
|
+
end
|
340
|
+
|
341
|
+
get '/reservation/split_reservation' do
|
342
|
+
@result = @@klarna.split_reservation(params[:reservation_id], params[:split_amount], params[:order_id_1], params[:order_id_2])
|
343
|
+
haml :"special/split_reservation/result"
|
344
|
+
end
|
345
|
+
|
346
|
+
get '/reservation/reserve_ocr_numbers' do
|
347
|
+
@result = @@klarna.reserve_ocr_numbers(params[:ocr_count])
|
348
|
+
haml :"special/reserve_ocr_numbers/result"
|
349
|
+
end
|
data/klarna.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'klarna/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "klarna"
|
7
|
+
s.version = Klarna::VERSION.dup
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jonas Grimfelt"]
|
10
|
+
s.email = ["jonas@merchii.com"]
|
11
|
+
s.homepage = "http://github.com/merchii/#{s.name}"
|
12
|
+
s.summary = %{A Ruby wrapper for Klarna/Kreditor XML-RPC API.}
|
13
|
+
s.description = s.summary
|
14
|
+
|
15
|
+
s.add_dependency 'activesupport'
|
16
|
+
s.add_dependency 'i18n'
|
17
|
+
|
18
|
+
s.add_development_dependency 'bundler'
|
19
|
+
s.add_development_dependency 'rake'
|
20
|
+
s.add_development_dependency 'rdoc'
|
21
|
+
s.add_development_dependency 'minitest'
|
22
|
+
s.add_development_dependency 'mocha'
|
23
|
+
s.add_development_dependency 'guard'
|
24
|
+
s.add_development_dependency 'guard-bundler'
|
25
|
+
s.add_development_dependency 'guard-minitest'
|
26
|
+
s.add_development_dependency 'sinatra'
|
27
|
+
s.add_development_dependency 'sinatra-mapping'
|
28
|
+
s.add_development_dependency 'haml'
|
29
|
+
|
30
|
+
s.files = `git ls-files`.split("\n")
|
31
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
32
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
33
|
+
s.require_paths = ['lib']
|
34
|
+
end
|