File tree Expand file tree Collapse file tree 2 files changed +2
-14
lines changed
hugo-site/themes/freenet/layouts/shortcodes Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change 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 >
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' ) ;
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' } ` , {
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ struct Message {
2929
3030#[ derive( Deserialize , Debug ) ]
3131pub 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 ( ) ) ;
You can’t perform that action at this time.
0 commit comments