Skip to content

Commit 845c741

Browse files
committed
fix: Remove currency dropdown and set currency to USD
1 parent f4bda56 commit 845c741

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

hugo-site/themes/freenet/layouts/shortcodes/stripe-donation-form.html

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
<label class="donation-amount-label"><input type="radio" name="amount" value="50"> $50</label>
88
<label class="donation-amount-label"><input type="radio" name="amount" value="100"> $100</label>
99
</div>
10-
<div style="margin-bottom: 20px;">
11-
<select id="currency" required style="width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 5px;">
12-
<option value="usd">USD</option>
13-
<option value="eur">EUR</option>
14-
<option value="gbp">GBP</option>
15-
</select>
16-
</div>
1710
<div id="payment-element" style="margin-bottom: 20px;">
1811
<!-- Stripe Elements will be inserted here -->
1912
</div>
@@ -97,7 +90,6 @@
9790
document.querySelectorAll('input[name="amount"]').forEach(radio => {
9891
radio.addEventListener('change', createOrUpdatePaymentIntent);
9992
});
100-
document.getElementById('currency').addEventListener('change', createOrUpdatePaymentIntent);
10193
} catch (error) {
10294
console.error('Stripe initialization error:', error);
10395
const messageContainer = document.querySelector('#error-message');
@@ -110,7 +102,7 @@
110102
async function createOrUpdatePaymentIntent() {
111103
const apiUrl = window.ghostkeyApiUrl;
112104
const amount = parseInt(document.querySelector('input[name="amount"]:checked').value) * 100;
113-
const currency = document.getElementById('currency').value;
105+
const currency = 'usd';
114106

115107
try {
116108
const response = await fetch(`${apiUrl}/${paymentIntentId ? 'update-donation' : 'create-donation'}`, {

rust/api/src/routes.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ struct Message {
2929

3030
#[derive(Deserialize, Debug)]
3131
pub struct DonationRequest {
32-
pub currency: String,
3332
pub amount: i64,
3433
}
3534

@@ -136,10 +135,7 @@ async fn create_donation(
136135
let secret_key = std::env::var("STRIPE_SECRET_KEY").map_err(DonationError::EnvError)?;
137136
let client = Client::new(&secret_key);
138137

139-
let currency = Currency::from_str(&request.currency).map_err(|_| {
140-
error!("Invalid currency: {}", request.currency);
141-
DonationError::InvalidCurrency
142-
})?;
138+
let currency = Currency::USD;
143139

144140
let mut metadata = HashMap::new();
145141
metadata.insert("donation_type".to_string(), "freenet".to_string());

0 commit comments

Comments
 (0)