def save(self, request, cart, contact, payment_module, data=None): form_presave.send(StripePayShipForm, form=self) if data is None: data = self.cleaned_data assert(data) super(StripePayShipForm, self).save(request, cart, contact, payment_module, data=data) use_saved = False if data['use_saved_cc'] == 'Yes': use_saved = True if self.orderpayment: op = self.orderpayment.capture #If we aren't doing instant payment captures, then we force them to save the card if not self.settings.CAPTURE.value: save_card = True else: save_card = data['save_this_card'] token = StripeToken( orderpayment=op, payment_token = data['stripe_token'], use_saved_card=use_saved, save_this_card = save_card, ) token.save() self.the_token = token form_postsave.send(StripePayShipForm, form=self)
def save(self, request, cart, contact, payment_module, data=None): form_presave.send(StripePayShipForm, form=self) if data is None: data = self.cleaned_data assert data super(StripePayShipForm, self).save(request, cart, contact, payment_module, data=data) if self.orderpayment: op = self.orderpayment.capture token = StripeToken(orderpayment=op, payment_token=data["stripe_token"]) token.save() self.the_token = token form_postsave.send(StripePayShipForm, form=self)