Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Bolton
committed
May 13, 2012
1 parent
1f7bfef
commit 5f87594
Showing
5 changed files
with
42 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
class OrgCharge < ActiveRecord::Base | ||
belongs_to :organization | ||
validates_uniqueness_of :stripe_id, scope: :organization_id | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddAmountToOrgCharge < ActiveRecord::Migration | ||
def change | ||
add_column :org_charges, :amount, :integer | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
task :gen_fees => :environment do | ||
Organization.all.each do |organization| | ||
Stripe.api_key = organization.stripe_secret | ||
transactions = CampersCourses.where(org_id: organization.id).map{|c| c.stripe_id}.uniq | ||
if transactions.present? | ||
transactions.each{ |id| | ||
amount = Stripe::Charge.retrieve(id).amount * 0.021 | ||
organization.org_charges.create(stripe_id: id, amount: amount) | ||
} | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.