klarna-xmlrpc 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -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 +171 -0
- data/lib/klarna/api.rb +187 -0
- data/lib/klarna/api/client.rb +126 -0
- data/lib/klarna/api/constants.rb +647 -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 +188 -0
- data/lib/klarna/api/methods/standard.rb +126 -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 +288 -0
- data/test/klarna/api/errors_test.rb +34 -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 +184 -0
- data/test/klarna_test.rb +204 -0
- data/test/support/assertions_helper.rb +40 -0
- data/test/test_helper.rb +55 -0
- metadata +335 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 884cb4983e5eaf740ebf2f4b3d7519dc05046573
|
4
|
+
data.tar.gz: b4a6d9b8bd690dc20d9057ac5e4162ef2e3371af
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7699b2ddb818d106f8243097106b5bfa298dd53a5f63c950c82435271c775c0e53ac4417a21a2f8adfa64b3e5ca3673c6b0baf56ff4ecc5ec76280979cbf0632
|
7
|
+
data.tar.gz: 83c60e1cf360a8fad00fe34f8ec6c91805d95ddcbca8ca20fc63d17d39a9aa48729108f76118bf9d78062e2c8b8544f3b7c75f28a7689de1392812532e6dacab
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
guard 'bundler' do
|
2
|
+
watch('Gemfile')
|
3
|
+
watch(/^.+\.gemspec/)
|
4
|
+
end
|
5
|
+
|
6
|
+
guard 'minitest' do
|
7
|
+
# with Minitest::Unit
|
8
|
+
watch(%r|^test/(.*)_test\.rb|)
|
9
|
+
watch(%r|^lib/(.*)\.rb|) { |m| "test/#{m[1]}_test.rb" }
|
10
|
+
watch(%r|^test/test_helper\.rb|) { "test" }
|
11
|
+
|
12
|
+
# with Minitest::Spec
|
13
|
+
# watch(%r|^spec/(.*)_spec\.rb|)
|
14
|
+
# watch(%r|^lib/(.*)\.rb|) { |m| "spec/#{m[1]}_spec.rb" }
|
15
|
+
# watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
16
|
+
end
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010-2011 Jonas Grimfelt, Merchii. http://merchii.com
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
h1. KLARNA "!https://secure.travis-ci.org/merchii/klarna-ruby.png!":http://travis-ci.org/merchii/klarna-ruby
|
2
|
+
|
3
|
+
_A Ruby wrapper for the Klarna XML-RPC API._
|
4
|
+
|
5
|
+
h2. What is Klarna?
|
6
|
+
|
7
|
+
*"Klarna":http://klarna.com* is a payment solution with focus on e-commerce. Visit "klarna.com":http://klarna.com for more information, or why not "Wikipedia: Klarna":http://en.wikipedia.org/wiki/Klarna. We might be biased, but at "Merchii":http://merchii.com we currently consider Klarna the most convenient online payment solution that exists - and that's why we lean on it.
|
8
|
+
|
9
|
+
*Supported countries:*
|
10
|
+
|
11
|
+
Sweden (SE), Norway (NO), Denmark (DK), Finland (FI), Germany (DE), Netherlands (NL).
|
12
|
+
|
13
|
+
h2. Implementation/Background
|
14
|
+
|
15
|
+
This gem was developed as a semi-1:1 implementation of the corresponding API implementations provided by Klarna (with a few simple justifications and heavily refactored methods). Klarnas official implementations were not implemented using OO patterns and as their implementation was changing very often without any notice/versioning I kept it simple as possible.
|
16
|
+
|
17
|
+
Since Klarna 2.0 was released they'va refactored their implementations a lot which makes it a good idea to review this implementation as well. Like stated in the TODO I had a clean classy DSL in mind.
|
18
|
+
|
19
|
+
This is not a complete implementation, but not far from it and enough for most use cases - a few of the more advanced API methods needs a review/revisit (code disabled now).
|
20
|
+
|
21
|
+
h2. Setup
|
22
|
+
|
23
|
+
Install the gem:
|
24
|
+
|
25
|
+
<pre>
|
26
|
+
$ gem install klarna
|
27
|
+
</pre>
|
28
|
+
|
29
|
+
...or if you use "Bundler":http://gembundler.com:
|
30
|
+
|
31
|
+
@Gemfile@:
|
32
|
+
|
33
|
+
<pre>
|
34
|
+
gem 'klarna'
|
35
|
+
</pre>
|
36
|
+
|
37
|
+
...and @$ bundle install@.
|
38
|
+
|
39
|
+
h2. Usage
|
40
|
+
|
41
|
+
Trivial example looking up an address using - in this case - a Swedish SSN:
|
42
|
+
|
43
|
+
<pre>
|
44
|
+
require 'rubygems'
|
45
|
+
require 'klarna'
|
46
|
+
|
47
|
+
Klarna.configure do |c|
|
48
|
+
c.store_id = 123
|
49
|
+
c.store_secret = 'secret'
|
50
|
+
|
51
|
+
c.mode = :test
|
52
|
+
c.http_logging = false
|
53
|
+
end
|
54
|
+
|
55
|
+
client = Klarna::API::Client.new
|
56
|
+
|
57
|
+
client.get_addresses("430415-8399", :SE)
|
58
|
+
</pre>
|
59
|
+
|
60
|
+
See the code/docs for more information.
|
61
|
+
|
62
|
+
h2. Testing
|
63
|
+
|
64
|
+
A couple of ways...
|
65
|
+
|
66
|
+
*Specs*
|
67
|
+
|
68
|
+
To run unit/integration tests, simply do:
|
69
|
+
|
70
|
+
<pre>
|
71
|
+
$ bundle exec rake test
|
72
|
+
</pre>
|
73
|
+
|
74
|
+
...or if you use "Guard":http://github.com/guard/guard:
|
75
|
+
|
76
|
+
<pre>
|
77
|
+
$ bundle exec guard
|
78
|
+
</pre>
|
79
|
+
|
80
|
+
*Dummie client*
|
81
|
+
|
82
|
+
<pre>
|
83
|
+
$ cd examples
|
84
|
+
$ ruby console.rb
|
85
|
+
</pre>
|
86
|
+
|
87
|
+
*Web/Sinatra app*
|
88
|
+
|
89
|
+
1. Start the server...
|
90
|
+
|
91
|
+
<pre>
|
92
|
+
$ cd examples
|
93
|
+
$ ruby web.rb
|
94
|
+
...
|
95
|
+
>> Listening on 0.0.0.0:4567, CTRL+C to stop
|
96
|
+
</pre>
|
97
|
+
|
98
|
+
2. Open it up!
|
99
|
+
|
100
|
+
@http://localhost:4567@
|
101
|
+
|
102
|
+
*NOTE:* The web app actions/forms are probably completely broken currently as it hasn't been updated to reflect the current library implementation.
|
103
|
+
|
104
|
+
h2. Debugging
|
105
|
+
|
106
|
+
*HTTP-debugging in Wireshark*
|
107
|
+
|
108
|
+
Ensure port @4567@ (port used for Klarna API integration test/debugging) is in the list of captured ports in the HTTP/HTTPS preferences, or these requests/responses will not be captured. Note: Port @80@ (port used for Klarna API integration in production) is captured by default.
|
109
|
+
|
110
|
+
*XML-RPC-debugging in a XML-RPC client*
|
111
|
+
|
112
|
+
Try this:
|
113
|
+
|
114
|
+
Endpoint: @http://beta-test.klarna.com:4567@
|
115
|
+
Method: @get_addresses@
|
116
|
+
Params: @["1.0","ruby/xmlrpc","430415-8399",2,"AY2qnVNi8ccTsuDw2XNovQ==",2,2]@
|
117
|
+
|
118
|
+
h2. References
|
119
|
+
|
120
|
+
* "Klarna API Documentation":http://integration.klarna.com/en/api/step-by-step
|
121
|
+
* "XML-RPC Overview":http://en.wikipedia.org/wiki/XML-RPC
|
122
|
+
|
123
|
+
h2. Tools
|
124
|
+
|
125
|
+
* "XML-RPC Client":http://ditchnet.org/xmlrpc/ for XML-RPC debugging on OS X.
|
126
|
+
* "Wireshark":http://wireshark.org for platform-independent protocol sniffing, useful for debugging XML-RPC requests/responses.
|
127
|
+
|
128
|
+
h2. Notes
|
129
|
+
|
130
|
+
This gem was developed for our own requirements at "Merchii":http://github.com/merchii, so feel free to send pull-requests with enhancements of any kind (features, bug-fixes, documentation, tests, etc.) to make it better or useful for you as well.
|
131
|
+
|
132
|
+
h2. To-do
|
133
|
+
|
134
|
+
See the "TODO":https://github.com/merchii/klarna-ruby/blob/master/TODO.
|
135
|
+
|
136
|
+
h2. License
|
137
|
+
|
138
|
+
Released under the MIT license.
|
139
|
+
Copyright (c) "Jonas Grimfelt":http://github.com/grimen, "Merchii":http://merchii.com
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rdoc/task'
|
5
|
+
|
6
|
+
desc 'Default: Run all tests.'
|
7
|
+
task :default => :test
|
8
|
+
|
9
|
+
desc 'Test gem for klarna.'
|
10
|
+
Rake::TestTask.new(:test) do |test|
|
11
|
+
test.libs << ['lib', 'test']
|
12
|
+
test.pattern = 'test/**/*_test.rb'
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Generate gem documentation for klarna.'
|
16
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'Klarna Ruby API-wrapper Documentation'
|
19
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
20
|
+
rdoc.rdoc_files.include('README.textile')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
data/TODO
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
== CURRENT
|
3
|
+
|
4
|
+
x [issue]: Test the invoice activation in a proper way - not allowed in the Klarna 2.0 API (for some weird reason...)
|
5
|
+
|
6
|
+
|
7
|
+
== HIGH-PRIO
|
8
|
+
|
9
|
+
* [feature]: Review/Implement something like: our_settype_integer, our_strip_string, our_settype_string (consider one generic method, e.g. parse(:price, value) - all validation/masking/casting in one place)
|
10
|
+
* [feature]: Ensure valid string format/stripping (e.g. SSN, etc) using regular expressions
|
11
|
+
* [feature]: Compare implementation with Klarna's new API 2.0
|
12
|
+
* [feature]: Ensure correct params datatypes are submitted (validation - consider generic method)
|
13
|
+
* [feature]: Klarna::DSL - wrapper DSL for less sucky integrations
|
14
|
+
* [feature]: Implement #get_pclasses method to export pclasses as hash (and maybe export to YAML?)
|
15
|
+
* [feature]: ActiveMerchant-integration (fork ActiveMerchant and add klarna as new gateway with "klarna-ruby" as dependency)
|
16
|
+
|
17
|
+
|
18
|
+
== LOW-PRIO
|
19
|
+
|
20
|
+
* [feature]: Finalize the rest of the specs for already implemented methods, commented out currently.
|
21
|
+
* [feature]: Implement Reservation methods
|
22
|
+
* [feature]: Bring back "examples/web" - probably not working at all now.
|
23
|
+
* [feature]: Rack middleware?
|
24
|
+
* [refactor]: Only load activesupport-extensions we actually use.
|
25
|
+
|
26
|
+
== MAYBE
|
27
|
+
|
28
|
+
* [feature]: Mock XML-responses by default to avoid live API calls, but allow live calls using ENV['REMOTE]=true
|
29
|
+
|
30
|
+
https://github.com/myronmarston/vcr
|
data/examples/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
require 'klarna'
|
3
|
+
|
4
|
+
# Configuration.
|
5
|
+
Klarna.setup do |config|
|
6
|
+
config.mode = :test
|
7
|
+
|
8
|
+
config.country = :SE
|
9
|
+
|
10
|
+
config.store_id = 2
|
11
|
+
config.store_secret = 'lakrits'
|
12
|
+
|
13
|
+
config.logging = true
|
14
|
+
config.http_logging = false
|
15
|
+
end
|
data/examples/console.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.require(:default)
|
6
|
+
require 'active_support/all'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
require File.expand_path("config/initializer", File.dirname(__FILE__)).to_s
|
10
|
+
|
11
|
+
# == Initialize a Klarna API-client.
|
12
|
+
|
13
|
+
Klarna.configure do |c|
|
14
|
+
c.store_id = ENV['KLARNA_ESTORE_ID'].presence
|
15
|
+
c.store_secret = ENV['KLARNA_ESTORE_SECRET'].presence
|
16
|
+
c.mode = ENV['KLARNA_MODE'].presence
|
17
|
+
c.http_logging = true
|
18
|
+
end
|
19
|
+
|
20
|
+
begin
|
21
|
+
@@klarna = ::Klarna::API::Client.new(::Klarna.store_id, ::Klarna.store_secret)
|
22
|
+
rescue Klarna::API::Errors::KlarnaCredentialsError => e
|
23
|
+
puts e
|
24
|
+
rescue ::Klarna::API::Errors::KlarnaServiceError => e
|
25
|
+
puts e
|
26
|
+
end
|
27
|
+
|
28
|
+
@@klarna.client_ip = '192.168.0.196'
|
29
|
+
|
30
|
+
puts @@klarna.endpoint_uri.inspect
|
31
|
+
|
32
|
+
puts ::Klarna::API::PNO_FORMATS[:SE].inspect
|
33
|
+
|
34
|
+
print "SSN: "
|
35
|
+
test_pno = "820328-0154" # "4304158399" # gets.strip # "4304158399"
|
36
|
+
|
37
|
+
puts "------------------------------"
|
38
|
+
puts "eid: #{Klarna.store_id}"
|
39
|
+
puts "secret: #{Klarna.store_secret}"
|
40
|
+
puts "------------------------------"
|
41
|
+
puts "pno: #{test_pno}"
|
42
|
+
|
43
|
+
pno_secret = @@klarna.send(:digest, Klarna.store_id, test_pno, Klarna.store_secret)
|
44
|
+
|
45
|
+
puts "pno_secret: #{pno_secret}"
|
46
|
+
puts "------------------------------"
|
47
|
+
|
48
|
+
puts @@klarna.get_addresses(test_pno, ::Klarna::API::PNO_FORMATS[:SE])
|
49
|
+
|
50
|
+
# ----------------------
|
51
|
+
|
52
|
+
order_items = []
|
53
|
+
order_items << @@klarna.make_goods(1, "ABC1", "T-shirt 1", 1.00 * 100, 25)
|
54
|
+
# order_items << @@klarna.make_goods(1, "ABC2", "T-shirt 2", 7.00 * 100, 25)
|
55
|
+
# order_items << @@klarna.make_goods(1, "ABC3", "T-shirt 3", 17.00 * 100, 25)
|
56
|
+
|
57
|
+
#address = @@klarna.make_address("", "Junibackg. 42", "23634", "Hollviken", :SE, "076 526 00 00", "076 526 00 00", "karl.lidin@klarna.com")
|
58
|
+
address = @@klarna.make_address("", "Sollentunavägen 68", "18743", "Täby", :SE, "0702167225", "0702167225", "grimen@gmail.com")
|
59
|
+
|
60
|
+
# invoice_no = @@klarna.add_transaction("USER-#{test_pno}", 'ORDER-1', order_items, 0, 0, :NORMAL, test_pno, "Karl", "Lidin", address, '85.230.98.196', :SEK, :SE, :SV, :SE) #, nil, nil, nil, nil, nil, nil, nil, :TEST_MODE => true)
|
61
|
+
invoice_no = @@klarna.add_transaction("USER-#{test_pno}", 'ORDER-1', order_items, 0, 0, :NORMAL, test_pno, "Jonas", "Grimfelt", address, '85.230.98.196', :SEK, :SE, :SV, :SE) #, nil, nil, nil, nil, nil, nil, nil, :TEST_MODE => true)
|
62
|
+
|
63
|
+
pp "Invoice-no: #{invoice_no}"
|
64
|
+
|
65
|
+
# FIXME: Since Klarna API changed this fails even with the TEST_MODE (2) flag set.
|
66
|
+
|
67
|
+
# invoice_url = @@klarna.activate_invoice(invoice_no)
|
68
|
+
|
69
|
+
# pp "Invoice-URL: #{invoice_url}"
|
70
|
+
|
71
|
+
|
Binary file
|
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
- prefix ||= ''
|
2
|
+
|
3
|
+
%p
|
4
|
+
= field "First name:", :"#{prefix}first_name", :text, :size => "20", :value => ""
|
5
|
+
*
|
6
|
+
%p
|
7
|
+
= field "Last name:", :"#{prefix}last_name", :text, :size => "20", :value => ""
|
8
|
+
*
|
9
|
+
%p
|
10
|
+
= field "Street address:", :"#{prefix}street_address", :text, :size => "40", :value => ""
|
11
|
+
*
|
12
|
+
%p
|
13
|
+
= field "House number:", :"#{prefix}house_number", :text, :size => "2", :value => ""
|
14
|
+
(* Germany only)
|
15
|
+
%p
|
16
|
+
= field "Postal code:", :"#{prefix}postal_code", :text, :size => "5", :value => ""
|
17
|
+
*
|
18
|
+
%p
|
19
|
+
= field "City:", :"#{prefix}city", :text, :size => "20", :value => ""
|
20
|
+
*
|
21
|
+
%p
|
22
|
+
= country_selector("Country:", :prefix => prefix)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
%table
|
2
|
+
%thead
|
3
|
+
%tr
|
4
|
+
%th Quantity
|
5
|
+
%th Art.no.
|
6
|
+
%th Title
|
7
|
+
%th Price
|
8
|
+
%th VAT
|
9
|
+
%tbody
|
10
|
+
%tr
|
11
|
+
%td= field "", :"product[0]_quantity", :text, :value => "1", :size => 2
|
12
|
+
%td= field "", :"product[0]_article_no", :text, :value => "101", :size => 6
|
13
|
+
%td= field "", :"product[0]_title", :text, :value => "Product #1", :size => 20
|
14
|
+
%td= field "", :"product[0]_price", :text, :value => "99,00", :size => 8
|
15
|
+
%td= field "", :"product[0]_vat", :text, :value => "25,00", :size => 4
|
16
|
+
%tr
|
17
|
+
%td= field "", :"product[1]_quantity", :text, :value => "1", :size => 2
|
18
|
+
%td= field "", :"product[1]_article_no", :text, :value => "102", :size => 6
|
19
|
+
%td= field "", :"product[1]_title", :text, :value => "Product #2", :size => 20
|
20
|
+
%td= field "", :"product[1]_price", :text, :value => "149,00", :size => 8
|
21
|
+
%td= field "", :"product[1]_vat", :text, :value => "25,00", :size => 4
|
@@ -0,0 +1,32 @@
|
|
1
|
+
%h3 Add Transaction (Create Invoice)
|
2
|
+
|
3
|
+
%form{:action => '/essential/add_transaction', :name => 'add_transaction'}
|
4
|
+
%p
|
5
|
+
= field "SSN:", :pno, :text, :size => 12, :value => "430415-8399"
|
6
|
+
*
|
7
|
+
= partial(:address)
|
8
|
+
%p
|
9
|
+
= field "E-mail:", :email, :email, :size => 30
|
10
|
+
*
|
11
|
+
%p
|
12
|
+
= field "Phone:", :phone, :tel, :size => 10
|
13
|
+
*
|
14
|
+
%p
|
15
|
+
= field "Mobile:", :mobile, :tel, :size => 10
|
16
|
+
%p
|
17
|
+
= field "Order ID:", :order_id, :text, :size => 10
|
18
|
+
%p
|
19
|
+
= field "Auto-activation:", :auto_activation, :checkbox
|
20
|
+
%p
|
21
|
+
= field "Pre-pay:", :pre_pay, :checkbox
|
22
|
+
%p
|
23
|
+
= currency_selector("Currency:")
|
24
|
+
%p
|
25
|
+
= language_selector("Language:")
|
26
|
+
%p
|
27
|
+
= field "Yearly salary:", :yearly_salary, :text, :size => 10
|
28
|
+
(* with invoice purchases over 6000 SEK, DKK, NOK or 600 EUR)
|
29
|
+
%p
|
30
|
+
= field "Reference ID:", :reference, :text, :size => 10
|
31
|
+
%p
|
32
|
+
= submit_button "Create"
|