@@ -513,11 +513,13 @@ def test_accounts_transfer(self):
513
513
order .debit_from (source = card , amount = 1234 )
514
514
payable_account = merchant .payable_account
515
515
self .assertEqual (payable_account .balance , 0 )
516
- account_credit = payable_account .credit (amount = 1234 , order = order .href ,
517
- appears_on_statement_as = 'Payout' )
516
+ account_credit = payable_account .credit (
517
+ amount = 1234 , order = order .href ,
518
+ appears_on_statement_as = 'Payout' )
519
+ payable_account = merchant .payable_account
518
520
self .assertEqual (account_credit .status , 'succeeded' )
519
521
self .assertEqual (payable_account .balance , 1234 )
520
- self .assertEqual (account_credit .account_credit , 'Payout' )
522
+ self .assertEqual (account_credit .appears_on_statement_as , 'Payout' )
521
523
522
524
def test_accounts_transfer_from_multiple_orders (self ):
523
525
merchant = balanced .Customer ().save ()
@@ -530,11 +532,13 @@ def test_accounts_transfer_from_multiple_orders(self):
530
532
order_one .debit_from (source = card , amount = amount )
531
533
account_credit_one = payable_account .credit (amount = amount ,
532
534
order = order_one .href )
535
+ payable_account = merchant .payable_account
533
536
self .assertEqual (payable_account .balance , amount )
534
537
order_two = merchant .create_order ()
535
538
order_two .debit_from (source = card , amount = amount )
536
539
account_credit_two = payable_account .credit (amount = amount ,
537
540
order = order_two .href )
541
+ payable_account = merchant .payable_account
538
542
self .assertEqual (payable_account .balance , amount * 2 )
539
543
540
544
def test_settlement (self ):
@@ -544,8 +548,9 @@ def test_settlement(self):
544
548
545
549
order .debit_from (source = card , amount = 1234 )
546
550
payable_account = merchant .payable_account
547
- account_credit = payable_account .credit (amount = 1234 , order = order .href ,
548
- appears_on_statement_as = 'Payout' )
551
+ account_credit = payable_account .credit (
552
+ amount = 1234 , order = order .href , appears_on_statement_as = 'Payout' )
553
+ payable_account = merchant .payable_account
549
554
self .assertEqual (payable_account .balance , 1234 )
550
555
bank_account = balanced .BankAccount (
551
556
account_number = '1234567890' ,
@@ -559,9 +564,10 @@ def test_settlement(self):
559
564
appears_on_statement_as = "Settlement Oct" ,
560
565
description = "Settlement for payouts from October" )
561
566
self .assertEqual (settlement .amount , 1234 )
562
- self .assertEqual (settlement .appears_on_statement_as , "Settlement Oct" )
567
+ self .assertEqual (settlement .appears_on_statement_as , "BAL* Settlement Oct" )
563
568
self .assertEqual (settlement .description ,
564
569
"Settlement for payouts from October" )
570
+ payable_account = merchant .payable_account
565
571
self .assertEqual (payable_account .balance , 0 )
566
572
567
573
def test_reverse_settlement (self ):
@@ -573,6 +579,7 @@ def test_reverse_settlement(self):
573
579
payable_account = merchant .payable_account
574
580
account_credit = payable_account .credit (amount = 1234 , order = order .href ,
575
581
appears_on_statement_as = 'Payout' )
582
+ payable_account = merchant .payable_account
576
583
self .assertEqual (payable_account .balance , 1234 )
577
584
578
585
bank_account = balanced .BankAccount (
@@ -586,12 +593,19 @@ def test_reverse_settlement(self):
586
593
funding_instrument = bank_account .href ,
587
594
appears_on_statement_as = "Settlement Oct" ,
588
595
description = "Settlement for payouts from October" )
596
+ payable_account = merchant .payable_account
589
597
self .assertEqual (payable_account .balance , 0 )
590
598
591
- credit_from_escrow = payable_account .credit (amount = 1234 )
599
+ order_two = merchant .create_order ()
600
+ order_two .debit_from (source = card , amount = 1234 )
601
+ account_credit_two = payable_account .credit (amount = 1234 ,
602
+ order = order_two .href )
603
+
604
+ payable_account = merchant .payable_account
592
605
self .assertEqual (payable_account .balance , 1234 )
593
606
594
607
account_credit .reverse (amount = 1234 )
608
+ payable_account = merchant .payable_account
595
609
self .assertEqual (payable_account .balance , 0 )
596
610
597
611
def test_reverse_settlement_with_negative_account_balance (self ):
@@ -614,15 +628,18 @@ def test_reverse_settlement_with_negative_account_balance(self):
614
628
funding_instrument = bank_account .href ,
615
629
appears_on_statement_as = "Settlement Oct" ,
616
630
description = "Settlement for payouts from October" )
631
+ payable_account = merchant .payable_account
617
632
self .assertEqual (payable_account .balance , 0 )
618
633
619
634
account_credit .reverse (amount = 1234 )
635
+ payable_account = merchant .payable_account
620
636
self .assertEqual (payable_account .balance , - 1234 )
621
637
622
638
settlement = payable_account .settle (
623
639
funding_instrument = bank_account .href ,
624
640
appears_on_statement_as = "Settlement Oct" ,
625
641
description = "Settlement for payouts from October" )
642
+ payable_account = merchant .payable_account
626
643
self .assertEqual (payable_account .balance , 0 )
627
644
628
645
0 commit comments