pin_up 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +5 -7
- data/Gemfile.lock +12 -0
- data/README.md +49 -2
- data/VERSION +1 -1
- data/lib/pin_up.rb +2 -0
- data/lib/pin_up/receipt.rb +64 -0
- data/pin_up.gemspec +11 -4
- data/spec/receipt_spec.rb +34 -0
- data/spec/spec_helper.rb +5 -3
- data/views/receipt.html.erb +217 -0
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a3e2632a57eb0ab9926a95fe146f83f43bca2da
|
4
|
+
data.tar.gz: 5e33cb060cdda7e2ed56a0d0847593c9b350ff34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b11cb5ab4da229ea354fe35fccf88ebc1f524bd822c1102f8bf7a03782ac265c59e9fb0553c9279456094537ff60314caabafb212f8dbbc5d5abd0893448ba5a
|
7
|
+
data.tar.gz: 71788c32b013479e8b6ffbf7cda8a333cc27c2ecb641066891d6c33619d185ae30207432687d90d5523062f61f9cda392daac4be32d697a50329db3735c599d1
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
gem "httparty"
|
5
2
|
|
6
|
-
|
7
|
-
|
3
|
+
gem "httparty"
|
4
|
+
|
8
5
|
group :development do
|
9
6
|
gem "shoulda", ">= 0"
|
10
7
|
gem "rdoc", "~> 3.12"
|
@@ -14,6 +11,7 @@ group :development do
|
|
14
11
|
gem "simplecov", ">= 0"
|
15
12
|
gem "webmock"
|
16
13
|
gem "vcr"
|
17
|
-
gem
|
18
|
-
gem
|
14
|
+
gem "guard-rspec"
|
15
|
+
gem "terminal-notifier-guard"
|
16
|
+
gem "capybara"
|
19
17
|
end
|
data/Gemfile.lock
CHANGED
@@ -10,6 +10,12 @@ GEM
|
|
10
10
|
addressable (2.3.5)
|
11
11
|
atomic (1.1.10)
|
12
12
|
builder (3.2.2)
|
13
|
+
capybara (2.1.0)
|
14
|
+
mime-types (>= 1.16)
|
15
|
+
nokogiri (>= 1.3.3)
|
16
|
+
rack (>= 1.0.0)
|
17
|
+
rack-test (>= 0.5.4)
|
18
|
+
xpath (~> 2.0)
|
13
19
|
coderay (1.0.9)
|
14
20
|
crack (0.4.0)
|
15
21
|
safe_yaml (~> 0.9.0)
|
@@ -60,6 +66,7 @@ GEM
|
|
60
66
|
rb-kqueue (>= 0.2)
|
61
67
|
lumberjack (1.0.3)
|
62
68
|
method_source (0.8.1)
|
69
|
+
mime-types (1.25)
|
63
70
|
minitest (4.7.5)
|
64
71
|
multi_json (1.7.7)
|
65
72
|
multi_xml (0.5.4)
|
@@ -77,6 +84,8 @@ GEM
|
|
77
84
|
method_source (~> 0.8)
|
78
85
|
slop (~> 3.4)
|
79
86
|
rack (1.5.2)
|
87
|
+
rack-test (0.6.2)
|
88
|
+
rack (>= 1.0)
|
80
89
|
rake (10.1.0)
|
81
90
|
rb-fsevent (0.9.3)
|
82
91
|
rb-inotify (0.9.0)
|
@@ -114,11 +123,14 @@ GEM
|
|
114
123
|
webmock (1.12.3)
|
115
124
|
addressable (>= 2.2.7)
|
116
125
|
crack (>= 0.3.2)
|
126
|
+
xpath (2.0.0)
|
127
|
+
nokogiri (~> 1.3)
|
117
128
|
|
118
129
|
PLATFORMS
|
119
130
|
ruby
|
120
131
|
|
121
132
|
DEPENDENCIES
|
133
|
+
capybara
|
122
134
|
guard-rspec
|
123
135
|
httparty
|
124
136
|
jeweler (~> 1.8.4)
|
data/README.md
CHANGED
@@ -140,6 +140,53 @@ Will return a card_token that can be stored against a customer.
|
|
140
140
|
|
141
141
|
Only use this method if you're comfortable sending card details to your server - otherwise you can use a form that Pin provides (https://pin.net.au/docs/guides/payment-forms) and get the card_token that way.
|
142
142
|
|
143
|
+
## Receipts
|
144
|
+
|
145
|
+
One of the things I've found lacking with Pin is the ability to generate a receipt for a sale. So I've added this functionality into pin_up.
|
146
|
+
|
147
|
+
At the moment basic receipt creation from a succesful charge is supported, however, I'd like to build out this feature and include failed transactions and refunds.
|
148
|
+
|
149
|
+
There are two ways to go about creating and viewing / sharing a receipt.
|
150
|
+
|
151
|
+
#### Rendering a receipt as HTML
|
152
|
+
|
153
|
+
##### Basic Usage:
|
154
|
+
|
155
|
+
The following will return a HTML receipt for you to do with as you wish.
|
156
|
+
|
157
|
+
@charge = Pin::Charges.find("token")
|
158
|
+
@company_details = ["ABC Widgets","123 Fake Street Melbourne","VIC 3000","ABN: 12 345 678 910"]
|
159
|
+
@receipt = Pin::Receipt.new(@charge, @company_details)
|
160
|
+
@receipt.render()
|
161
|
+
|
162
|
+
Your "comapny_details" can be replaced with whatever information you wish to be displayed at the top right hand side (see `tmp/receipt.html`).
|
163
|
+
|
164
|
+
##### Advanced Usage:
|
165
|
+
|
166
|
+
There are four additional options that can be passed to `Pin::Receipt.new`.
|
167
|
+
|
168
|
+
The first is the path to your logo should you wish to include it in the footer.
|
169
|
+
|
170
|
+
The second is some additional payment information you might want to add (such as tax, fee or discount information). This can be done by passing a hash in as argument 4 eg:
|
171
|
+
|
172
|
+
payment_options = {}
|
173
|
+
payment_options["fee"] = {"name" => "late fee", "amount" => "$10.00"}
|
174
|
+
payment_options["tax"] = {"name" => "GST", "amount" => "$10.00"}
|
175
|
+
payment_options["discount"] = {"name" => "Member Discount", "amount" => "$10.00"}
|
176
|
+
|
177
|
+
A path to a custom receipt template can be passed in as the 5th argument, while a path that you would like the receipt to be saved to can be passed in as the 6th argument.
|
178
|
+
|
179
|
+
|
180
|
+
##### Saving a receipt
|
181
|
+
|
182
|
+
To save a receipt it's exactky the same as above, just call `save` instead of render. By default, a receipt will be saved into `tmp/receipt.html` unless a path is specified.
|
183
|
+
|
184
|
+
If you would like a PDF receipt, you should be able to "print as PDF" from a browser dialog.
|
185
|
+
|
186
|
+
##### Custom receipt template
|
187
|
+
|
188
|
+
If you would like you can use a custom receipt template to suit your branding or design needs. To get an idea of which variables are available, take a look at `/views/receit.html.erb`
|
189
|
+
|
143
190
|
## Testing localy
|
144
191
|
Create a YAML file under 'spec' called 'test_data.yml' and add in:
|
145
192
|
|
@@ -151,10 +198,10 @@ run
|
|
151
198
|
|
152
199
|
rspec spec/*.rb
|
153
200
|
|
154
|
-
##
|
201
|
+
## To do
|
155
202
|
|
203
|
+
* Flesh out receipts - handle failed transactions and refunds
|
156
204
|
* Validate a response before it gets sent to Pin (eg. Update customer)
|
157
|
-
* Pagination
|
158
205
|
|
159
206
|
## Contributing to pin_up
|
160
207
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.1
|
data/lib/pin_up.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
module Pin
|
2
|
+
##
|
3
|
+
# This class lets you generate and save receipts from a Pin::Charge.
|
4
|
+
class Receipt < Pin::Base
|
5
|
+
|
6
|
+
##
|
7
|
+
# Create a new Pin::Receipt instance
|
8
|
+
# Args:
|
9
|
+
# charge: Charge hash from Pin::Charge.find
|
10
|
+
# your_details: (Array), an Array of details you would like displayed about you or your company
|
11
|
+
# payment_options: (Hash), If your charge had extra components (such as late fees or discounts or taxes) pass them in here as a hash eg:
|
12
|
+
#
|
13
|
+
# payment_options = {}
|
14
|
+
# payment_options["fee"] = {"name" => "late fee", "amount" => "$10.00"}
|
15
|
+
# payment_options["tax"] = {"name" => "GST", "amount" => "$10.00"}
|
16
|
+
# payment_options["discount"] = {"name" => "Member Discount", "amount" => "$10.00"}
|
17
|
+
#
|
18
|
+
# template_path: (String), path to your own template if you wish to design your own receipt (take a look at the included template for variable names)
|
19
|
+
# save_path: (String), path that the HTML receipt will be saved
|
20
|
+
def initialize(charge, your_details, logo_path='', payment_options={}, template_path = 'views/receipt.html.erb', save_path = 'tmp/receipt.html')
|
21
|
+
@charge = charge
|
22
|
+
@logo = logo_path
|
23
|
+
@details = your_details
|
24
|
+
@payment_options = payment_options
|
25
|
+
@template_path = template_path if template_path
|
26
|
+
@save_path = save_path if save_path
|
27
|
+
@amount = number_to_currency(@charge["amount"], @charge["currency"])
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Renders the HTML receipt but does not save it -- useful for showing on screen
|
32
|
+
def render
|
33
|
+
template = ERB.new File.new(@template_path).read, nil, "%"
|
34
|
+
template.result(binding)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Renders and saves the HTML receipt -- useful for emailing receipt
|
39
|
+
def save
|
40
|
+
receipt = File.new(@save_path, 'w')
|
41
|
+
receipt.write(render)
|
42
|
+
receipt.close
|
43
|
+
end
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
##
|
48
|
+
# Converts a string to currency format.
|
49
|
+
# Args:
|
50
|
+
# number: (String) a dollar, pound or euro value in 'cents'
|
51
|
+
# currency: (String) a string representation of a currency as provided by Pin
|
52
|
+
def number_to_currency(number, currency)
|
53
|
+
case currency
|
54
|
+
when 'GBP'
|
55
|
+
symbol = '£'
|
56
|
+
when 'EUR'
|
57
|
+
symbol = '€'
|
58
|
+
else
|
59
|
+
symbol = '$'
|
60
|
+
end
|
61
|
+
"#{symbol}#{"%0.2f" % (number.to_f / 100)}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/pin_up.gemspec
CHANGED
@@ -2,14 +2,15 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: pin_up 0.6.1 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "pin_up"
|
8
|
-
s.version = "0.
|
9
|
+
s.version = "0.6.1"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
12
|
s.authors = ["Daniel Nitsikopoulos"]
|
12
|
-
s.date = "2013-
|
13
|
+
s.date = "2013-11-07"
|
13
14
|
s.description = "A Ruby gem wrapper for the pin-payments (pin.net.au) API"
|
14
15
|
s.email = "dnitza@gmail.com"
|
15
16
|
s.extra_rdoc_files = [
|
@@ -42,6 +43,7 @@ Gem::Specification.new do |s|
|
|
42
43
|
"lib/pin_up/charge.rb",
|
43
44
|
"lib/pin_up/customer.rb",
|
44
45
|
"lib/pin_up/pin_errors.rb",
|
46
|
+
"lib/pin_up/receipt.rb",
|
45
47
|
"lib/pin_up/refund.rb",
|
46
48
|
"pin_up.gemspec",
|
47
49
|
"spec/base_spec.rb",
|
@@ -49,13 +51,15 @@ Gem::Specification.new do |s|
|
|
49
51
|
"spec/charges_spec.rb",
|
50
52
|
"spec/customers_spec.rb",
|
51
53
|
"spec/errors_spec.rb",
|
54
|
+
"spec/receipt_spec.rb",
|
52
55
|
"spec/refund_spec.rb",
|
53
|
-
"spec/spec_helper.rb"
|
56
|
+
"spec/spec_helper.rb",
|
57
|
+
"views/receipt.html.erb"
|
54
58
|
]
|
55
59
|
s.homepage = "http://github.com/dNitza/pin_up"
|
56
60
|
s.licenses = ["MIT"]
|
57
61
|
s.require_paths = ["lib"]
|
58
|
-
s.rubygems_version = "2.
|
62
|
+
s.rubygems_version = "2.1.4"
|
59
63
|
s.summary = "A Ruby gem wrapper for the pin-payments (pin.net.au) API"
|
60
64
|
|
61
65
|
if s.respond_to? :specification_version then
|
@@ -73,6 +77,7 @@ Gem::Specification.new do |s|
|
|
73
77
|
s.add_development_dependency(%q<vcr>, [">= 0"])
|
74
78
|
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
75
79
|
s.add_development_dependency(%q<terminal-notifier-guard>, [">= 0"])
|
80
|
+
s.add_development_dependency(%q<capybara>, [">= 0"])
|
76
81
|
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
77
82
|
else
|
78
83
|
s.add_dependency(%q<httparty>, [">= 0"])
|
@@ -86,6 +91,7 @@ Gem::Specification.new do |s|
|
|
86
91
|
s.add_dependency(%q<vcr>, [">= 0"])
|
87
92
|
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
88
93
|
s.add_dependency(%q<terminal-notifier-guard>, [">= 0"])
|
94
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
89
95
|
s.add_dependency(%q<httparty>, [">= 0"])
|
90
96
|
end
|
91
97
|
else
|
@@ -100,6 +106,7 @@ Gem::Specification.new do |s|
|
|
100
106
|
s.add_dependency(%q<vcr>, [">= 0"])
|
101
107
|
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
102
108
|
s.add_dependency(%q<terminal-notifier-guard>, [">= 0"])
|
109
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
103
110
|
s.add_dependency(%q<httparty>, [">= 0"])
|
104
111
|
end
|
105
112
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Receipt", :vcr, class: Pin::Receipt do
|
4
|
+
before(:each) do
|
5
|
+
Pin::Base.new(ENV["PIN_SECRET"], :test)
|
6
|
+
@charge = Pin::Charges.find("ch_0kdOMXP7gG0_W_Vh8qAWdA")
|
7
|
+
@company_details = ["ABC Widgets", "123 Fake Street Melbourne","VIC 3000", "ABN: 12 345 678 910"]
|
8
|
+
@receipt = Pin::Receipt.new(@charge, @company_details)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should generate an HTML receipt given a charge" do
|
12
|
+
@receipt.render().should include(@charge["token"])
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should save an index.html file for the receipt" do
|
16
|
+
@receipt.save()
|
17
|
+
File.read('tmp/receipt.html').should include(@charge["token"])
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should format a number as a currency" do
|
21
|
+
expect @receipt.send(:number_to_currency, 1989, 'null').should match(/[$,£,€]\d{1,}[.]\d{2}/)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should print payment option information" do
|
25
|
+
payment_options = {}
|
26
|
+
payment_options["fee"] = {"name" => "late fee", "amount" => "$10.00"}
|
27
|
+
payment_options["tax"] = {"name" => "GST", "amount" => "$10.00"}
|
28
|
+
payment_options["discount"] = {"name" => "Member Discount", "amount" => "$10.00"}
|
29
|
+
|
30
|
+
@detailed_receipt = Pin::Receipt.new(@charge, @company_details, nil, payment_options)
|
31
|
+
expect @detailed_receipt.render().should include("GST")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,14 +4,16 @@ SimpleCov.start
|
|
4
4
|
require 'rubygems'
|
5
5
|
require 'bundler/setup'
|
6
6
|
require 'webmock/rspec'
|
7
|
+
require 'capybara/rspec'
|
7
8
|
require 'vcr'
|
8
9
|
|
9
10
|
require "net/https"
|
10
11
|
require "uri"
|
11
12
|
|
12
13
|
## Uncomment to load in a .yml with your pin key
|
13
|
-
ENV.update YAML.load(File.read(File.expand_path("../test_data.yml", __FILE__)))
|
14
|
-
|
14
|
+
# ENV.update YAML.load(File.read(File.expand_path("../test_data.yml", __FILE__)))
|
15
|
+
|
16
|
+
# require pin_up gem
|
15
17
|
require 'pin_up'
|
16
18
|
|
17
19
|
RSpec.configure do |config|
|
@@ -28,5 +30,5 @@ VCR.configure do |c|
|
|
28
30
|
c.cassette_library_dir = "spec/vcr"
|
29
31
|
c.hook_into :webmock
|
30
32
|
c.allow_http_connections_when_no_cassette = true
|
31
|
-
c.filter_sensitive_data('<key>') {
|
33
|
+
c.filter_sensitive_data('<key>') {ENV["PIN_SECRET"]}
|
32
34
|
end
|
@@ -0,0 +1,217 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title><%= @details[0] %></title>
|
4
|
+
<style type="text/css">
|
5
|
+
body{
|
6
|
+
font-family: "Helvetica", arial, sans-serif;
|
7
|
+
text-align: center;
|
8
|
+
background: #eee;
|
9
|
+
font-size: 14px;
|
10
|
+
}
|
11
|
+
a{
|
12
|
+
color:#4b4b4b;
|
13
|
+
text-decoration: none;
|
14
|
+
}
|
15
|
+
a:hover{
|
16
|
+
color: #ccc;
|
17
|
+
}
|
18
|
+
h3,h5,h6{
|
19
|
+
color:#9ba4ae;
|
20
|
+
margin: 0px;
|
21
|
+
}
|
22
|
+
h5{
|
23
|
+
font-size: 14px;
|
24
|
+
margin: 20px 0 5px 0;
|
25
|
+
}
|
26
|
+
h3{
|
27
|
+
font-size: 16px;
|
28
|
+
}
|
29
|
+
h4{
|
30
|
+
color:#4b4b4b;
|
31
|
+
font-weight: 600;
|
32
|
+
margin:0;
|
33
|
+
/*font-size: 14px;*/
|
34
|
+
}
|
35
|
+
h2{
|
36
|
+
color:#4b4b4b;
|
37
|
+
text-align: left;
|
38
|
+
}
|
39
|
+
.half p{
|
40
|
+
/*margin: 20px 0 5px 0;*/
|
41
|
+
}
|
42
|
+
.full{
|
43
|
+
width:100%;
|
44
|
+
float: left;
|
45
|
+
overflow: hidden;
|
46
|
+
}
|
47
|
+
#receipt{
|
48
|
+
width:640px;
|
49
|
+
margin: 0 auto;
|
50
|
+
border:1px solid #ccc;
|
51
|
+
border-top:5px solid #4b4b4b;
|
52
|
+
padding: 15px;
|
53
|
+
overflow: hidden;
|
54
|
+
background: #fff;
|
55
|
+
margin-top: 55px;
|
56
|
+
}
|
57
|
+
.logo{
|
58
|
+
padding: 15px 0 25px 0;
|
59
|
+
}
|
60
|
+
.half{
|
61
|
+
width:50%;
|
62
|
+
overflow: hidden;
|
63
|
+
}
|
64
|
+
.right{
|
65
|
+
float: right;
|
66
|
+
text-align: right;
|
67
|
+
}
|
68
|
+
.left{
|
69
|
+
float: left;
|
70
|
+
text-align: left;
|
71
|
+
}
|
72
|
+
.center{
|
73
|
+
text-align: center;
|
74
|
+
}
|
75
|
+
section{
|
76
|
+
width:100%;
|
77
|
+
overflow: hidden;
|
78
|
+
float: left;
|
79
|
+
}
|
80
|
+
.text-right{
|
81
|
+
text-align: right;
|
82
|
+
color:#9ba4ae;
|
83
|
+
}
|
84
|
+
.break hr{
|
85
|
+
border-top: 2px solid #eee;
|
86
|
+
border-left:none;
|
87
|
+
}
|
88
|
+
table{
|
89
|
+
text-align: left;
|
90
|
+
font-size: 14px;
|
91
|
+
}
|
92
|
+
table th{
|
93
|
+
border-bottom: 2px solid #eee;
|
94
|
+
padding: 10px 0;
|
95
|
+
}
|
96
|
+
table td{
|
97
|
+
padding: 10px 0;
|
98
|
+
}
|
99
|
+
table td:first-child{
|
100
|
+
width:570px;
|
101
|
+
font-weight: 600;
|
102
|
+
padding-right: 90px;
|
103
|
+
}
|
104
|
+
.discount{
|
105
|
+
color: green;
|
106
|
+
}
|
107
|
+
.fee{
|
108
|
+
color: red;
|
109
|
+
}
|
110
|
+
.charge td{
|
111
|
+
border-bottom: 1px solid #eee;
|
112
|
+
}
|
113
|
+
</style>
|
114
|
+
</head>
|
115
|
+
<body>
|
116
|
+
<div id="receipt">
|
117
|
+
<header>
|
118
|
+
<div class="full center">
|
119
|
+
<h1><%= @details[0] %></h1>
|
120
|
+
</div>
|
121
|
+
<div class="full center">
|
122
|
+
<h3>Receipt</h3>
|
123
|
+
</div>
|
124
|
+
</header>
|
125
|
+
|
126
|
+
<section class="company-details">
|
127
|
+
<div class="half left">
|
128
|
+
<h5>Date</h5>
|
129
|
+
<h4><%= Time.parse(@charge["created_at"]).strftime("%d/%m/%Y") %></h4>
|
130
|
+
|
131
|
+
<h5>Prepared for</h5>
|
132
|
+
<h4><%= @charge["card"]["name"] %></h4>
|
133
|
+
<p><%= @charge["card"]["address_line1"] %></p>
|
134
|
+
<p><%= @charge["card"]["address_line2"] %></p>
|
135
|
+
<p><%= @charge["card"]["address_city"] %></p>
|
136
|
+
<p><%= @charge["card"]["address_state"] %></p>
|
137
|
+
<p><%= @charge["card"]["address_country"] %></p>
|
138
|
+
</div>
|
139
|
+
<div class="half right">
|
140
|
+
<h5>Prepared by</h5>
|
141
|
+
<h4><%= @details[0] %></h4>
|
142
|
+
<% @details.drop(1).each do |detail| %>
|
143
|
+
<p><%= detail %></p>
|
144
|
+
<% end %>
|
145
|
+
</div>
|
146
|
+
</section>
|
147
|
+
|
148
|
+
<section class="break">
|
149
|
+
<hr />
|
150
|
+
</section>
|
151
|
+
|
152
|
+
<section class="summary">
|
153
|
+
<h2>Invoice Summary</h2>
|
154
|
+
<table>
|
155
|
+
<tr>
|
156
|
+
<th>Description</th>
|
157
|
+
<th>Amount</th>
|
158
|
+
</tr>
|
159
|
+
<tr class="charge">
|
160
|
+
<td>
|
161
|
+
<p><%= @charge["description"] %></p>
|
162
|
+
<small><%= @charge["token"] %></small>
|
163
|
+
</td>
|
164
|
+
<td><%= @amount %></td>
|
165
|
+
</tr>
|
166
|
+
<tr>
|
167
|
+
<td class="text-right">Subtotal</td>
|
168
|
+
<td><%= @amount %></td>
|
169
|
+
</tr>
|
170
|
+
<% if @payment_options["discount"] %>
|
171
|
+
<tr class="discount">
|
172
|
+
<td class="text-right"><%= @payment_options["discount"]["name"] %></td>
|
173
|
+
<td><%= @payment_options["discount"]["amount"] %></td>
|
174
|
+
</tr>
|
175
|
+
<% end %>
|
176
|
+
|
177
|
+
<% if @payment_options["fee"] %>
|
178
|
+
<tr class="fee">
|
179
|
+
<td class="text-right"><%= @payment_options["fee"]["name"] %></td>
|
180
|
+
<td><%= @payment_options["fee"]["amount"] %></td>
|
181
|
+
</tr>
|
182
|
+
<% end %>
|
183
|
+
|
184
|
+
<% if @payment_options["tax"] %>
|
185
|
+
<tr>
|
186
|
+
<td class="text-right"><%= @payment_options["tax"]["name"] %></td>
|
187
|
+
<td><%= @payment_options["tax"]["amount"] %></td>
|
188
|
+
</tr>
|
189
|
+
<% end %>
|
190
|
+
|
191
|
+
<tr>
|
192
|
+
<td class="text-right">Total</td>
|
193
|
+
<td>$<%= @charge["amount"].to_f / 100.00 %></td>
|
194
|
+
</tr>
|
195
|
+
</table>
|
196
|
+
</section>
|
197
|
+
|
198
|
+
<section class="break">
|
199
|
+
<hr />
|
200
|
+
</section>
|
201
|
+
|
202
|
+
<section class="info">
|
203
|
+
<h2 class="center">That's it!</h2>
|
204
|
+
<p>If this paid invoice is correct, you do not need to take any further action.</p>
|
205
|
+
<p>Your credit card <em><%= @charge["card"]["display_number"] %></em> has been charged.</p>
|
206
|
+
<p>Payment processed by <a href="https://pin.net.au" target="_blank">Pin Payments.</a></p>
|
207
|
+
<p>Thank You.</p>
|
208
|
+
<% unless @logo == '' %>
|
209
|
+
<div class="full center">
|
210
|
+
<img src="<%= @logo %>" class="logo">
|
211
|
+
</div>
|
212
|
+
<% end %>
|
213
|
+
</section>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
</body>
|
217
|
+
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pin_up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Nitsikopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: capybara
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: httparty
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,6 +225,7 @@ files:
|
|
211
225
|
- lib/pin_up/charge.rb
|
212
226
|
- lib/pin_up/customer.rb
|
213
227
|
- lib/pin_up/pin_errors.rb
|
228
|
+
- lib/pin_up/receipt.rb
|
214
229
|
- lib/pin_up/refund.rb
|
215
230
|
- pin_up.gemspec
|
216
231
|
- spec/base_spec.rb
|
@@ -218,8 +233,10 @@ files:
|
|
218
233
|
- spec/charges_spec.rb
|
219
234
|
- spec/customers_spec.rb
|
220
235
|
- spec/errors_spec.rb
|
236
|
+
- spec/receipt_spec.rb
|
221
237
|
- spec/refund_spec.rb
|
222
238
|
- spec/spec_helper.rb
|
239
|
+
- views/receipt.html.erb
|
223
240
|
homepage: http://github.com/dNitza/pin_up
|
224
241
|
licenses:
|
225
242
|
- MIT
|
@@ -240,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
257
|
version: '0'
|
241
258
|
requirements: []
|
242
259
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
260
|
+
rubygems_version: 2.1.4
|
244
261
|
signing_key:
|
245
262
|
specification_version: 4
|
246
263
|
summary: A Ruby gem wrapper for the pin-payments (pin.net.au) API
|