Skip to content

Commit

Permalink
Merge pull request #153 from zediious/0.4.5.1
Browse files Browse the repository at this point in the history
Changes for 0.4.5.1
  • Loading branch information
zediious authored Dec 31, 2023
2 parents 49bf448 + e408626 commit 8edbc83
Show file tree
Hide file tree
Showing 30 changed files with 593 additions and 146 deletions.
17 changes: 14 additions & 3 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ STRIPE_PUBLISHABLE_KEY=''
STRIPE_SECRET_KEY=''
STRIPE_WEBHOOK_SECRET=''
PAYPAL_RECEIVER_EMAIL=''
PAYPAL_DEV_WEBHOOK_DOMAIN=''
USE_CONSOLE_EMAIL=
ERROR_LOG_EMAIL=''
EMAIL_HOST=''
Expand Down Expand Up @@ -103,13 +106,21 @@ A description for the Discord Bot, used when creating the Bot
# *Stripe Payments*

### **STRIPE_PUBLISHABLE_KEY**
Your Stripe "Publishable Key". After signing in to Stripe, [you can find this by going to your Stripe Dashboard](https://dashboard.stripe.com/apikeys).
Your Stripe "Publishable Key". After signing in to Stripe, [you can find this by going to your Stripe Dashboard](https://dashboard.stripe.com/apikeys). This can be left blank if the Donations module will be disabled.

### **STRIPE_SECRET_KEY**
Your Stripe "Secret Key". After signing in to Stripe, [you can find this by going to your Stripe Dashboard](https://dashboard.stripe.com/apikeys).
Your Stripe "Secret Key". After signing in to Stripe, [you can find this by going to your Stripe Dashboard](https://dashboard.stripe.com/apikeys). This can be left blank if the Donations module will be disabled.

### **STRIPE_WEBHOOK_SECRET**
Your Stripe "Webhook Secret". [Create a Webhook Endpoint here](https://dashboard.stripe.com/webhooks/create), and set the URL to `https://<your.domain.name>/api/donations/payment/webhook`. After doing so, you will be able to get your Webhook Secret.
Your Stripe "Webhook Secret". [Create a Webhook Endpoint here](https://dashboard.stripe.com/webhooks/create), and set the URL to `https://<your.domain.name>/api/donations/payment/webhook`. After doing so, you will be able to get your Webhook Secret. This can be left blank if the Donations module will be disabled.

# *Paypal Payments*

### **PAYPAL_RECEIVER_EMAIL**
The email for the Paypal account that you wish to receive donation payments. This can be left blank if the Donations module will be disabled.

### **PAYPAL_DEV_WEBHOOK_DOMAIN**
The publicly accessible domain for Paypal to send POST requests to on successful payments in a DEV environment. This is only required in a development environment, you should leave this empty in production.

# *Email*

Expand Down
7 changes: 6 additions & 1 deletion config/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@
'level': 'DEBUG',
'propagate': False,
},
'donations.payments': {
'donations.payments.stripe': {
'handlers': ['console', 'log_file', 'mail_admins'],
'level': 'DEBUG',
'propagate': False,
},
'donations.payments.paypal': {
'handlers': ['console', 'log_file', 'mail_admins'],
'level': 'DEBUG',
'propagate': False,
Expand Down
21 changes: 16 additions & 5 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
'raptorWeb.gameservers',
'raptorWeb.donations',
'raptorWeb.raptorbot',
'raptorWeb.panel'
'raptorWeb.panel',
'paypal.standard.ipn'
]

MIDDLEWARE: list[str] = [
Expand Down Expand Up @@ -236,6 +237,9 @@
STRIPE_PUBLISHABLE_KEY = '' if str(getenv('STRIPE_PUBLISHABLE_KEY')) == '' else str(getenv('STRIPE_PUBLISHABLE_KEY'))
STRIPE_SECRET_KEY = '' if str(getenv('STRIPE_SECRET_KEY')) == '' else str(getenv('STRIPE_SECRET_KEY'))
STRIPE_WEBHOOK_SECRET = '' if str(getenv('STRIPE_WEBHOOK_SECRET')) == '' else str(getenv('STRIPE_WEBHOOK_SECRET'))
PAYPAL_RECEIVER_EMAIL = '' if getenv('PAYPAL_RECEIVER_EMAIL') == '' else getenv('PAYPAL_RECEIVER_EMAIL')
PAYPAL_DEV_WEBHOOK_DOMAIN = '' if getenv('PAYPAL_DEV_WEBHOOK_DOMAIN') == '' else getenv('PAYPAL_DEV_WEBHOOK_DOMAIN')
PAYPAL_TEST = True if DEBUG else False

# Path to json file to import servers from
IMPORT_JSON_LOCATION: str = join(BASE_DIR, 'server_data_full.json')
Expand Down Expand Up @@ -311,7 +315,8 @@
# Sidebar
"show_sidebar": True,
"navigation_expanded": False,
"order_with_respect_to": ["raptormc", "gameservers", "raptorbot", "staffapps", "authprofiles"],
"hide_apps": ['ipn'],
"order_with_respect_to": ["raptormc", "gameservers", "raptorbot", 'donations', "staffapps", "authprofiles"],
"custom_links": {
"raptorbot": [{
"name": "Discord Bot Control Panel",
Expand All @@ -328,7 +333,13 @@
"donations": [{
"name": "Completed Donations",
"url": "/panel/donations/",
"icon": "fa fa-credit-card",
"icon": "fa fa-check-double",
"permissions": ["raptormc.donations"]
}],
"donations": [{
"name": "Completed Donations",
"url": "/panel/donations/",
"icon": "fa fa-check-double",
"permissions": ["raptormc.donations"]
}]
},
Expand All @@ -355,9 +366,10 @@
"authprofiles.RaptorUser": "fas fa-user",
"authprofiles.UserProfileInfo": "fas fa-user-tag",
"authprofiles.DiscordUserInfo": "fas fa-user-tag",
"donations": "fa fa-coins",
"donations.DonationPackage": "fa fa-archive",
"donations.DonationServerCommand": "fa fa-terminal",
"donations.DonationDiscordRole": "fa fa-tags",
"donations.DonationDiscordRole": "fa fa-mask",

},
"default_icon_parents": "fas fa-chevron-circle-right",
Expand All @@ -384,7 +396,6 @@
"theme": "cyborg",
"actions_sticky_top": False,
"sidebar_nav_child_indent": True,
"related_modal_active": True

}

Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ dependencies:
- stripe==7.8.1
- celery==5.3.6
- mojang==1.1.0
- django-paypal==2.0
3 changes: 2 additions & 1 deletion raptorWeb/donations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class DonationPackageAdmin(admin.ModelAdmin):
'price',
'variable_price',
'allow_repeat',
'priority',
'package_picture',
'package_description')
}),
Expand All @@ -43,7 +44,7 @@ class DonationPackageAdmin(admin.ModelAdmin):
'name',
]

list_display: list[str] = ['name', 'allow_repeat', 'variable_price', 'price']
list_display: list[str] = ['name', 'allow_repeat', 'variable_price', 'price', 'priority']


class DonationServerCommandAdmin(admin.ModelAdmin):
Expand Down
19 changes: 19 additions & 0 deletions raptorWeb/donations/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

class SubmittedDonationForm(forms.Form):
minecraft_username = forms.CharField(
label='Minecraft Username',
help_text=("Your Minecraft in-game name. This must be supplied, and "
"and it must be a real Minecraft username."),
required=True,
)

discord_username = forms.CharField(
label='Discord Username',
help_text=("This is not required, but you must enter a Discord "
"username if you want to receive Roles on Discord."),
required=False,
Expand All @@ -14,6 +18,7 @@ class SubmittedDonationForm(forms.Form):

class DonationDiscordUsernameForm(forms.Form):
discord_username = forms.CharField(
label='Discord Username',
help_text=("This is not required, but you must enter a Discord "
"username if you want to receive Roles on Discord."),
required=False,
Expand All @@ -22,7 +27,21 @@ class DonationDiscordUsernameForm(forms.Form):

class DonationPriceForm(forms.Form):
chosen_price = forms.IntegerField(
label='Donation Amount',
help_text=("Enter any whole amount you would like to donate "
"above the package's price."),
required=False
)


class DonationGatewayForm(forms.Form):
payment_gateway = forms.ChoiceField(
label='Payment Gateway',
help_text='Choose your preferred way to pay.',
widget=forms.RadioSelect,
required=True,
choices=[
('stripe', 'Stripe'),
('paypal', 'Paypal'),
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.7 on 2023-12-24 20:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('donations', '0019_alter_donationpackage_variable_price'),
]

operations = [
migrations.AddField(
model_name='completeddonation',
name='paypal_invoice',
field=models.CharField(blank=True, help_text='The unique ID for the Paypal Invoice generated for this donation.', max_length=1000, null=True, verbose_name='Paypal Invoice ID'),
),
migrations.AlterField(
model_name='completeddonation',
name='checkout_id',
field=models.CharField(blank=True, help_text='The unique ID for the Stripe Checkout session this Donation utilized.', max_length=1000, null=True, verbose_name='Stripe Checkout ID'),
),
]
18 changes: 18 additions & 0 deletions raptorWeb/donations/migrations/0021_donationpackage_priority.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2023-12-31 01:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('donations', '0020_completeddonation_paypal_invoice_and_more'),
]

operations = [
migrations.AddField(
model_name='donationpackage',
name='priority',
field=models.IntegerField(default=0, help_text='The order that this package will appear in the package list..', verbose_name='Priority'),
),
]
17 changes: 16 additions & 1 deletion raptorWeb/donations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ class DonationPackage(models.Model):
help_text='If this is enabled, this package can be bought multiple times by the same Minecraft username'
)

priority = models.IntegerField(
default=0,
verbose_name='Priority',
help_text='The order that this package will appear in the package list..'
)

servers = models.ManyToManyField(
to=Server,
blank=True,
Expand Down Expand Up @@ -184,12 +190,21 @@ class CompletedDonation(models.Model):
)

checkout_id = models.CharField(
default="",
max_length=1000,
blank=True,
null=True,
verbose_name="Stripe Checkout ID",
help_text=("The unique ID for the Stripe Checkout session this Donation utilized.")
)

paypal_invoice = models.CharField(
max_length=1000,
blank=True,
null=True,
verbose_name="Paypal Invoice ID",
help_text=("The unique ID for the Paypal Invoice generated for this donation.")
)

sent_commands_count = models.IntegerField(
default=0,
verbose_name="Times commands were sent",
Expand Down
90 changes: 0 additions & 90 deletions raptorWeb/donations/payments.py

This file was deleted.

Empty file.
Loading

0 comments on commit 8edbc83

Please sign in to comment.