Add monthlyhostingbill model + code
This commit is contained in:
		
					parent
					
						
							
								46c3bb1ce4
							
						
					
				
			
			
				commit
				
					
						0e84081880
					
				
			
		
					 2 changed files with 42 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -122,6 +122,26 @@ class StripeUtils(object):
 | 
			
		|||
        }
 | 
			
		||||
        return card_details
 | 
			
		||||
 | 
			
		||||
    @handleStripeError
 | 
			
		||||
    def get_all_invoices(self, customer_id):
 | 
			
		||||
        invoices = stripe.Invoice.list(limit=100, customer=customer_id)
 | 
			
		||||
        return_list = []
 | 
			
		||||
        for invoice in invoices:
 | 
			
		||||
            invoice_details = {
 | 
			
		||||
                'created': invoice.created,
 | 
			
		||||
                'receipt_number': invoice.receipt_number,
 | 
			
		||||
                'invoice_number': invoice.number,
 | 
			
		||||
                'date_paid': invoice.date_paid,
 | 
			
		||||
                'period_start': invoice.period_start,
 | 
			
		||||
                'period_end': invoice.period_end,
 | 
			
		||||
                'paid': invoice.paid,
 | 
			
		||||
                'billing_reason': invoice.billing_reason,
 | 
			
		||||
                'discount': invoice.discount.coupon.amount_off if invoice.discount else 0,
 | 
			
		||||
                'total': invoice.total
 | 
			
		||||
            }
 | 
			
		||||
            return_list.append(invoice_details)
 | 
			
		||||
        return return_list
 | 
			
		||||
 | 
			
		||||
    @handleStripeError
 | 
			
		||||
    def get_cards_details_from_token(self, token):
 | 
			
		||||
        stripe_token = stripe.Token.retrieve(token)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue