Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ligi committed Jul 15, 2019
1 parent 2054093 commit 911271b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
27 changes: 16 additions & 11 deletions pretix_eth/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ def settings_form_fields(self):
form_fields = OrderedDict(
list(super().settings_form_fields.items())
+ [
('ETH', forms.CharField(
label=_('Ethereum wallet address'),
help_text=_('Leave empty if you do not want to accept ethereum.'),
('WALLET_ADDRESS', forms.CharField(
label=_('Wallet address'),
required=True
)),
('ETH_RATE', forms.DecimalField(
label=_('Ethereum rate'),
help_text=_('Specify the exchange rate between Ethereum and your base currency. Leave out if you do not want to accept ETH'),
required=False
)),
('DAI', forms.CharField(
label=_('DAI wallet address'),
help_text=_('Leave empty if you do not want to accept DAI.'),
('xDAI_RATE', forms.DecimalField(
label=_('xDAI rate'),
help_text=_('Specify the exchange rate between xDAI and your base currency. Leave out if you do not want to accept DAI'),
required=False
)),
('TRANSACTION_PROVIDER', forms.CharField(
Expand All @@ -105,8 +109,9 @@ def settings_form_fields(self):
]
)

form_fields.move_to_end('ETH', last=True)
form_fields.move_to_end('DAI', last=True)
form_fields.move_to_end('WALLET_ADDRESS', last=True)
form_fields.move_to_end('ETH_RATE', last=True)
form_fields.move_to_end('xDAI_RATE', last=True)
form_fields.move_to_end('TRANSACTION_PROVIDER', last=True)
form_fields.move_to_end('TOKEN_PROVIDER', last=True)

Expand All @@ -119,11 +124,11 @@ def is_allowed(self, request, **kwargs):

@property
def payment_form_fields(self):
if self.settings.ETH and self.settings.DAI:
if self.settings.ETH_RATE and self.settings.xDAI_RATE:
currency_type_choices = (DAI_CHOICE, ETH_CHOICE)
elif self.settings.DAI:
elif self.settings.xDAI_RATE:
currency_type_choices = (DAI_CHOICE,)
elif self.settings.ETH:
elif self.settings.ETH_RATE:
currency_type_choices = (ETH_CHOICE,)
else:
raise ImproperlyConfigured("Must have one of `ETH` or `DAI` enabled for payments")
Expand Down
4 changes: 2 additions & 2 deletions pretix_eth/templates/pretix_eth/pending.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
{% load static %}

<a id="pretix-eth-qr-anchor" href="ethereum:{% blocktrans %}Deposit {{ amount }} {{ coin }} into {{ payment_info }}{% endblocktrans %}" class="collapse"></a>
<a id="pretix-eth-qr-anchor" href="ethereum:{% blocktrans %}{{ payment_info }}?value={{ amount }}{% endblocktrans %}" class="collapse"></a>
<br/><br/>
<p>
<strong>{% blocktrans %}Deposit {{ amount_human }} {{ coin }} into {{ payment_info }}{% endblocktrans %}</strong>
Expand All @@ -11,7 +11,7 @@
<p>
<script type="text/javascript" src="{% static "pretix_eth/check.js" %}"></script>
<script type="text/javascript" src="{% static "pretix_eth/generate_qrcode.js" %}"></script>
<a href="https://checkout.web3connect.com/?currency={{ coin }}&amount={{ amount }}&to={{ payment_info}}&callbackUrl={{ request.build_absolute_uri |urlencode }}">Or Pay via Web3Connect</a>
<a target="blank" rel="noreferrer noopener"href="https://checkout.web3connect.com/?currency={{ coin }}&amount={{ amount }}&to={{ payment_info}}&callbackUrl={{ request.build_absolute_uri |urlencode }}">Or Pay via Web3Connect</a>

<p>
{% blocktrans trimmed %}
Expand Down

0 comments on commit 911271b

Please sign in to comment.