Exemplo n.º 1
0
 def settings_content_render(self, request):
     if self.settings.connect_client_id and not self.settings.secret:
         # Use PayPal connect
         if not self.settings.connect_user_id:
             return (
                 "<p>{}</p>"
                 "<a href='{}' class='btn btn-primary btn-lg'>{}</a>"
             ).format(
                 _('To accept payments via PayPal, you will need an account at PayPal. By clicking on the '
                   'following button, you can either create a new PayPal account connect pretix to an existing '
                   'one.'),
                 self.get_connect_url(request),
                 _('Connect with {icon} PayPal').format(icon='<i class="fa fa-paypal"></i>')
             )
         else:
             return (
                 "<button formaction='{}' class='btn btn-danger'>{}</button>"
             ).format(
                 reverse('plugins:paypal:oauth.disconnect', kwargs={
                     'organizer': self.event.organizer.slug,
                     'event': self.event.slug,
                 }),
                 _('Disconnect from PayPal')
             )
     else:
         return "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (
             _('Please configure a PayPal Webhook to the following endpoint in order to automatically cancel orders '
               'when payments are refunded externally.'),
             build_global_uri('plugins:paypal:webhook')
         )
Exemplo n.º 2
0
 def settings_content_render(self, request):
     if self.settings.connect_client_id and not self.settings.secret_key:
         # Use Stripe connect
         if not self.settings.connect_user_id:
             return (
                 "<p>{}</p>"
                 "<a href='{}' class='btn btn-primary btn-lg'>{}</a>"
             ).format(
                 _('To accept payments via Stripe, you will need an account at Stripe. By clicking on the '
                   'following button, you can either create a new Stripe account connect pretix to an existing '
                   'one.'), self.get_connect_url(request),
                 _('Connect with Stripe'))
         else:
             return (
                 "<button formaction='{}' class='btn btn-danger'>{}</button>"
             ).format(
                 reverse('plugins:stripe:oauth.disconnect',
                         kwargs={
                             'organizer': self.event.organizer.slug,
                             'event': self.event.slug,
                         }), _('Disconnect from Stripe'))
     else:
         return "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (
             _('Please configure a <a href="https://dashboard.stripe.com/account/webhooks">Stripe Webhook</a> to '
               'the following endpoint in order to automatically cancel orders when charges are refunded externally '
               'and to process asynchronous payment methods like SOFORT.'),
             build_global_uri('plugins:stripe:webhook'))
Exemplo n.º 3
0
 def settings_content_render(self, request):
     if self.settings.connect_client_id and not self.settings.secret:
         # Use PayPal connect
         if not self.settings.connect_user_id:
             return (
                 "<p>{}</p>"
                 "<a href='{}' class='btn btn-primary btn-lg'>{}</a>"
             ).format(
                 _('To accept payments via PayPal, you will need an account at PayPal. By clicking on the '
                   'following button, you can either create a new PayPal account connect pretix to an existing '
                   'one.'), self.get_connect_url(request),
                 _('Connect with {icon} PayPal').format(
                     icon='<i class="fa fa-paypal"></i>'))
         else:
             return (
                 "<button formaction='{}' class='btn btn-danger'>{}</button>"
             ).format(
                 reverse('plugins:paypal:oauth.disconnect',
                         kwargs={
                             'organizer': self.event.organizer.slug,
                             'event': self.event.slug,
                         }), _('Disconnect from PayPal'))
     else:
         return "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (
             _('Please configure a PayPal Webhook to the following endpoint in order to automatically cancel orders '
               'when payments are refunded externally.'),
             build_global_uri('plugins:paypal:webhook'))
Exemplo n.º 4
0
 def settings_content_render(self, request):
     if self.settings.connect_client_id and not self.settings.secret_key:
         # Use Stripe connect
         if not self.settings.connect_user_id:
             return (
                 "<p>{}</p>"
                 "<a href='{}' class='btn btn-primary btn-lg'>{}</a>"
             ).format(
                 _('To accept payments via Stripe, you will need an account at Stripe. By clicking on the '
                   'following button, you can either create a new Stripe account connect pretix to an existing '
                   'one.'),
                 self.get_connect_url(request),
                 _('Connect with Stripe')
             )
         else:
             return (
                 "<button formaction='{}' class='btn btn-danger'>{}</button>"
             ).format(
                 reverse('plugins:stripe:oauth.disconnect', kwargs={
                     'organizer': self.event.organizer.slug,
                     'event': self.event.slug,
                 }),
                 _('Disconnect from Stripe')
             )
     else:
         return "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (
             _('Please configure a <a href="https://dashboard.stripe.com/account/webhooks">Stripe Webhook</a> to '
               'the following endpoint in order to automatically cancel orders when charges are refunded externally '
               'and to process asynchronous payment methods like SOFORT.'),
             build_global_uri('plugins:stripe:webhook')
         )
Exemplo n.º 5
0
 def settings_content_render(self, request):
     return "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (
         _('Please configure a <a href="https://dashboard.stripe.com/account/webhooks">Stripe Webhook</a> to '
           'the following endpoint in order to automatically cancel orders when charges are refunded externally '
           'and to process asynchronous payment methods like SOFORT.'),
         build_global_uri('plugins:stripe:webhook')
     )
Exemplo n.º 6
0
 def get_connect_url(self, request):
     request.session['payment_stripe_oauth_event'] = request.event.pk
     if 'payment_stripe_oauth_token' not in request.session:
         request.session['payment_stripe_oauth_token'] = get_random_string(
             32)
     return (
         "https://connect.stripe.com/oauth/authorize?response_type=code&client_id={}&state={}"
         "&scope=read_write&redirect_uri={}").format(
             self.settings.connect_client_id,
             request.session['payment_stripe_oauth_token'],
             urlquote(build_global_uri('plugins:stripe:oauth.return')),
         )
Exemplo n.º 7
0
 def get_connect_url(self, request):
     request.session['payment_stripe_oauth_event'] = request.event.pk
     if 'payment_stripe_oauth_token' not in request.session:
         request.session['payment_stripe_oauth_token'] = get_random_string(32)
     return (
         "https://connect.stripe.com/oauth/authorize?response_type=code&client_id={}&state={}"
         "&scope=read_write&redirect_uri={}"
     ).format(
         self.settings.connect_client_id,
         request.session['payment_stripe_oauth_token'],
         urlquote(build_global_uri('plugins:stripe:oauth.return')),
     )
Exemplo n.º 8
0
 def get_connect_url(self, request):
     request.session['payment_mollie_oauth_event'] = request.event.pk
     if 'payment_mollie_oauth_token' not in request.session:
         request.session['payment_mollie_oauth_token'] = get_random_string(32)
     return (
         "https://www.mollie.com/oauth2/authorize?client_id={}&redirect_uri={}"
         "&state={}&scope=payments.read+payments.write+refunds.read+refunds.write+profiles.read+organizations.read"
         "&response_type=code&approval_prompt=auto"
     ).format(
         self.settings.connect_client_id,
         urlquote(build_global_uri('plugins:pretix_mollie:oauth.return')),
         request.session['payment_mollie_oauth_token'],
     )
Exemplo n.º 9
0
    def settings_content_render(self, request):
        settings_content = ""
        if self.settings.connect_client_id and not self.settings.secret:
            # Use PayPal connect
            if not self.settings.connect_user_id:
                settings_content = (
                    "<p>{}</p>"
                    "<a href='{}' class='btn btn-primary btn-lg'>{}</a>"
                ).format(
                    _('To accept payments via PayPal, you will need an account at PayPal. By clicking on the '
                      'following button, you can either create a new PayPal account connect pretix to an existing '
                      'one.'),
                    self.get_connect_url(request),
                    _('Connect with {icon} PayPal').format(icon='<i class="fa fa-paypal"></i>')
                )
            else:
                settings_content = (
                    "<button formaction='{}' class='btn btn-danger'>{}</button>"
                ).format(
                    reverse('plugins:paypal:oauth.disconnect', kwargs={
                        'organizer': self.event.organizer.slug,
                        'event': self.event.slug,
                    }),
                    _('Disconnect from PayPal')
                )
        else:
            settings_content = "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (
                _('Please configure a PayPal Webhook to the following endpoint in order to automatically cancel orders '
                  'when payments are refunded externally.'),
                build_global_uri('plugins:paypal:webhook')
            )

        if self.event.currency not in SUPPORTED_CURRENCIES:
            settings_content += (
                '<br><br><div class="alert alert-warning">%s '
                '<a href="https://developer.paypal.com/docs/api/reference/currency-codes/">%s</a>'
                '</div>'
            ) % (
                _("PayPal does not process payments in your event's currency."),
                _("Please check this PayPal page for a complete list of supported currencies.")
            )

        if self.event.currency in LOCAL_ONLY_CURRENCIES:
            settings_content += '<br><br><div class="alert alert-warning">%s''</div>' % (
                _("Your event's currency is supported by PayPal as a payment and balance currency for in-country "
                  "accounts only. This means, that the receiving as well as the sending PayPal account must have been "
                  "created in the same country and use the same currency. Out of country accounts will not be able to "
                  "send any payments.")
            )

        return settings_content
Exemplo n.º 10
0
 def init_api(self):
     if self.settings.connect_client_id and not self.settings.secret:
         paypalrestsdk.set_config(
             mode="sandbox" if "sandbox" in self.settings.connect_endpoint else 'live',
             client_id=self.settings.connect_client_id,
             client_secret=self.settings.connect_secret_key,
             openid_client_id=self.settings.connect_client_id,
             openid_client_secret=self.settings.connect_secret_key,
             openid_redirect_uri=urlquote(build_global_uri('plugins:paypal:oauth.return')))
     else:
         paypalrestsdk.set_config(
             mode="sandbox" if "sandbox" in self.settings.get('endpoint') else 'live',
             client_id=self.settings.get('client_id'),
             client_secret=self.settings.get('secret'))
Exemplo n.º 11
0
 def init_api(self):
     if self.settings.connect_client_id:
         paypalrestsdk.set_config(
             mode="sandbox" if "sandbox" in self.settings.connect_endpoint else 'live',
             client_id=self.settings.connect_client_id,
             client_secret=self.settings.connect_secret_key,
             openid_client_id=self.settings.connect_client_id,
             openid_client_secret=self.settings.connect_secret_key,
             openid_redirect_uri=urlquote(build_global_uri('plugins:paypal:oauth.return')))
     else:
         paypalrestsdk.set_config(
             mode="sandbox" if "sandbox" in self.settings.get('endpoint') else 'live',
             client_id=self.settings.get('client_id'),
             client_secret=self.settings.get('secret'))
Exemplo n.º 12
0
 def settings_content_render(self, request):
     return "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (
         _('Please configure a PayPal Webhook to the following endpoint in order to automatically cancel orders '
           'when payments are refunded externally.'),
         build_global_uri('plugins:paypal:webhook'))
Exemplo n.º 13
0
 def settings_content_render(self, request):
     return "<div class='alert alert-info'>%s<br /><code>%s</code></div>" % (_(
         'Please configure a <a href="https://docs.adyen.com/development-resources/notifications">Notification '
         'Webhook</a> to the following endpoint in order to automatically cancel orders when charges are refunded '
         'externally and to process asynchronous payment methods like SOFORT.'
     ), build_global_uri('plugins:pretix_adyen:webhook'))