@@ -791,7 +791,12 @@ def url(self) -> str:
791791
792792
793793class InvoiceState (Enum ):
794- cancelled , failed , paid , unpaid , pending , finalized = range (6 )
794+ CANCELLED = "cancelled"
795+ FAILED = "failed"
796+ PAID = "paid"
797+ UNPAID = "unpaid"
798+ PENDING = "pending"
799+ FINALIZED = "finalized"
795800
796801
797802class Invoices (DefaultClient ):
@@ -829,7 +834,7 @@ def state_update(self, entity_id: int, state: InvoiceState, **kwargs):
829834 cancelled, failed, paid, unpaid, pending, finalized
830835 """
831836 log .info (f"[Invoice] state changed for invoice ({ entity_id } ): { state } " )
832- params = dict (state = state .name )
837+ params = dict (state = state .value )
833838 url = self ._entity_url (entity_id ) + '/state'
834839 response = self .rest .put (url = url , json = params , ** kwargs )
835840 instance = self ._create_instance (response = response )
@@ -1323,8 +1328,8 @@ def __init__(self, entity_name='friendly_id', **kwargs):
13231328 def line_items (self ) -> LineItems :
13241329 return LineItems (parent = self , instance_klass = LineItem )
13251330
1326- def state_update (self , state : InvoiceState , ** kwargs ):
1327- return self .client .state_update (entity_id = self .entity_id , state = state , ** kwargs )
1331+ def state_update (self , state : InvoiceState ):
1332+ return self .client .state_update (entity_id = self .entity_id , state = state )
13281333
1329- def charge (self , ** kwargs ):
1330- return self .client .charge (entity_id = self .entity_id , ** kwargs )
1334+ def charge (self ):
1335+ return self .client .charge (entity_id = self .entity_id )
0 commit comments