fix teacher payment code
This commit is contained in:
parent
fb70455829
commit
1491e9026e
|
|
@ -115,6 +115,8 @@ module JamRuby
|
|||
if teacher_split && teacher_split > 0
|
||||
teacher_dist = TeacherDistribution.create_for_lesson_package_purchase(purchase, false, (teacher_split / 100.0).round(2), retailer_rate)
|
||||
purchase.teacher_distributions << teacher_dist
|
||||
# price should always match the teacher_distribution, if there is one
|
||||
purchase.price = teacher_dist.real_distribution_in_cents / 100
|
||||
end
|
||||
|
||||
if retailer_split && retailer_split > 0
|
||||
|
|
@ -128,7 +130,7 @@ module JamRuby
|
|||
teacher_dist = TeacherDistribution.create_for_lesson_package_purchase(purchase, false)
|
||||
purchase.teacher_distributions << teacher_dist
|
||||
# price should always match the teacher_distribution, if there is one
|
||||
#purchase.price = teacher_dist.amount_in_cents / 100
|
||||
purchase.price = teacher_dist.real_distribution_in_cents / 100
|
||||
|
||||
if lesson_booking.school_on_school_payment?
|
||||
teacher_dist = TeacherDistribution.create_for_lesson_package_purchase(purchase, true)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ module JamRuby
|
|||
:currency => "usd",
|
||||
:customer => APP_CONFIG.stripe[:source_customer],
|
||||
:description => construct_description,
|
||||
:metadata => metadata
|
||||
:metadata => metadata,
|
||||
:destination => teacher.teacher.stripe_account_id
|
||||
)
|
||||
|
||||
stripe_charge
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ describe TeacherPayment do
|
|||
teacher_distribution = payment.teacher_payment_charge.distribution
|
||||
teacher_distribution.amount_in_cents.should eql 1000
|
||||
charge = Stripe::Charge.retrieve(payment.teacher_payment_charge.stripe_charge_id)
|
||||
charge.destination.should be_nil
|
||||
charge.destination.should_not be_nil
|
||||
charge.amount.should eql 726
|
||||
charge.application_fee.should be_nil
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue