samurai 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/samurai.css +40 -0
- data/app/views/application/_errors.html.erb +2 -2
- data/app/views/application/_payment_method_form.html.erb +63 -59
- data/app/views/application/_transaction.html.erb +1 -0
- data/lib/samurai/version.rb +1 -1
- metadata +13 -13
- data/app/views/application/_transaction_form.html.erb +0 -46
@@ -0,0 +1,40 @@
|
|
1
|
+
.samurai fieldset {
|
2
|
+
border: none;
|
3
|
+
}
|
4
|
+
|
5
|
+
.samurai span {
|
6
|
+
float: left;
|
7
|
+
margin: 0 6px 15px 0;
|
8
|
+
}
|
9
|
+
|
10
|
+
.samurai label {
|
11
|
+
display: block;
|
12
|
+
font-family: sans-serif;
|
13
|
+
font-weight: bold;
|
14
|
+
line-height: 1.5;
|
15
|
+
}
|
16
|
+
|
17
|
+
.samurai .field-group {
|
18
|
+
overflow: hidden;
|
19
|
+
}
|
20
|
+
|
21
|
+
.samurai .field-group div {
|
22
|
+
margin-bottom: 15px;
|
23
|
+
}
|
24
|
+
|
25
|
+
.samurai input {
|
26
|
+
padding: 5px;
|
27
|
+
width: 310px;
|
28
|
+
}
|
29
|
+
|
30
|
+
.samurai #credit_card_name_group input {
|
31
|
+
width: 145px;
|
32
|
+
}
|
33
|
+
|
34
|
+
.samurai #credit_card_card_number{
|
35
|
+
width: 240px;
|
36
|
+
}
|
37
|
+
|
38
|
+
.samurai #credit_card_cvv {
|
39
|
+
width: 50px;
|
40
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<% transaction ||= Samurai::Transaction.new %>
|
2
|
-
<% payment_method ||= Samurai::PaymentMethod.new %>
|
1
|
+
<% transaction ||= (@transaction || Samurai::Transaction.new) %>
|
2
|
+
<% payment_method ||= (@payment_method || Samurai::PaymentMethod.new) %>
|
3
3
|
<% if transaction.errors.any? || payment_method.errors.any? %>
|
4
4
|
<div id="error_explanation">
|
5
5
|
<h4>This transaction could not be processed:</h4>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% sandbox ||= false %>
|
2
|
-
<% payment_method ||= Samurai::PaymentMethod.new %>
|
3
|
-
<form action="<%= Samurai.site %>/payment_methods" method="POST">
|
2
|
+
<% payment_method ||= (@payment_method || Samurai::PaymentMethod.new) %>
|
3
|
+
<form action="<%= Samurai.site %>/payment_methods" method="POST" class="samurai payment_method">
|
4
4
|
<fieldset>
|
5
5
|
<input name="redirect_url" type="hidden" value="<%= redirect_url %>" />
|
6
6
|
<input name="merchant_key" type="hidden" value="<%= Samurai.options[:merchant_key] %>" />
|
@@ -8,78 +8,82 @@
|
|
8
8
|
</fieldset>
|
9
9
|
|
10
10
|
<fieldset>
|
11
|
-
<div class="field-group">
|
12
|
-
<
|
13
|
-
<label for="credit_card_first_name">First name</label
|
11
|
+
<div class="field-group" id="credit_card_name_group">
|
12
|
+
<span>
|
13
|
+
<label for="credit_card_first_name">First name</label>
|
14
14
|
<input id="credit_card_first_name" name="credit_card[first_name]" size="30" type="text" value="<%= payment_method.first_name %>" />
|
15
|
-
</
|
16
|
-
<
|
17
|
-
<label for="credit_card_last_name">Last name</label
|
15
|
+
</span>
|
16
|
+
<span>
|
17
|
+
<label for="credit_card_last_name">Last name</label>
|
18
18
|
<input id="credit_card_last_name" name="credit_card[last_name]" size="30" type="text" value="<%= payment_method.last_name %>" />
|
19
|
-
</
|
19
|
+
</span>
|
20
20
|
</div>
|
21
21
|
|
22
|
-
<
|
23
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<
|
28
|
-
|
29
|
-
|
22
|
+
<div class="field-group" id="credit_card_address_group">
|
23
|
+
<div>
|
24
|
+
<label for="credit_card_address_1">Address 1</label>
|
25
|
+
<input class="span-6" id="credit_card_address_1" name="credit_card[address_1]" size="30" type="text" value="<%= payment_method.address_1 %>" />
|
26
|
+
</div>
|
27
|
+
<div>
|
28
|
+
<label for="credit_card_address_2">Address 2</label>
|
29
|
+
<input class="span-6" id="credit_card_address_2" name="credit_card[address_2]" size="30" type="text" value="<%= payment_method.address_2 %>" />
|
30
|
+
</div>
|
31
|
+
</div>
|
30
32
|
|
31
|
-
<div class="field-group">
|
32
|
-
<
|
33
|
-
<label for="credit_card_city">City</label
|
33
|
+
<div class="field-group" id="location_group">
|
34
|
+
<div>
|
35
|
+
<label for="credit_card_city">City</label>
|
34
36
|
<input id="credit_card_city" name="credit_card[city]" size="30" type="text" value="<%= payment_method.city %>" />
|
35
|
-
</
|
36
|
-
<
|
37
|
-
<label for="credit_card_state">State</label
|
37
|
+
</div>
|
38
|
+
<div>
|
39
|
+
<label for="credit_card_state">State</label>
|
38
40
|
<input class="span-1" id="credit_card_state" name="credit_card[state]" size="30" type="text" value="<%= payment_method.state %>" />
|
39
|
-
</
|
40
|
-
<
|
41
|
-
<label for="credit_card_zip">Zip</label
|
41
|
+
</div>
|
42
|
+
<div>
|
43
|
+
<label for="credit_card_zip">Zip</label>
|
42
44
|
<input class="span-2" id="credit_card_zip" name="credit_card[zip]" size="30" type="text" value="<%= payment_method.zip %>" />
|
43
|
-
</
|
45
|
+
</div>
|
44
46
|
</div>
|
45
47
|
</fieldset>
|
46
48
|
|
47
49
|
<fieldset>
|
48
|
-
<div class="field-group">
|
49
|
-
<
|
50
|
-
<label for="credit_card_card_number">Card Number</label
|
50
|
+
<div class="field-group" id="credit_card_info_group">
|
51
|
+
<span>
|
52
|
+
<label for="credit_card_card_number">Card Number</label>
|
51
53
|
<input id="credit_card_card_number" name="credit_card[card_number]" size="30" type="text" value="<%= payment_method.card_number %>" />
|
52
|
-
</
|
53
|
-
<
|
54
|
-
<label for="credit_card_cvv">CVV</label
|
54
|
+
</span>
|
55
|
+
<span>
|
56
|
+
<label for="credit_card_cvv">CVV</label>
|
55
57
|
<input class="span-1" id="credit_card_cvv" name="credit_card[cvv]" size="30" type="text" value="<%= payment_method.cvv %>" />
|
56
|
-
</
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
</
|
73
|
-
<
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
</
|
81
|
-
|
58
|
+
</span>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div>
|
62
|
+
<label for="credit_card_expiry_month">Expires on</label>
|
63
|
+
<select id="credit_card_expiry_month" name="credit_card[expiry_month]">
|
64
|
+
<option value="1" <%= 'selected' if payment_method.expiry_month.to_s=='1' %>>01</option>
|
65
|
+
<option value="2" <%= 'selected' if payment_method.expiry_month.to_s=='2' %>>02</option>
|
66
|
+
<option value="3" <%= 'selected' if payment_method.expiry_month.to_s=='3' %>>03</option>
|
67
|
+
<option value="4" <%= 'selected' if payment_method.expiry_month.to_s=='4' %>>04</option>
|
68
|
+
<option value="5" <%= 'selected' if payment_method.expiry_month.to_s=='5' %>>05</option>
|
69
|
+
<option value="6" <%= 'selected' if payment_method.expiry_month.to_s=='6' %>>06</option>
|
70
|
+
<option value="7" <%= 'selected' if payment_method.expiry_month.to_s=='7' %>>07</option>
|
71
|
+
<option value="8" <%= 'selected' if payment_method.expiry_month.to_s=='8' %>>08</option>
|
72
|
+
<option value="9" <%= 'selected' if payment_method.expiry_month.to_s=='9' %>>09</option>
|
73
|
+
<option value="10" <%= 'selected' if payment_method.expiry_month.to_s=='10' %>>10</option>
|
74
|
+
<option value="11" <%= 'selected' if payment_method.expiry_month.to_s=='11' %>>11</option>
|
75
|
+
<option value="12" <%= 'selected' if payment_method.expiry_month.to_s=='12' %>>12</option>
|
76
|
+
</select>
|
77
|
+
<select id="credit_card_expiry_year" name="credit_card[expiry_year]">
|
78
|
+
<option value="2011" <%= 'selected' if payment_method.expiry_year.to_s=='2011' %>>2011</option>
|
79
|
+
<option value="2012" <%= 'selected' if payment_method.expiry_year.to_s=='2012' %>>2012</option>
|
80
|
+
<option value="2013" <%= 'selected' if payment_method.expiry_year.to_s=='2013' %>>2013</option>
|
81
|
+
<option value="2014" <%= 'selected' if payment_method.expiry_year.to_s=='2014' %>>2014</option>
|
82
|
+
<option value="2015" <%= 'selected' if payment_method.expiry_year.to_s=='2015' %>>2015</option>
|
83
|
+
<option value="2016" <%= 'selected' if payment_method.expiry_year.to_s=='2016' %>>2016</option>
|
84
|
+
</select>
|
82
85
|
</div>
|
86
|
+
|
83
87
|
</fieldset>
|
84
88
|
|
85
89
|
<button type='submit' class='button blue'>Submit Payment</button>
|
data/lib/samurai/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samurai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-29 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activeresource
|
17
|
-
requirement: &
|
17
|
+
requirement: &70212280242520 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 2.2.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70212280242520
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: bundler
|
28
|
-
requirement: &
|
28
|
+
requirement: &70212280242060 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70212280242060
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec
|
39
|
-
requirement: &
|
39
|
+
requirement: &70212280241600 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 2.6.0
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70212280241600
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: fakeweb
|
50
|
-
requirement: &
|
50
|
+
requirement: &70212280241220 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70212280241220
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: ruby-debug19
|
61
|
-
requirement: &
|
61
|
+
requirement: &70212280240720 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70212280240720
|
70
70
|
description: If you are an online merchant and using samurai.feefighters.com, this
|
71
71
|
gem will make your life easy. Integrate with the samurai.feefighters.com portal
|
72
72
|
and process transaction.
|
@@ -83,10 +83,10 @@ files:
|
|
83
83
|
- Gemfile.lock
|
84
84
|
- README.markdown
|
85
85
|
- Rakefile
|
86
|
+
- app/assets/stylesheets/samurai.css
|
86
87
|
- app/views/application/_errors.html.erb
|
87
88
|
- app/views/application/_payment_method_form.html.erb
|
88
89
|
- app/views/application/_transaction.html.erb
|
89
|
-
- app/views/application/_transaction_form.html.erb
|
90
90
|
- lib/samurai.rb
|
91
91
|
- lib/samurai/base.rb
|
92
92
|
- lib/samurai/cacheable_by_token.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
<% authenticity_token ||= '' %>
|
2
|
-
<% transaction ||= Samurai::Transaction.new %>
|
3
|
-
<form accept-charset="UTF-8" action="<%= post_url %>" class="new_transaction" id="new_transaction" method="post">
|
4
|
-
<%= authenticity_token %>
|
5
|
-
<input id="processor_token" name="processor_token" type="hidden" value="<%= processor_token %>"/>
|
6
|
-
<input id="payment_method_token" name="payment_method_token" type="hidden" value="<%= payment_method.payment_method_token %>"/>
|
7
|
-
<input id="transaction_custom" name="transaction[custom]" type="hidden" value="" />
|
8
|
-
|
9
|
-
<p>
|
10
|
-
<label for="transaction_type">Transaction type</label><br/>
|
11
|
-
<select id="transaction_type" name="transaction_type">
|
12
|
-
<option value="purchase">Purchase</option>
|
13
|
-
<option value="authorize">Authorize Only</option>
|
14
|
-
</select>
|
15
|
-
</p>
|
16
|
-
|
17
|
-
<div class="field-group">
|
18
|
-
<p>
|
19
|
-
<label for="amount">Amount</label><br/>
|
20
|
-
<input id="amount" name="amount" size="30" type="text" value="<%= transaction.amount %>"/>
|
21
|
-
</p>
|
22
|
-
<p>
|
23
|
-
<label for="transaction_currency_code">Currency code</label><br/>
|
24
|
-
<input class="span-1" id="transaction_currency_code" name="transaction[currency_code]" size="30" type="text" value="<%= transaction.currency_code %>"/>
|
25
|
-
</p>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div class="field-group">
|
29
|
-
<p>
|
30
|
-
<label for="transaction_billing_reference">Billing Reference</label><br/>
|
31
|
-
<input id="transaction_billing_reference" name="transaction[billing_reference]" size="30" type="text" value="<%= transaction.billing_reference %>"/>
|
32
|
-
</p>
|
33
|
-
<p>
|
34
|
-
<label for="transaction_customer_reference">Customer Reference</label><br/>
|
35
|
-
<input id="transaction_customer_reference" name="transaction[customer_reference]" size="30" type="text" value="<%= transaction.customer_reference %>"/>
|
36
|
-
</p>
|
37
|
-
</div>
|
38
|
-
<p>
|
39
|
-
<label for="transaction_descriptor">Description</label><br/>
|
40
|
-
<input id="transaction_descriptor" name="transaction[descriptor]" size="30" type="text" value="<%= transaction.descriptor %>"/>
|
41
|
-
</p>
|
42
|
-
|
43
|
-
<p>
|
44
|
-
<input class="button red" name="commit" type="submit" value="Submit Transaction"/>
|
45
|
-
</p>
|
46
|
-
</form>
|