-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #396 from sharetribe/seller-commission
Checkout Finland seller commission
- Loading branch information
Showing
61 changed files
with
396 additions
and
363 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
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
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
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
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,7 +1,20 @@ | ||
class BraintreePayment < Payment | ||
attr_accessor :credit_card_number, :credit_card_expiration_date, :cardholder_name, :cvv | ||
attr_accessible :braintree_transaction_id | ||
|
||
monetize :sum_cents, :allow_nil => true | ||
|
||
def sum_exists? | ||
!sum_cents.nil? | ||
end | ||
|
||
def total_sum | ||
sum_cents.to_f / 100 | ||
sum | ||
end | ||
|
||
# Build default payment sum by listing | ||
# Note: Consider removing this :( | ||
def default_sum(listing, vat=0) | ||
self.sum = listing.price | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
class CheckoutPayment < Payment | ||
# Currently this model is empty, but because of table inheritance we need this | ||
|
||
has_many :rows, :class_name => "PaymentRow", :foreign_key => "payment_id" | ||
|
||
def initialize_rows(community) | ||
if community.vat | ||
self.rows = [PaymentRow.new, PaymentRow.new, PaymentRow.new] | ||
else | ||
self.rows = [PaymentRow.new] | ||
end | ||
end | ||
|
||
def sum_exists? | ||
!rows.empty? | ||
end | ||
|
||
def summary_string | ||
rows.collect(&:title).join(", ") | ||
end | ||
|
||
# Total payment that will be charged from the payer's account | ||
def total_sum | ||
rows.collect(&:sum_with_vat).sum | ||
end | ||
|
||
# Build default payment sum by listing | ||
# Note: Consider removing this :( | ||
def default_sum(listing, vat=0) | ||
rows.build(title: listing.title, currency: listing.currency, sum: listing.price, vat: vat) | ||
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
Oops, something went wrong.