set default_payment_method
This commit is contained in:
		
					parent
					
						
							
								e7462289f6
							
						
					
				
			
			
				commit
				
					
						36505db5a2
					
				
			
		
					 3 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
					@ -980,6 +980,7 @@ class OrderConfirmationView(DetailView, FormView):
 | 
				
			||||||
                       discount['stripe_coupon_id']
 | 
					                       discount['stripe_coupon_id']
 | 
				
			||||||
                    else ""),
 | 
					                    else ""),
 | 
				
			||||||
                tax_rates=[stripe_tax_rate.tax_rate_id] if stripe_tax_rate else [],
 | 
					                tax_rates=[stripe_tax_rate.tax_rate_id] if stripe_tax_rate else [],
 | 
				
			||||||
 | 
					                default_payment_method=request.session['id_payment_method']
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            stripe_subscription_obj = subscription_result.get('response_object')
 | 
					            stripe_subscription_obj = subscription_result.get('response_object')
 | 
				
			||||||
            logger.debug(stripe_subscription_obj)
 | 
					            logger.debug(stripe_subscription_obj)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1201,6 +1201,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView, FormView):
 | 
				
			||||||
                       discount['stripe_coupon_id']
 | 
					                       discount['stripe_coupon_id']
 | 
				
			||||||
                    else ""),
 | 
					                    else ""),
 | 
				
			||||||
            tax_rates=[stripe_tax_rate.tax_rate_id] if stripe_tax_rate else [],
 | 
					            tax_rates=[stripe_tax_rate.tax_rate_id] if stripe_tax_rate else [],
 | 
				
			||||||
 | 
					            default_payment_method=request.session['id_payment_method']
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        stripe_subscription_obj = subscription_result.get('response_object')
 | 
					        stripe_subscription_obj = subscription_result.get('response_object')
 | 
				
			||||||
        latest_invoice = stripe.Invoice.retrieve(stripe_subscription_obj.latest_invoice)
 | 
					        latest_invoice = stripe.Invoice.retrieve(stripe_subscription_obj.latest_invoice)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -329,10 +329,12 @@ class StripeUtils(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @handleStripeError
 | 
					    @handleStripeError
 | 
				
			||||||
    def subscribe_customer_to_plan(self, customer, plans, trial_end=None,
 | 
					    def subscribe_customer_to_plan(self, customer, plans, trial_end=None,
 | 
				
			||||||
                                   coupon="", tax_rates=list()):
 | 
					                                   coupon="", tax_rates=list(),
 | 
				
			||||||
 | 
					                                   default_payment_method=""):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Subscribes the given customer to the list of given plans
 | 
					        Subscribes the given customer to the list of given plans
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        :param default_payment_method:
 | 
				
			||||||
        :param tax_rates:
 | 
					        :param tax_rates:
 | 
				
			||||||
        :param coupon:
 | 
					        :param coupon:
 | 
				
			||||||
        :param customer: The stripe customer identifier
 | 
					        :param customer: The stripe customer identifier
 | 
				
			||||||
| 
						 | 
					@ -355,7 +357,8 @@ class StripeUtils(object):
 | 
				
			||||||
            customer=customer, items=plans, trial_end=trial_end,
 | 
					            customer=customer, items=plans, trial_end=trial_end,
 | 
				
			||||||
            coupon=coupon,
 | 
					            coupon=coupon,
 | 
				
			||||||
            default_tax_rates=tax_rates,
 | 
					            default_tax_rates=tax_rates,
 | 
				
			||||||
            payment_behavior='allow_incomplete'
 | 
					            payment_behavior='allow_incomplete',
 | 
				
			||||||
 | 
					            default_payment_method=default_payment_method
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        logger.debug("Done subscribing")
 | 
					        logger.debug("Done subscribing")
 | 
				
			||||||
        return subscription_result
 | 
					        return subscription_result
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue