mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Re-work API for payment settings fields
This commit is contained in:
@@ -22,31 +22,36 @@ class Paypal(BasePaymentProvider):
|
||||
|
||||
identifier = 'paypal'
|
||||
verbose_name = _('PayPal')
|
||||
settings_form_fields = OrderedDict([
|
||||
('endpoint',
|
||||
forms.ChoiceField(
|
||||
label=_('Endpoint'),
|
||||
initial='live',
|
||||
choices=(
|
||||
('live', 'Live'),
|
||||
('sandbox', 'Sandbox'),
|
||||
),
|
||||
required=False
|
||||
)),
|
||||
('client_id',
|
||||
forms.CharField(
|
||||
label=_('Client ID'),
|
||||
required=False
|
||||
)),
|
||||
('secret',
|
||||
forms.CharField(
|
||||
label=_('Secret'),
|
||||
required=False
|
||||
))
|
||||
])
|
||||
checkout_form_fields = OrderedDict([
|
||||
])
|
||||
|
||||
@property
|
||||
def settings_form_fields(self):
|
||||
return OrderedDict(
|
||||
list(super().settings_form_fields.items()) + [
|
||||
('endpoint',
|
||||
forms.ChoiceField(
|
||||
label=_('Endpoint'),
|
||||
initial='live',
|
||||
choices=(
|
||||
('live', 'Live'),
|
||||
('sandbox', 'Sandbox'),
|
||||
),
|
||||
required=False
|
||||
)),
|
||||
('client_id',
|
||||
forms.CharField(
|
||||
label=_('Client ID'),
|
||||
required=False
|
||||
)),
|
||||
('secret',
|
||||
forms.CharField(
|
||||
label=_('Secret'),
|
||||
required=False
|
||||
))
|
||||
]
|
||||
)
|
||||
|
||||
def init_api(self):
|
||||
paypalrestsdk.set_config(
|
||||
mode="sandbox" if "sandbox" in self.settings.get('endpoint') else 'live',
|
||||
|
||||
Reference in New Issue
Block a user