@@ -545,32 +545,6 @@ def create_checkout_session(self, owner: Owner, desired_plan):
545545 )
546546 return session ["id" ]
547547
548- def _is_unverified_payment_method (self , payment_method_id : str ) -> bool :
549- payment_method = stripe .PaymentMethod .retrieve (payment_method_id )
550-
551- is_us_bank_account = payment_method .type == "us_bank_account" and hasattr (
552- payment_method , "us_bank_account"
553- )
554- if is_us_bank_account :
555- setup_intents = stripe .SetupIntent .list (
556- payment_method = payment_method_id , limit = 1
557- )
558- if (
559- setup_intents
560- and hasattr (setup_intents , "data" )
561- and isinstance (setup_intents .data , list )
562- and len (setup_intents .data ) > 0
563- ):
564- latest_intent = setup_intents .data [0 ]
565- if (
566- latest_intent .status == "requires_action"
567- and latest_intent .next_action
568- and latest_intent .next_action .type == "verify_with_microdeposits"
569- ):
570- return True
571-
572- return False
573-
574548 @_log_stripe_error
575549 def update_payment_method (self , owner : Owner , payment_method ):
576550 log .info (
@@ -746,7 +720,8 @@ def create_setup_intent(self, owner: Owner) -> stripe.SetupIntent:
746720 customer = owner .stripe_customer_id ,
747721 )
748722
749- def _get_unverified_payment_methods (self , owner ):
723+ @_log_stripe_error
724+ def get_unverified_payment_methods (self , owner ):
750725 log .info (
751726 "Getting unverified payment methods" ,
752727 extra = dict (
@@ -768,11 +743,13 @@ def _get_unverified_payment_methods(self, owner):
768743 and intent .next_action
769744 and intent .next_action .get ("type" ) == "verify_with_microdeposits"
770745 ):
771- unverified_payment_methods .append (
772- {
773- "payment_method_id" : intent .payment_method ,
774- "hosted_verification_link" : intent .next_action .verify_with_microdeposits .hosted_verification_url ,
775- }
746+ unverified_payment_methods .extend (
747+ [
748+ {
749+ "payment_method_id" : intent .payment_method ,
750+ "hosted_verification_url" : intent .next_action .verify_with_microdeposits .hosted_verification_url ,
751+ }
752+ ]
776753 )
777754
778755 # Check setup intents
@@ -785,11 +762,13 @@ def _get_unverified_payment_methods(self, owner):
785762 and intent .next_action
786763 and intent .next_action .get ("type" ) == "verify_with_microdeposits"
787764 ):
788- unverified_payment_methods .append (
789- {
790- "payment_method_id" : intent .payment_method ,
791- "hosted_verification_link" : intent .next_action .verify_with_microdeposits .hosted_verification_url ,
792- }
765+ unverified_payment_methods .extend (
766+ [
767+ {
768+ "payment_method_id" : intent .payment_method ,
769+ "hosted_verification_url" : intent .next_action .verify_with_microdeposits .hosted_verification_url ,
770+ }
771+ ]
793772 )
794773
795774 return unverified_payment_methods
@@ -868,7 +847,7 @@ def list_filtered_invoices(self, owner, limit=10):
868847 return self .payment_service .list_filtered_invoices (owner , limit )
869848
870849 def get_unverified_payment_methods (self , owner ):
871- return self .payment_service ._get_unverified_payment_methods (owner )
850+ return self .payment_service .get_unverified_payment_methods (owner )
872851
873852 def update_plan (self , owner , desired_plan ):
874853 """
0 commit comments