def payments_confirm(request, addon_id, addon): data = {} # TODO(solitude): remove all references to AddonPaymentData. if waffle.flag_is_active(request, 'solitude-payments'): data = client.get_seller_paypal_if_exists(addon) or {} adp, created = AddonPaymentData.objects.safer_get_or_create(addon=addon) if not data: data = model_to_dict(adp) form = PaypalPaymentData(request.POST or data) if request.method == 'POST' and form.is_valid(): if waffle.flag_is_active(request, 'solitude-payments'): # TODO(solitude): when the migration of data is completed, we # will be able to remove this. pk = client.create_seller_for_pay(addon) client.patch_seller_paypal(pk=pk, data=form.cleaned_data) # TODO(solitude): remove this. adp.update(**form.cleaned_data) AppSubmissionChecklist.objects.get(addon=addon).update(payments=True) addon.mark_done() return redirect('submit.app.done', addon.app_slug) return jingo.render(request, 'submit/payments-confirm.html', { 'step': 'payments', 'addon': addon, 'form': form })
def paypal_setup_confirm(request, addon_id, addon, webapp, source='paypal'): # If you bounce through paypal as you do permissions changes set the # source to paypal. if source == 'paypal': msg = _('PayPal set up complete.') title = _('Confirm Details') button = _('Continue') # If you just hit this page from the Manage Paypal, show some less # wizardy stuff. else: msg = _('Changes saved.') title = _('Contact Details') button = _('Save') data = {} if waffle.flag_is_active(request, 'solitude-payments'): data = client.get_seller_paypal_if_exists(addon) or {} # TODO(solitude): remove this bit. # If it's not in solitude, use the local version adp, created = (AddonPaymentData.objects .safer_get_or_create(addon=addon)) if not data: data = model_to_dict(adp) form = forms.PaypalPaymentData(request.POST or data) if request.method == 'POST' and form.is_valid(): if waffle.flag_is_active(request, 'solitude-payments'): # TODO(solitude): when the migration of data is completed, we # will be able to remove this. pk = client.create_seller_for_pay(addon) client.patch_seller_paypal(pk=pk, data=form.cleaned_data) # TODO(solitude): remove this. adp.update(**form.cleaned_data) messages.success(request, msg) if source == 'paypal' and addon.is_incomplete() and addon.paypal_id: addon.mark_done() return redirect(addon.get_dev_url('paypal_setup')) return jingo.render(request, 'developers/payments/paypal-details-confirm.html', {'addon': addon, 'button': button, 'form': form, 'title': title})