def test_single_stripe_fee(self): charge = Decimal('100.0000') # fractional pct = 0.03 # flat fee = 0.00 stripe_fee = Decimal('3.3000') fees = {'stripe-transaction': stripe_fee} total = Decimal('103.3000') ret = payment.total_after_fees(charge, fees=(self.stripe_fee, )) assert_equal(charge, ret['charge']['initial']) assert_equal(total, ret['charge']['final']) for fee in ret['fees']: assert_equal(fees[fee['name']], fee['fee'])
def test_multiple_with_stripe_fee(self): charge = Decimal('100.0000') # fractional pct = 0.029 # flat fee = 0.30 stripe_fee = Decimal('3.3900') # fractional pct = 0.03 # flat fee = 0.00 poold_fee = Decimal('3.0000') fees = {'poold-transaction': poold_fee, 'stripe-transaction': stripe_fee} total = Decimal('106.3900') ret = payment.total_after_fees(charge, fees=(self.stripe_fee, self.poold_fee)) assert_equal(charge, ret['charge']['initial']) assert_equal(total, ret['charge']['final']) for fee in ret['fees']: assert_equal(fees[fee['name']], fee['fee'])
def test_multiple_with_stripe_fee(self): charge = Decimal('100.0000') # fractional pct = 0.029 # flat fee = 0.30 stripe_fee = Decimal('3.3900') # fractional pct = 0.03 # flat fee = 0.00 poold_fee = Decimal('3.0000') fees = { 'poold-transaction': poold_fee, 'stripe-transaction': stripe_fee } total = Decimal('106.3900') ret = payment.total_after_fees(charge, fees=(self.stripe_fee, self.poold_fee)) assert_equal(charge, ret['charge']['initial']) assert_equal(total, ret['charge']['final']) for fee in ret['fees']: assert_equal(fees[fee['name']], fee['fee'])