paid_up 0.9.14 → 0.9.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bf978e51d7d4fdba2c09b1410722a56342e63af
4
- data.tar.gz: 0164070ba66ee76293a1f7fefa579170671775e3
3
+ metadata.gz: 3f805874f1b94131d06b0bdb3b42f85fc3da9dff
4
+ data.tar.gz: b1c965b77e62b3db733795f02d665b56ba66b97d
5
5
  SHA512:
6
- metadata.gz: a07f651feba3290f6d59ee81d8585ced8afba55f117fe05b543e87a2d5d72445a5ef59b705b8f80988c1cc4e2e1cbdc7090d0c1e15ac4cda2513c1380c167a57
7
- data.tar.gz: 8c4a8e15bc2a6daed2cf286b2dfb705d059efeae6d1c0ac389fa4bfa3cd14ed00515922fc6fe735484b25345b744addfef7579f859c486b2b10c7b67357e5540
6
+ metadata.gz: 6451990417603852a3770d695a09502f0fca7315fae5ad83913fc2c9dfccbda82e53088c5d3eb3a3862cbd97df985b43dd03b80e662f9f17d33b064c519976a0
7
+ data.tar.gz: 649f2534cea6300a0cefc649f4927b703f37c2d187b0278799041801f645cf01dc3846275841e6c1d98198c5e276cf2bad8baa87079c3898172e6362923bc53c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.14
1
+ 0.9.15
@@ -17,6 +17,18 @@ module PaidUp
17
17
  # @plan set by #set_plan
18
18
  current_user.update_attribute(:coupon_code, params[:coupon_code])
19
19
  if current_user.subscribe_to_plan(@plan, params[:stripeToken])
20
+ discount = current_user.stripe_data.discount
21
+ if !discount.nil? && !discount.coupon.nil? && @plan.amount != 0
22
+ orig_amount = @plan.amount
23
+ amount = orig_amount
24
+ amount -= (discount.coupon.percent_off || 0) * 0.01 * amount
25
+ amount -= (discount.coupon.amount_off || 0)
26
+ amount = amount > 0 ? amount : 0
27
+ money = Money.new(amount, @plan.currency)
28
+ else
29
+ money = @plan.money
30
+ end
31
+ flash[:paid_up_subscription] = money.format
20
32
  redirect_to(
21
33
  subscriptions_path,
22
34
  flash: {
data/paid_up.gemspec CHANGED
@@ -2,16 +2,16 @@
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: paid_up 0.9.14 ruby lib
5
+ # stub: paid_up 0.9.15 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "paid_up"
9
- s.version = "0.9.14"
9
+ s.version = "0.9.15"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Karen Lundgren"]
14
- s.date = "2016-03-04"
14
+ s.date = "2016-03-15"
15
15
  s.description = "Allows a model of your choosing (such as users) to subscribe to a plan, which enables features."
16
16
  s.email = "karen.e.lundgren@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -146,7 +146,6 @@ Gem::Specification.new do |s|
146
146
  "spec/dummy/lib/assets/.keep",
147
147
  "spec/dummy/lib/tasks/system.rake",
148
148
  "spec/dummy/log/.keep",
149
- "spec/dummy/log/development.log",
150
149
  "spec/dummy/public/404.html",
151
150
  "spec/dummy/public/422.html",
152
151
  "spec/dummy/public/500.html",
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paid_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Lundgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -510,7 +510,6 @@ files:
510
510
  - spec/dummy/lib/assets/.keep
511
511
  - spec/dummy/lib/tasks/system.rake
512
512
  - spec/dummy/log/.keep
513
- - spec/dummy/log/development.log
514
513
  - spec/dummy/public/404.html
515
514
  - spec/dummy/public/422.html
516
515
  - spec/dummy/public/500.html