django-cfg 1.2.27__py3-none-any.whl → 1.2.31__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_cfg/__init__.py +1 -1
- django_cfg/apps/payments/admin/__init__.py +3 -2
- django_cfg/apps/payments/admin/balance_admin.py +18 -18
- django_cfg/apps/payments/admin/currencies_admin.py +319 -131
- django_cfg/apps/payments/admin/payments_admin.py +15 -4
- django_cfg/apps/payments/config/module.py +2 -2
- django_cfg/apps/payments/config/utils.py +2 -2
- django_cfg/apps/payments/decorators.py +2 -2
- django_cfg/apps/payments/management/commands/README.md +95 -127
- django_cfg/apps/payments/management/commands/currency_stats.py +5 -24
- django_cfg/apps/payments/management/commands/manage_currencies.py +229 -0
- django_cfg/apps/payments/management/commands/manage_providers.py +235 -0
- django_cfg/apps/payments/managers/__init__.py +3 -2
- django_cfg/apps/payments/managers/balance_manager.py +2 -2
- django_cfg/apps/payments/managers/currency_manager.py +272 -49
- django_cfg/apps/payments/managers/payment_manager.py +161 -13
- django_cfg/apps/payments/middleware/api_access.py +2 -2
- django_cfg/apps/payments/middleware/rate_limiting.py +8 -18
- django_cfg/apps/payments/middleware/usage_tracking.py +20 -17
- django_cfg/apps/payments/migrations/0002_network_providercurrency_and_more.py +241 -0
- django_cfg/apps/payments/migrations/0003_add_usd_rate_cache.py +30 -0
- django_cfg/apps/payments/models/__init__.py +3 -2
- django_cfg/apps/payments/models/currencies.py +187 -71
- django_cfg/apps/payments/models/payments.py +3 -2
- django_cfg/apps/payments/serializers/__init__.py +3 -2
- django_cfg/apps/payments/serializers/currencies.py +20 -12
- django_cfg/apps/payments/services/cache/simple_cache.py +2 -2
- django_cfg/apps/payments/services/core/balance_service.py +2 -2
- django_cfg/apps/payments/services/core/fallback_service.py +2 -2
- django_cfg/apps/payments/services/core/payment_service.py +3 -6
- django_cfg/apps/payments/services/core/subscription_service.py +4 -7
- django_cfg/apps/payments/services/internal_types.py +171 -7
- django_cfg/apps/payments/services/monitoring/api_schemas.py +58 -204
- django_cfg/apps/payments/services/monitoring/provider_health.py +2 -2
- django_cfg/apps/payments/services/providers/base.py +144 -43
- django_cfg/apps/payments/services/providers/cryptapi/__init__.py +4 -0
- django_cfg/apps/payments/services/providers/cryptapi/config.py +8 -0
- django_cfg/apps/payments/services/providers/cryptapi/models.py +192 -0
- django_cfg/apps/payments/services/providers/cryptapi/provider.py +439 -0
- django_cfg/apps/payments/services/providers/cryptomus/__init__.py +4 -0
- django_cfg/apps/payments/services/providers/cryptomus/models.py +176 -0
- django_cfg/apps/payments/services/providers/cryptomus/provider.py +429 -0
- django_cfg/apps/payments/services/providers/cryptomus/provider_v2.py +564 -0
- django_cfg/apps/payments/services/providers/models/__init__.py +34 -0
- django_cfg/apps/payments/services/providers/models/currencies.py +190 -0
- django_cfg/apps/payments/services/providers/nowpayments/__init__.py +4 -0
- django_cfg/apps/payments/services/providers/nowpayments/models.py +196 -0
- django_cfg/apps/payments/services/providers/nowpayments/provider.py +380 -0
- django_cfg/apps/payments/services/providers/registry.py +294 -11
- django_cfg/apps/payments/services/providers/stripe/__init__.py +4 -0
- django_cfg/apps/payments/services/providers/stripe/models.py +184 -0
- django_cfg/apps/payments/services/providers/stripe/provider.py +109 -0
- django_cfg/apps/payments/services/security/error_handler.py +6 -8
- django_cfg/apps/payments/services/security/payment_notifications.py +2 -2
- django_cfg/apps/payments/services/security/webhook_validator.py +3 -4
- django_cfg/apps/payments/signals/api_key_signals.py +2 -2
- django_cfg/apps/payments/signals/payment_signals.py +11 -5
- django_cfg/apps/payments/signals/subscription_signals.py +2 -2
- django_cfg/apps/payments/static/payments/css/payments.css +340 -0
- django_cfg/apps/payments/static/payments/js/notifications.js +202 -0
- django_cfg/apps/payments/static/payments/js/payment-utils.js +318 -0
- django_cfg/apps/payments/static/payments/js/theme.js +86 -0
- django_cfg/apps/payments/tasks/webhook_processing.py +2 -2
- django_cfg/apps/payments/templates/admin/payments/currency/change_list.html +50 -0
- django_cfg/apps/payments/templates/payments/base.html +182 -0
- django_cfg/apps/payments/templates/payments/components/payment_card.html +201 -0
- django_cfg/apps/payments/templates/payments/components/payment_qr_code.html +109 -0
- django_cfg/apps/payments/templates/payments/components/progress_bar.html +43 -0
- django_cfg/apps/payments/templates/payments/components/provider_stats.html +40 -0
- django_cfg/apps/payments/templates/payments/components/status_badge.html +34 -0
- django_cfg/apps/payments/templates/payments/components/status_overview.html +148 -0
- django_cfg/apps/payments/templates/payments/dashboard.html +258 -0
- django_cfg/apps/payments/templates/payments/dashboard_simple_test.html +35 -0
- django_cfg/apps/payments/templates/payments/payment_create.html +579 -0
- django_cfg/apps/payments/templates/payments/payment_detail.html +373 -0
- django_cfg/apps/payments/templates/payments/payment_list.html +354 -0
- django_cfg/apps/payments/templates/payments/stats.html +261 -0
- django_cfg/apps/payments/templates/payments/test.html +213 -0
- django_cfg/apps/payments/templatetags/__init__.py +1 -0
- django_cfg/apps/payments/templatetags/payments_tags.py +315 -0
- django_cfg/apps/payments/urls.py +3 -1
- django_cfg/apps/payments/urls_admin.py +58 -0
- django_cfg/apps/payments/utils/__init__.py +1 -3
- django_cfg/apps/payments/utils/billing_utils.py +2 -2
- django_cfg/apps/payments/utils/config_utils.py +2 -8
- django_cfg/apps/payments/utils/validation_utils.py +2 -2
- django_cfg/apps/payments/views/__init__.py +3 -2
- django_cfg/apps/payments/views/currency_views.py +31 -20
- django_cfg/apps/payments/views/payment_views.py +2 -2
- django_cfg/apps/payments/views/templates/__init__.py +25 -0
- django_cfg/apps/payments/views/templates/ajax.py +451 -0
- django_cfg/apps/payments/views/templates/base.py +212 -0
- django_cfg/apps/payments/views/templates/dashboard.py +60 -0
- django_cfg/apps/payments/views/templates/payment_detail.py +102 -0
- django_cfg/apps/payments/views/templates/payment_management.py +158 -0
- django_cfg/apps/payments/views/templates/qr_code.py +174 -0
- django_cfg/apps/payments/views/templates/stats.py +244 -0
- django_cfg/apps/payments/views/templates/utils.py +181 -0
- django_cfg/apps/payments/views/webhook_views.py +2 -2
- django_cfg/apps/payments/viewsets.py +3 -2
- django_cfg/apps/tasks/urls.py +0 -2
- django_cfg/apps/tasks/urls_admin.py +14 -0
- django_cfg/apps/urls.py +6 -3
- django_cfg/core/config.py +35 -0
- django_cfg/models/payments.py +2 -8
- django_cfg/modules/django_currency/__init__.py +16 -11
- django_cfg/modules/django_currency/clients/__init__.py +4 -4
- django_cfg/modules/django_currency/clients/coinpaprika_client.py +289 -0
- django_cfg/modules/django_currency/clients/yahoo_client.py +157 -0
- django_cfg/modules/django_currency/core/__init__.py +1 -7
- django_cfg/modules/django_currency/core/converter.py +18 -23
- django_cfg/modules/django_currency/core/models.py +122 -11
- django_cfg/modules/django_currency/database/__init__.py +4 -4
- django_cfg/modules/django_currency/database/database_loader.py +190 -309
- django_cfg/modules/django_unfold/dashboard.py +7 -2
- django_cfg/registry/core.py +1 -0
- django_cfg/template_archive/.gitignore +1 -0
- django_cfg/template_archive/django_sample.zip +0 -0
- django_cfg/templates/admin/components/action_grid.html +9 -9
- django_cfg/templates/admin/components/metric_card.html +5 -5
- django_cfg/templates/admin/components/status_badge.html +2 -2
- django_cfg/templates/admin/layouts/dashboard_with_tabs.html +152 -24
- django_cfg/templates/admin/snippets/components/quick_actions.html +3 -3
- django_cfg/templates/admin/snippets/components/system_health.html +1 -1
- django_cfg/templates/admin/snippets/tabs/overview_tab.html +49 -52
- {django_cfg-1.2.27.dist-info → django_cfg-1.2.31.dist-info}/METADATA +13 -18
- {django_cfg-1.2.27.dist-info → django_cfg-1.2.31.dist-info}/RECORD +130 -83
- django_cfg/apps/payments/management/commands/populate_currencies.py +0 -246
- django_cfg/apps/payments/management/commands/update_currencies.py +0 -336
- django_cfg/apps/payments/services/providers/cryptapi.py +0 -273
- django_cfg/apps/payments/services/providers/cryptomus.py +0 -310
- django_cfg/apps/payments/services/providers/nowpayments.py +0 -293
- django_cfg/apps/payments/services/validators/__init__.py +0 -8
- django_cfg/modules/django_currency/clients/coingecko_client.py +0 -257
- django_cfg/modules/django_currency/clients/yfinance_client.py +0 -246
- {django_cfg-1.2.27.dist-info → django_cfg-1.2.31.dist-info}/WHEEL +0 -0
- {django_cfg-1.2.27.dist-info → django_cfg-1.2.31.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.2.27.dist-info → django_cfg-1.2.31.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,201 @@
|
|
1
|
+
{% load payments_tags %}
|
2
|
+
{% load humanize %}
|
3
|
+
|
4
|
+
<!-- Payment Card Component -->
|
5
|
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6"
|
6
|
+
data-payment-id="{{ payment.id }}">
|
7
|
+
|
8
|
+
<!-- Header -->
|
9
|
+
<div class="payment-card-header flex items-center justify-between mb-4">
|
10
|
+
<div class="payment-id">
|
11
|
+
<span class="text-sm text-gray-500 dark:text-gray-400">Payment</span>
|
12
|
+
<p class="text-lg font-semibold text-gray-900 dark:text-white">
|
13
|
+
#{{ payment.internal_payment_id|default:payment.id|truncatechars:8 }}
|
14
|
+
</p>
|
15
|
+
</div>
|
16
|
+
{% include 'payments/components/status_badge.html' %}
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<!-- Amount -->
|
20
|
+
<div class="payment-amount mb-4">
|
21
|
+
<div class="flex items-baseline">
|
22
|
+
<span class="text-3xl font-bold text-gray-900 dark:text-white">
|
23
|
+
${{ payment.amount_usd|floatformat:2 }}
|
24
|
+
</span>
|
25
|
+
<span class="ml-2 text-lg text-gray-500 dark:text-gray-400">USD</span>
|
26
|
+
</div>
|
27
|
+
{% if payment.currency_code != 'USD' and payment.pay_amount %}
|
28
|
+
<div class="text-sm text-gray-500 dark:text-gray-400">
|
29
|
+
{{ payment.pay_amount|format_crypto_amount:payment.currency_code }} {{ payment.currency_code }}
|
30
|
+
</div>
|
31
|
+
{% endif %}
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<!-- Payment Details -->
|
35
|
+
<div class="payment-details space-y-2 mb-4">
|
36
|
+
<div class="flex justify-between">
|
37
|
+
<span class="text-sm text-gray-500 dark:text-gray-400">Provider</span>
|
38
|
+
<div class="flex items-center">
|
39
|
+
<span class="material-icons text-sm mr-1 {{ payment.provider|payment_method_icon }}">{{ payment.provider|payment_method_icon }}</span>
|
40
|
+
<span class="text-sm font-medium text-gray-900 dark:text-white">
|
41
|
+
{{ payment.provider|provider_display_name }}
|
42
|
+
</span>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
<div class="flex justify-between">
|
46
|
+
<span class="text-sm text-gray-500 dark:text-gray-400">Created</span>
|
47
|
+
<span class="text-sm text-gray-900 dark:text-white">
|
48
|
+
{{ payment.created_at|naturaltime }}
|
49
|
+
</span>
|
50
|
+
</div>
|
51
|
+
{% if payment.completed_at %}
|
52
|
+
<div class="flex justify-between">
|
53
|
+
<span class="text-sm text-gray-500 dark:text-gray-400">Completed</span>
|
54
|
+
<span class="text-sm text-gray-900 dark:text-white">
|
55
|
+
{{ payment.completed_at|naturaltime }}
|
56
|
+
</span>
|
57
|
+
</div>
|
58
|
+
{% endif %}
|
59
|
+
{% if payment|is_crypto_payment and payment.pay_address %}
|
60
|
+
<div class="flex justify-between">
|
61
|
+
<span class="text-sm text-gray-500 dark:text-gray-400">Address</span>
|
62
|
+
<span class="text-sm font-mono text-gray-900 dark:text-white">
|
63
|
+
{{ payment.pay_address|truncatechars:16 }}
|
64
|
+
<button onclick="window.paymentUtils?.copyToClipboard('{{ payment.pay_address }}')"
|
65
|
+
class="ml-1 text-blue-500 hover:text-blue-700">
|
66
|
+
<span class="material-icons text-xs">content_copy</span>
|
67
|
+
</button>
|
68
|
+
</span>
|
69
|
+
</div>
|
70
|
+
{% endif %}
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<!-- Progress Bar -->
|
74
|
+
{% include 'payments/components/progress_bar.html' %}
|
75
|
+
|
76
|
+
<!-- Actions -->
|
77
|
+
{% if show_actions %}
|
78
|
+
<div class="payment-actions mt-4 flex space-x-2">
|
79
|
+
<button class="flex-1 px-3 py-1.5 text-xs border border-gray-300 dark:border-gray-500 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 rounded-md transition-colors duration-200"
|
80
|
+
onclick="showPaymentDetails('{{ payment.id }}')">
|
81
|
+
<span class="material-icons text-sm mr-1">visibility</span>
|
82
|
+
View Details
|
83
|
+
</button>
|
84
|
+
{% if payment|can_cancel_payment %}
|
85
|
+
<button class="px-3 py-1.5 text-xs bg-red-600 text-white hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 rounded-md transition-colors duration-200"
|
86
|
+
onclick="cancelPayment('{{ payment.id }}')">
|
87
|
+
<span class="material-icons text-sm mr-1">cancel</span>
|
88
|
+
Cancel
|
89
|
+
</button>
|
90
|
+
{% endif %}
|
91
|
+
{% if payment|is_crypto_payment and payment.pay_address %}
|
92
|
+
<button class="px-3 py-1.5 text-xs bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 rounded-md transition-colors duration-200"
|
93
|
+
onclick="showQRCode('{{ payment.id }}')">
|
94
|
+
<span class="material-icons text-sm mr-1">qr_code</span>
|
95
|
+
QR Code
|
96
|
+
</button>
|
97
|
+
{% endif %}
|
98
|
+
</div>
|
99
|
+
{% endif %}
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<!-- Mobile version (hidden on desktop) -->
|
103
|
+
<div class="mobile-payment-card lg:hidden bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-4">
|
104
|
+
<div class="flex items-center justify-between mb-3">
|
105
|
+
<div class="payment-id">
|
106
|
+
<p class="text-sm font-medium text-gray-900 dark:text-white">
|
107
|
+
#{{ payment.internal_payment_id|default:payment.id|truncatechars:8 }}
|
108
|
+
</p>
|
109
|
+
<p class="text-xs text-gray-500 dark:text-gray-400">
|
110
|
+
{{ payment.created_at|naturaltime }}
|
111
|
+
</p>
|
112
|
+
</div>
|
113
|
+
{% include 'payments/components/status_badge.html' %}
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div class="payment-amount mb-3">
|
117
|
+
<div class="flex items-baseline">
|
118
|
+
<span class="text-xl font-bold text-gray-900 dark:text-white">
|
119
|
+
${{ payment.amount_usd|floatformat:2 }}
|
120
|
+
</span>
|
121
|
+
{% if payment.currency_code != 'USD' %}
|
122
|
+
<span class="ml-2 text-sm text-gray-500 dark:text-gray-400">
|
123
|
+
{{ payment.currency_code }}
|
124
|
+
</span>
|
125
|
+
{% endif %}
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="payment-progress mb-3">
|
130
|
+
<div class="progress-bar">
|
131
|
+
<div class="progress-fill" style="width: {{ payment|payment_progress_percentage }}%"></div>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
{% if show_actions %}
|
136
|
+
<div class="flex space-x-2">
|
137
|
+
<button class="flex-1 px-3 py-1.5 text-xs border border-gray-300 dark:border-gray-500 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 rounded-md transition-colors duration-200" onclick="showPaymentDetails('{{ payment.id }}')">
|
138
|
+
Details
|
139
|
+
</button>
|
140
|
+
{% if payment|can_cancel_payment %}
|
141
|
+
<button class="px-3 py-1.5 text-xs bg-red-600 text-white hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600 rounded-md transition-colors duration-200" onclick="cancelPayment('{{ payment.id }}')">
|
142
|
+
Cancel
|
143
|
+
</button>
|
144
|
+
{% endif %}
|
145
|
+
</div>
|
146
|
+
{% endif %}
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<script>
|
150
|
+
// Payment card JavaScript functions
|
151
|
+
function showPaymentDetails(paymentId) {
|
152
|
+
if (window.paymentModal) {
|
153
|
+
window.paymentModal.show(paymentId);
|
154
|
+
} else {
|
155
|
+
// Fallback to direct link
|
156
|
+
window.location.href = `/admin/payments/universalpayment/${paymentId}/change/`;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
function cancelPayment(paymentId) {
|
161
|
+
if (window.paymentUtils) {
|
162
|
+
window.paymentUtils.showConfirmDialog(
|
163
|
+
'Are you sure you want to cancel this payment?',
|
164
|
+
() => {
|
165
|
+
// Make API call to cancel payment
|
166
|
+
fetch(`/api/payments/${paymentId}/cancel/`, {
|
167
|
+
method: 'POST',
|
168
|
+
headers: {
|
169
|
+
'Content-Type': 'application/json',
|
170
|
+
'X-CSRFToken': getCsrfToken()
|
171
|
+
}
|
172
|
+
})
|
173
|
+
.then(response => response.json())
|
174
|
+
.then(data => {
|
175
|
+
if (data.success) {
|
176
|
+
window.notificationManager?.paymentCancelled(paymentId);
|
177
|
+
location.reload(); // Refresh to show updated status
|
178
|
+
} else {
|
179
|
+
window.notificationManager?.error(data.error || 'Failed to cancel payment');
|
180
|
+
}
|
181
|
+
})
|
182
|
+
.catch(error => {
|
183
|
+
console.error('Cancel payment error:', error);
|
184
|
+
window.notificationManager?.error('Failed to cancel payment');
|
185
|
+
});
|
186
|
+
}
|
187
|
+
);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
function showQRCode(paymentId) {
|
192
|
+
// Implementation for QR code modal
|
193
|
+
if (window.qrModal) {
|
194
|
+
window.qrModal.show(paymentId);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
function getCsrfToken() {
|
199
|
+
return document.querySelector('[name=csrfmiddlewaretoken]')?.value || '';
|
200
|
+
}
|
201
|
+
</script>
|
@@ -0,0 +1,109 @@
|
|
1
|
+
{% load payments_tags %}
|
2
|
+
|
3
|
+
<!-- Payment QR Code Component -->
|
4
|
+
<div class="flex flex-col items-center space-y-2 p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700">
|
5
|
+
{% if qr_data %}
|
6
|
+
<div class="w-32 h-32 bg-gray-100 dark:bg-gray-700 rounded flex items-center justify-center" id="qr-code-{{ payment.id }}">
|
7
|
+
<!-- QR code will be generated here by JavaScript -->
|
8
|
+
<span class="material-icons text-gray-400 text-4xl">qr_code</span>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="text-center space-y-2">
|
12
|
+
<p class="text-sm font-medium text-gray-900 dark:text-white">
|
13
|
+
Payment Address
|
14
|
+
</p>
|
15
|
+
<p class="text-xs font-mono text-gray-600 dark:text-gray-400 break-all">
|
16
|
+
{{ payment.pay_address }}
|
17
|
+
</p>
|
18
|
+
{% if payment.pay_amount %}
|
19
|
+
<p class="text-xs text-gray-500 dark:text-gray-500">
|
20
|
+
Amount: {{ payment.pay_amount|format_crypto_amount:payment.currency_code }} {{ payment.currency_code }}
|
21
|
+
</p>
|
22
|
+
{% endif %}
|
23
|
+
|
24
|
+
<!-- Action Buttons -->
|
25
|
+
<div class="flex space-x-2 pt-2">
|
26
|
+
<button class="flex-1 px-3 py-1.5 text-xs border border-gray-300 dark:border-gray-500 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 rounded-md transition-colors duration-200"
|
27
|
+
onclick="copyToClipboard('{{ payment.pay_address }}', 'Address copied!')">
|
28
|
+
<span class="material-icons text-sm mr-1">content_copy</span>
|
29
|
+
Copy Address
|
30
|
+
</button>
|
31
|
+
{% if payment.pay_amount %}
|
32
|
+
<button class="flex-1 px-3 py-1.5 text-xs border border-gray-300 dark:border-gray-500 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 rounded-md transition-colors duration-200"
|
33
|
+
onclick="copyToClipboard('{{ payment.pay_amount }}', 'Amount copied!')">
|
34
|
+
<span class="material-icons text-sm mr-1">content_copy</span>
|
35
|
+
Copy Amount
|
36
|
+
</button>
|
37
|
+
{% endif %}
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
{% else %}
|
41
|
+
<div class="text-center py-8">
|
42
|
+
<span class="material-icons text-gray-400 text-4xl mb-2">qr_code_off</span>
|
43
|
+
<p class="text-sm text-gray-500 dark:text-gray-400">
|
44
|
+
QR code not available for this payment
|
45
|
+
</p>
|
46
|
+
</div>
|
47
|
+
{% endif %}
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<script>
|
51
|
+
// QR Code generation (placeholder implementation)
|
52
|
+
document.addEventListener('DOMContentLoaded', function() {
|
53
|
+
const qrContainer = document.getElementById('qr-code-{{ payment.id }}');
|
54
|
+
if (qrContainer && '{{ qr_data }}') {
|
55
|
+
// This would integrate with a QR code library like qrcode.js
|
56
|
+
// For now, we'll show a placeholder
|
57
|
+
qrContainer.innerHTML = `
|
58
|
+
<div class="w-32 h-32 bg-white border-2 border-gray-300 rounded flex items-center justify-center">
|
59
|
+
<div class="text-center">
|
60
|
+
<span class="material-icons text-gray-400 text-2xl">qr_code</span>
|
61
|
+
<p class="text-xs text-gray-500 mt-1">QR Code</p>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
`;
|
65
|
+
|
66
|
+
// Example of how to integrate a real QR code library:
|
67
|
+
/*
|
68
|
+
if (typeof QRCode !== 'undefined') {
|
69
|
+
new QRCode(qrContainer, {
|
70
|
+
text: '{{ qr_data }}',
|
71
|
+
width: 128,
|
72
|
+
height: 128,
|
73
|
+
colorDark: '#000000',
|
74
|
+
colorLight: '#ffffff',
|
75
|
+
correctLevel: QRCode.CorrectLevel.M
|
76
|
+
});
|
77
|
+
}
|
78
|
+
*/
|
79
|
+
}
|
80
|
+
});
|
81
|
+
|
82
|
+
function copyToClipboard(text, message) {
|
83
|
+
if (window.paymentUtils) {
|
84
|
+
window.paymentUtils.copyToClipboard(text).then(success => {
|
85
|
+
if (success && window.notificationManager) {
|
86
|
+
window.notificationManager.success(message || 'Copied to clipboard');
|
87
|
+
}
|
88
|
+
});
|
89
|
+
} else {
|
90
|
+
// Fallback for older browsers
|
91
|
+
const textArea = document.createElement('textarea');
|
92
|
+
textArea.value = text;
|
93
|
+
document.body.appendChild(textArea);
|
94
|
+
textArea.select();
|
95
|
+
try {
|
96
|
+
document.execCommand('copy');
|
97
|
+
if (window.notificationManager) {
|
98
|
+
window.notificationManager.success(message || 'Copied to clipboard');
|
99
|
+
}
|
100
|
+
} catch (err) {
|
101
|
+
console.error('Failed to copy to clipboard:', err);
|
102
|
+
if (window.notificationManager) {
|
103
|
+
window.notificationManager.error('Failed to copy to clipboard');
|
104
|
+
}
|
105
|
+
}
|
106
|
+
document.body.removeChild(textArea);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
</script>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{% load payments_tags %}
|
2
|
+
|
3
|
+
<!-- Payment Progress Bar Component -->
|
4
|
+
<div>
|
5
|
+
<!-- Progress Steps (Hidden on mobile) -->
|
6
|
+
<div class="hidden md:flex justify-between items-center mb-4">
|
7
|
+
{% for step in payment|payment_progress_steps %}
|
8
|
+
<div class="flex flex-col items-center text-center">
|
9
|
+
<div class="w-8 h-8 flex items-center justify-center rounded-full border-2 mb-2
|
10
|
+
{% if step.completed %}border-green-500 bg-green-500 text-white
|
11
|
+
{% elif step.active %}border-blue-500 bg-blue-500 text-white
|
12
|
+
{% else %}border-gray-300 dark:border-gray-600{% endif %}">
|
13
|
+
{% if step.completed %}
|
14
|
+
<span class="material-icons text-sm">check</span>
|
15
|
+
{% elif step.active %}
|
16
|
+
<div class="w-3 h-3 bg-blue-500 rounded-full animate-pulse"></div>
|
17
|
+
{% else %}
|
18
|
+
<div class="w-3 h-3 bg-gray-300 rounded-full"></div>
|
19
|
+
{% endif %}
|
20
|
+
</div>
|
21
|
+
<div class="text-xs text-gray-500 dark:text-gray-400 mt-1">{{ step.label }}</div>
|
22
|
+
</div>
|
23
|
+
{% endfor %}
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<!-- Progress Bar -->
|
27
|
+
<div class="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2 mt-4 md:mt-0">
|
28
|
+
<div class="h-2 rounded-full transition-all duration-500 ease-out
|
29
|
+
{% if payment.status == 'completed' %}bg-green-600
|
30
|
+
{% elif payment.status == 'failed' %}bg-red-600
|
31
|
+
{% elif payment.status == 'pending' %}bg-yellow-600
|
32
|
+
{% else %}bg-blue-600{% endif %}"
|
33
|
+
style="width: {{ payment|payment_progress_percentage }}%"
|
34
|
+
data-percentage="{{ payment|payment_progress_percentage }}">
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<!-- Progress Text -->
|
39
|
+
<div class="flex justify-between items-center mt-2 text-xs text-gray-500 dark:text-gray-400">
|
40
|
+
<span>{{ payment|payment_progress_percentage }}% Complete</span>
|
41
|
+
<span>{{ payment.get_status_display }}</span>
|
42
|
+
</div>
|
43
|
+
</div>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
{% load payments_tags %}
|
2
|
+
|
3
|
+
<!-- Provider Statistics Component -->
|
4
|
+
<div class="space-y-4">
|
5
|
+
{% for stat in provider_stats %}
|
6
|
+
<div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 rounded-lg">
|
7
|
+
<div class="flex items-center space-x-3">
|
8
|
+
<div class="w-6 h-6 rounded {% if stat.provider == 'nowpayments' %}bg-orange-500{% elif stat.provider == 'cryptapi' %}bg-blue-500{% elif stat.provider == 'cryptomus' %}bg-purple-500{% elif stat.provider == 'stripe' %}bg-indigo-500{% else %}bg-gray-500{% endif %} flex items-center justify-center">
|
9
|
+
<span class="material-icons text-white text-sm">{{ stat.provider|payment_method_icon }}</span>
|
10
|
+
</div>
|
11
|
+
<div>
|
12
|
+
<p class="text-sm font-medium text-gray-900 dark:text-white">
|
13
|
+
{{ stat.provider|provider_display_name }}
|
14
|
+
</p>
|
15
|
+
<p class="text-xs text-gray-500 dark:text-gray-400">
|
16
|
+
{{ stat.count }} payment{{ stat.count|pluralize }}
|
17
|
+
</p>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<div class="text-right">
|
21
|
+
<p class="text-sm font-medium text-gray-900 dark:text-white">
|
22
|
+
${{ stat.volume|floatformat:2|default:"0.00" }}
|
23
|
+
</p>
|
24
|
+
<div class="flex items-center space-x-2">
|
25
|
+
<div class="w-16 bg-gray-200 dark:bg-gray-600 rounded-full h-1">
|
26
|
+
<div class="bg-blue-600 h-1 rounded-full" style="width: {{ stat.success_rate|floatformat:0 }}%"></div>
|
27
|
+
</div>
|
28
|
+
<span class="text-xs text-gray-500 dark:text-gray-400">
|
29
|
+
{{ stat.success_rate|floatformat:0 }}%
|
30
|
+
</span>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
{% empty %}
|
35
|
+
<div class="text-center py-6">
|
36
|
+
<span class="material-icons text-gray-400 text-4xl mb-2">bar_chart</span>
|
37
|
+
<p class="text-sm text-gray-500 dark:text-gray-400">No provider data available</p>
|
38
|
+
</div>
|
39
|
+
{% endfor %}
|
40
|
+
</div>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{% load payments_tags %}
|
2
|
+
|
3
|
+
<!-- Payment Status Badge Component -->
|
4
|
+
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
5
|
+
{% if payment.status == 'pending' %}bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200
|
6
|
+
{% elif payment.status == 'confirming' %}bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200
|
7
|
+
{% elif payment.status == 'confirmed' or payment.status == 'completed' %}bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200
|
8
|
+
{% elif payment.status == 'failed' %}bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200
|
9
|
+
{% elif payment.status == 'expired' or payment.status == 'cancelled' %}bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200
|
10
|
+
{% elif payment.status == 'refunded' %}bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200
|
11
|
+
{% else %}bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200{% endif %}"
|
12
|
+
data-status="{{ payment.status }}">
|
13
|
+
{% if payment.status == 'pending' %}
|
14
|
+
<span class="material-icons text-sm mr-1 animate-pulse">pending</span>
|
15
|
+
{% elif payment.status == 'confirming' %}
|
16
|
+
<span class="material-icons text-sm mr-1 animate-spin">sync</span>
|
17
|
+
{% elif payment.status == 'confirmed' %}
|
18
|
+
<span class="material-icons text-sm mr-1">check_circle</span>
|
19
|
+
{% elif payment.status == 'completed' %}
|
20
|
+
<span class="material-icons text-sm mr-1">verified</span>
|
21
|
+
{% elif payment.status == 'failed' %}
|
22
|
+
<span class="material-icons text-sm mr-1">error</span>
|
23
|
+
{% elif payment.status == 'expired' %}
|
24
|
+
<span class="material-icons text-sm mr-1">schedule</span>
|
25
|
+
{% elif payment.status == 'cancelled' %}
|
26
|
+
<span class="material-icons text-sm mr-1">cancel</span>
|
27
|
+
{% elif payment.status == 'refunded' %}
|
28
|
+
<span class="material-icons text-sm mr-1">undo</span>
|
29
|
+
{% else %}
|
30
|
+
<span class="material-icons text-sm mr-1">help</span>
|
31
|
+
{% endif %}
|
32
|
+
|
33
|
+
<span class="status-text">{{ payment.get_status_display }}</span>
|
34
|
+
</span>
|
@@ -0,0 +1,148 @@
|
|
1
|
+
{% load payments_tags %}
|
2
|
+
|
3
|
+
<!-- Status Overview Cards -->
|
4
|
+
{% if not payment_stats %}
|
5
|
+
{% get_payment_stats as payment_stats %}
|
6
|
+
{% endif %}
|
7
|
+
|
8
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
|
9
|
+
<!-- Total Payments -->
|
10
|
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6">
|
11
|
+
<div class="flex items-center">
|
12
|
+
<div class="flex-shrink-0">
|
13
|
+
<span class="material-icons text-blue-600 dark:text-blue-400 text-3xl">payments</span>
|
14
|
+
</div>
|
15
|
+
<div class="ml-4">
|
16
|
+
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Total Payments</p>
|
17
|
+
<p class="text-2xl font-bold text-gray-900 dark:text-white">
|
18
|
+
{{ payment_payment_stats.total_payments_count|default:0 }}
|
19
|
+
</p>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<!-- Pending Payments -->
|
25
|
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6">
|
26
|
+
<div class="flex items-center">
|
27
|
+
<div class="flex-shrink-0">
|
28
|
+
<span class="material-icons text-yellow-600 dark:text-yellow-400 text-3xl">pending</span>
|
29
|
+
</div>
|
30
|
+
<div class="ml-4">
|
31
|
+
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Pending</p>
|
32
|
+
<p class="text-2xl font-bold text-gray-900 dark:text-white">
|
33
|
+
{{ payment_payment_stats.pending_payments_count|default:0 }}
|
34
|
+
</p>
|
35
|
+
{% if payment_payment_stats.confirming_payments_count %}
|
36
|
+
<p class="text-xs text-gray-500 dark:text-gray-400">
|
37
|
+
+{{ payment_payment_stats.confirming_payments_count }} confirming
|
38
|
+
</p>
|
39
|
+
{% endif %}
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<!-- Completed Payments -->
|
45
|
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6">
|
46
|
+
<div class="flex items-center">
|
47
|
+
<div class="flex-shrink-0">
|
48
|
+
<span class="material-icons text-green-600 dark:text-green-400 text-3xl">check_circle</span>
|
49
|
+
</div>
|
50
|
+
<div class="ml-4">
|
51
|
+
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Completed</p>
|
52
|
+
<p class="text-2xl font-bold text-gray-900 dark:text-white">
|
53
|
+
{{ payment_stats.completed_payments_count|default:0 }}
|
54
|
+
</p>
|
55
|
+
{% if payment_stats.total_payments_count > 0 %}
|
56
|
+
<p class="text-xs text-green-600 dark:text-green-400">
|
57
|
+
{{ payment_stats.completed_payments_count|floatformat:0 }}/{{ payment_stats.total_payments_count }} success
|
58
|
+
</p>
|
59
|
+
{% endif %}
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<!-- Total Volume -->
|
65
|
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-6">
|
66
|
+
<div class="flex items-center">
|
67
|
+
<div class="flex-shrink-0">
|
68
|
+
<span class="material-icons text-purple-600 dark:text-purple-400 text-3xl">account_balance</span>
|
69
|
+
</div>
|
70
|
+
<div class="ml-4">
|
71
|
+
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">Total Volume</p>
|
72
|
+
<p class="text-2xl font-bold text-gray-900 dark:text-white">
|
73
|
+
${{ payment_stats.total_volume|floatformat:2|default:"0.00" }}
|
74
|
+
</p>
|
75
|
+
{% if payment_stats.failed_payments_count %}
|
76
|
+
<p class="text-xs text-red-500 dark:text-red-400">
|
77
|
+
{{ payment_stats.failed_payments_count }} failed
|
78
|
+
</p>
|
79
|
+
{% endif %}
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<!-- Quick Actions Bar -->
|
86
|
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-6">
|
87
|
+
<div class="flex items-center justify-between">
|
88
|
+
<div class="flex items-center space-x-4">
|
89
|
+
<span class="text-sm font-medium text-gray-700 dark:text-gray-300">Quick Actions:</span>
|
90
|
+
<div class="flex space-x-2">
|
91
|
+
<button class="px-3 py-1.5 text-xs bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 rounded-md transition-colors duration-200" onclick="createNewPayment()">
|
92
|
+
<span class="material-icons text-sm mr-1">add</span>
|
93
|
+
New Payment
|
94
|
+
</button>
|
95
|
+
<button class="px-3 py-1.5 text-xs border border-gray-300 dark:border-gray-500 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 rounded-md transition-colors duration-200" onclick="refreshPayments()">
|
96
|
+
<span class="material-icons text-sm mr-1">refresh</span>
|
97
|
+
Refresh
|
98
|
+
</button>
|
99
|
+
<button class="px-3 py-1.5 text-xs border border-gray-300 dark:border-gray-500 text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 rounded-md transition-colors duration-200" onclick="exportPayments()">
|
100
|
+
<span class="material-icons text-sm mr-1">download</span>
|
101
|
+
Export
|
102
|
+
</button>
|
103
|
+
</div>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
<!-- Live Status Indicator -->
|
107
|
+
<div class="flex items-center space-x-2">
|
108
|
+
<div class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">
|
109
|
+
<div class="w-2 h-2 bg-green-500 rounded-full mr-2 animate-pulse"></div>
|
110
|
+
Live Updates
|
111
|
+
</div>
|
112
|
+
<span class="text-xs text-gray-500 dark:text-gray-400">
|
113
|
+
Last update: <span id="stats-last-update">{% now "H:i:s" %}</span>
|
114
|
+
</span>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<script>
|
120
|
+
// Quick actions implementation
|
121
|
+
function createNewPayment() {
|
122
|
+
window.location.href = '{% url "payments_dashboard:create" %}';
|
123
|
+
}
|
124
|
+
|
125
|
+
function refreshPayments() {
|
126
|
+
location.reload();
|
127
|
+
}
|
128
|
+
|
129
|
+
function exportPayments() {
|
130
|
+
// Implement export functionality
|
131
|
+
if (window.notificationManager) {
|
132
|
+
window.notificationManager.info('Export functionality coming soon');
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
// Auto-refresh stats every 30 seconds
|
137
|
+
setInterval(() => {
|
138
|
+
updateStatsLastUpdate();
|
139
|
+
}, 30000);
|
140
|
+
|
141
|
+
function updateStatsLastUpdate() {
|
142
|
+
const element = document.getElementById('stats-last-update');
|
143
|
+
if (element) {
|
144
|
+
element.textContent = new Date().toLocaleTimeString();
|
145
|
+
}
|
146
|
+
}
|
147
|
+
</script>
|
148
|
+
|