radiant-shop-extension 0.92.8 → 0.92.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.92.8
1
+ 0.92.9
@@ -56,6 +56,7 @@ class FormCheckout
56
56
  end
57
57
 
58
58
  if purchase
59
+ assign_notes
59
60
  create_payment
60
61
  finalize_checkout
61
62
  @form.redirect_to = success_redirect
@@ -72,6 +73,10 @@ class FormCheckout
72
73
  @result[:gateway]
73
74
  end
74
75
 
76
+ def assign_notes
77
+ @order.update_attribute(:notes, notes) if notes.present?
78
+ end
79
+
75
80
  # Creates a payment object attached to the order
76
81
  def create_payment
77
82
  payment = ShopPayment.new({
@@ -161,6 +166,11 @@ class FormCheckout
161
166
  @config[:test].present? ? :test : :production
162
167
  end
163
168
 
169
+ # Returns the notes on the order
170
+ def notes
171
+ @data[:notes]
172
+ end
173
+
164
174
  # Returns the submitted card attributes
165
175
  def card
166
176
  @data[:credit_card]
@@ -53,7 +53,7 @@ module Shop
53
53
  end
54
54
 
55
55
  # Display the cart id / status
56
- [:id, :status, :quantity, :weight].each do |symbol|
56
+ [:id, :status, :quantity, :weight, :notes].each do |symbol|
57
57
  desc %{ outputs the #{symbol} to the cart }
58
58
  tag "shop:cart:#{symbol}" do |tag|
59
59
  tag.locals.shop_order.send(symbol)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-shop-extension}
8
- s.version = "0.92.8"
8
+ s.version = "0.92.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dirk Kelly", "John Barker", "Darcy Laycock"]
@@ -33,6 +33,7 @@ class FormsDataset < Dataset::Base
33
33
  </li>
34
34
  </ol>
35
35
  </div>
36
+ <r:text name='notes' value="some note"/>
36
37
  <ol class="credit_card">
37
38
  <li>
38
39
  <r:label for='credit_card[name]'>Name on Card</r:label>
@@ -117,8 +118,9 @@ CONFIG
117
118
  :year => 2012,
118
119
  :type => 'visa'
119
120
  },
121
+ :notes => 'some note',
120
122
  :options => {
121
- :address => {
123
+ :address => {
122
124
  :address1 => 'address',
123
125
  :zip => 'zip'
124
126
  }
@@ -21,6 +21,7 @@ describe Shop::Tags::Cart do
21
21
  'shop:cart:status',
22
22
  'shop:cart:quantity',
23
23
  'shop:cart:weight',
24
+ 'shop:cart:notes',
24
25
  'shop:cart:price'].sort
25
26
  end
26
27
 
@@ -211,6 +212,12 @@ describe Shop::Tags::Cart do
211
212
  tag = %{<r:shop:cart:weight />}
212
213
  expected = @order.weight.to_s
213
214
 
215
+ @page.should render(tag).as(expected)
216
+ end
217
+ it 'should render <r:notes />' do
218
+ tag = %{<r:shop:cart:notes />}
219
+ expected = @order.notes.to_s
220
+
214
221
  @page.should render(tag).as(expected)
215
222
  end
216
223
  end
@@ -41,9 +41,17 @@ describe FormCheckout do
41
41
  @checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
42
42
  result = @checkout.create
43
43
 
44
- @order.payment.card_number.should === "XXXX-XXXX-XXXX-1"
45
- @order.payment.card_type.should === @data[:credit_card][:type]
46
- @order.payment.amount.should === @order.price
44
+ @order.payment.card_number.should === "XXXX-XXXX-XXXX-1"
45
+ @order.payment.card_type.should === @data[:credit_card][:type]
46
+ @order.payment.amount.should === @order.price
47
+ end
48
+
49
+ it 'should assign the note' do
50
+ mock.instance_of(ActiveMerchant::Billing::CreditCard).valid? { true }
51
+ @checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
52
+ result = @checkout.create
53
+
54
+ shop_orders(:several_items).notes.should === 'some note'
47
55
  end
48
56
 
49
57
  it 'should assign session shop_order to nil' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-shop-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 383
4
+ hash: 381
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 92
9
- - 8
10
- version: 0.92.8
9
+ - 9
10
+ version: 0.92.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dirk Kelly