def obj_create(self, bundle, request, **kwargs): form = PayValidation(bundle.data) if not form.is_valid(): raise self.form_errors(form) paypal = Client() # TODO: there might be a lot more we can do here. bundle.data = paypal.get_pay_key(*form.args(), **form.kwargs()) create.send(sender=self, bundle=bundle, form=form.cleaned_data) return bundle
def obj_create(self, bundle, request, **kwargs): form = PreapprovalValidation(bundle.data) if not form.is_valid(): raise self.form_errors(form) paypal = Client() bundle.data = {'key': paypal.get_preapproval_key(*form.args())['key'], 'uuid': form.cleaned_data['uuid'].uuid} bundle.obj = self.obj() bundle.obj.set(bundle.data) return bundle
def obj_create(self, bundle, request, **kwargs): form = GetPermissionToken(bundle.data) if not form.is_valid(): raise self.form_errors(form) paypal = Client() result = paypal.get_permission_token(*form.args()) seller = form.cleaned_data['seller'] seller.token = result['token'] seller.secret = result['secret'] seller.save() bundle.obj = seller return bundle