@@ -179,23 +179,25 @@ def sync_from_paddle_data(cls, data):
179179 return
180180
181181 # Now, create object with this pk.
182- sub = Subscription .objects .create (
183- id = pk ,
184- cancel_url = data .get ("cancel_url" ),
185- checkout_id = "" , # ???
186- currency = data .get ('last_payment' ).get ("currency" ),
187- email = data .get ("user_email" ),
188- event_time = timezone .now (), # ???
189- marketing_consent = data .get ('marketing_consent' ),
190- # next_bill_date can be null if user won't pay again...
191- next_bill_date = data .get ("next_payment" , {}).get ("date" , None ),
192- passthrough = "" , # ???
193- quantity = data .get ("last_payment" , {}).get ("amount" , 0 ),
194- source = "" , # ???
195- status = data .get ("state" ),
196- unit_price = 0.00 , # ???
197- update_url = data .get ('update_url' ),
198- ** kwargs
182+ sub = Subscription .objects .bulk_create (
183+ Subscription (
184+ id = pk ,
185+ cancel_url = data .get ("cancel_url" ),
186+ checkout_id = "" , # ???
187+ currency = data .get ('last_payment' ).get ("currency" ),
188+ email = data .get ("user_email" ),
189+ event_time = timezone .now (), # ???
190+ marketing_consent = data .get ('marketing_consent' ),
191+ # next_bill_date can be null if user won't pay again...
192+ next_bill_date = data .get ("next_payment" , {}).get ("date" , None ),
193+ passthrough = "" , # ???
194+ quantity = data .get ("last_payment" , {}).get ("amount" , 0 ),
195+ source = "" , # ???
196+ status = data .get ("state" ),
197+ unit_price = 0.00 , # ???
198+ update_url = data .get ('update_url' ),
199+ ** kwargs
200+ )
199201 )
200202 return sub
201203
@@ -211,7 +213,7 @@ def _sanitize_webhook_payload(cls, payload):
211213 try :
212214 if subscriber_id not in ["" , None ]:
213215 data [
214- "subscriber" ], created = settings .get_subscriber_model ().objects .get (
216+ "subscriber" ] = settings .get_subscriber_model ().objects .get (
215217 email = payload ["email" ]
216218 )
217219 except settings .get_subscriber_model ().DoesNotExist :
0 commit comments