fixing a bug which occurs when for some reason stripe doesn't put the
display_items on the invoice
This commit is contained in:
		
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							@ -56,6 +56,16 @@ Run the app in gunicorn:
 | 
				
			|||||||
pipenv run gunicorn --bind 127.0.0.1:5000 app:app
 | 
					pipenv run gunicorn --bind 127.0.0.1:5000 app:app
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## how to view the logs on the deployed system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					application logs:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`journalctl -u capsul-flask --since -1w`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					scheduled task logs:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`tail -n100 /var/log/capsul-flask.log`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-----
 | 
					-----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## cli 
 | 
					## cli 
 | 
				
			||||||
 | 
				
			|||||||
@ -232,7 +232,7 @@ def validate_stripe_checkout_session(stripe_checkout_session_id):
 | 
				
			|||||||
    checkout_session = event['data']['object']
 | 
					    checkout_session = event['data']['object']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if checkout_session and 'id' in checkout_session and checkout_session['id'] == stripe_checkout_session_id:
 | 
					    if checkout_session and 'id' in checkout_session and checkout_session['id'] == stripe_checkout_session_id:
 | 
				
			||||||
      cents = checkout_session['display_items'][0]['amount']
 | 
					      cents = checkout_session['amount_total']
 | 
				
			||||||
      dollars = decimal.Decimal(cents)/100
 | 
					      dollars = decimal.Decimal(cents)/100
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      #consume_payment_session deletes the checkout session row and inserts a payment row
 | 
					      #consume_payment_session deletes the checkout session row and inserts a payment row
 | 
				
			||||||
@ -274,7 +274,7 @@ def success():
 | 
				
			|||||||
#       secret=current_app.config['STRIPE_WEBHOOK_SECRET']
 | 
					#       secret=current_app.config['STRIPE_WEBHOOK_SECRET']
 | 
				
			||||||
#     )
 | 
					#     )
 | 
				
			||||||
#     if event['type'] == 'checkout.session.completed':
 | 
					#     if event['type'] == 'checkout.session.completed':
 | 
				
			||||||
#       dollars = event['data']['object']['display_items'][0]['amount']
 | 
					#       dollars = event['data']['object']['amount_total']
 | 
				
			||||||
#       stripe_checkout_session_id = event['data']['object']['id']
 | 
					#       stripe_checkout_session_id = event['data']['object']['id']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#       #consume_payment_session deletes the checkout session row and inserts a payment row
 | 
					#       #consume_payment_session deletes the checkout session row and inserts a payment row
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user