rack-payment 0.0.4 → 0.0.5

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.
@@ -0,0 +1,72 @@
1
+ div.rack-payment {
2
+ padding: 0;
3
+ margin: 2em;
4
+ text-align: center;
5
+ width: 100%;
6
+ }
7
+
8
+ div.rack-payment div.errors {
9
+ width: 60%;
10
+ margin: auto;
11
+ margin-bottom: 1em;
12
+ }
13
+
14
+ div.rack-payment div.errors p {
15
+ font-weight: bold;
16
+ font-size: 1.1em;
17
+ }
18
+
19
+ div.rack-payment ul.errors {
20
+ list-style-type: none;
21
+ }
22
+
23
+ /*
24
+ the first one shouldn't have a margin, or else the margins will overlap. we want:
25
+ 4% [ 44% ] 4% [ 44% ] 4%
26
+ */
27
+ div.rack-payment fieldset:first-child {
28
+ margin-right: 0;
29
+ }
30
+
31
+ div.rack-payment fieldset {
32
+ padding: 1%;
33
+ margin: 0;
34
+ width: 41%; /* should really be 42, i think ... but it works */
35
+ margin-left: 4%;
36
+ margin-right: 4%;
37
+ float: left;
38
+ text-align: left;
39
+ -moz-border-radius: 1em;
40
+ -webkit-border-radius: 1em;
41
+ -moz-box-shadow: 0.4em 0.4em 0.5em #3d4e5e;
42
+ -webkit-box-shadow: 0.4em 0.4em 0.5em #3d4e5e;
43
+ }
44
+
45
+ div.rack-payment fieldset legend {
46
+ font-weight: bold;
47
+ }
48
+
49
+ div.rack-payment fieldset .group {
50
+ float: left;
51
+ width: 48%;
52
+ margin-right: 2%;
53
+ }
54
+
55
+ div.rack-payment form {
56
+ padding: 0;
57
+ margin: 0;
58
+ }
59
+
60
+ div.rack-payment form label {
61
+ display: block;
62
+ margin-top: 0.5em;
63
+ }
64
+
65
+ div.rack-payment form input[type=submit] {
66
+ margin: auto;
67
+ }
68
+
69
+ div.rack-payment #complete_purchase {
70
+ padding-top: 1em;
71
+ clear: left;
72
+ }
@@ -0,0 +1,82 @@
1
+ <%
2
+ # TODO use helper for select options for credit card type
3
+ # TODO use helper for select options for expiration
4
+ %>
5
+
6
+ <div class='rack-payment'>
7
+ <% if errors and not errors.empty? %>
8
+ <div class='errors'>
9
+ <p>There were problems processing your request:</p>
10
+ <ul class='errors'>
11
+ <% for error in errors %>
12
+ <li><%= error %></li>
13
+ <% end %>
14
+ </ul>
15
+ </div>
16
+ <% end %>
17
+
18
+ <form action='<%= post_to %>' method='post'>
19
+
20
+ <fieldset>
21
+ <legend>Credit Card</legend>
22
+
23
+ <div class='group'>
24
+ <label for='credit_card_first_name'>First Name</label>
25
+ <input type='text' id='credit_card_first_name' name='credit_card[first_name]' value='<%= credit_card.first_name %>' autofocus='true' />
26
+
27
+ <label for='credit_card_last_name'>Last Name</label>
28
+ <input type='text' id='credit_card_last_name' name='credit_card[last_name]' value='<%= credit_card.last_name %>' />
29
+
30
+ <label for='credit_card_number'>Card Number</label>
31
+ <input type='text' id='credit_card_number' name='credit_card[number]' value='<%= credit_card.number %>' />
32
+ </div>
33
+
34
+ <div class='group'>
35
+ <label for='credit_card_type'>Card Type</label>
36
+ <select id='credit_card_type' name='credit_card[type]' />
37
+ <%= options_for_credit_card_type credit_card.type %>
38
+ <%= [ ['visa', 'Visa'], ['master', 'MasterCard'], ['american_express', 'American Express'], ['discover', 'Discover'] ].
39
+ map {|value, name|
40
+ selected = credit_card.type == value ? " selected='selected'" : nil
41
+ "<option value='#{ value }'#{ selected }'>#{ name }</option>" }
42
+ %>
43
+ </select>
44
+
45
+ <label for='credit_card_cvv'>CVV</label>
46
+ <input type='text' id='credit_card_cvv' name='credit_card[cvv]' value='<%= credit_card.cvv %>' />
47
+
48
+ <label for='credit_card_expiration_month'>Expiration</label>
49
+ <select id='credit_card_expiration_month' name='credit_card[expiration_month]'>
50
+ <%= options_for_expiration_month credit_card.month %>
51
+ </select>
52
+ <select id='credit_card_expiration_year' name='credit_card[expiration_year]'>
53
+ <%= options_for_expiration_year credit_card.year %>
54
+ </select>
55
+
56
+ </div>
57
+ </fieldset>
58
+
59
+ <fieldset>
60
+ <legend>Billing Address</legend>
61
+
62
+ <div class='group'>
63
+ <% %w( name address1 city ).each do |field| %>
64
+ <label for='credit_card_<%= field %>'><%= field.gsub('_', ' ').capitalize %></label>
65
+ <input type='text' id='billing_address_<%= field %>' name='billing_address[<%= field %>]' value='<%= billing_address[field] %>' />
66
+ <% end %>
67
+ </div>
68
+
69
+ <div class='group'>
70
+ <% %w( state country zip ).each do |field| %>
71
+ <label for='credit_card_<%= field %>'><%= field.gsub('_', ' ').capitalize %></label>
72
+ <input type='text' id='billing_address_<%= field %>' name='billing_address[<%= field %>]' value='<%= billing_address[field] %>' />
73
+ <% end %>
74
+ </div>
75
+ </fieldset>
76
+
77
+ <div id='complete_purchase'>
78
+ <input type='submit' value='Complete Purchase' />
79
+ </div>
80
+
81
+ </form>
82
+ </div>
@@ -0,0 +1,10 @@
1
+ <?xml version='1.0' encoding='utf-8' ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html>
4
+ <head>
5
+ <title>Complete Purchase</title>
6
+ </head>
7
+ <body>
8
+ CONTENT
9
+ </body>
10
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-payment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - remi
@@ -39,6 +39,9 @@ files:
39
39
  - lib/rack-payment/helper.rb
40
40
  - lib/rack-payment/billing_address.rb
41
41
  - lib/rack-payment/methods.rb
42
+ - lib/rack-payment/views/credit-card-and-billing-info-form.html.erb
43
+ - lib/rack-payment/views/credit-card-and-billing-info-form.css
44
+ - lib/rack-payment/views/layout.html
42
45
  - lib/rack-payment.rb
43
46
  - lib/rack/payment.rb
44
47
  - lib/rack/payment/test.rb