fix: serialize Stripe checkout provisioning

This commit is contained in:
237899745
2026-07-26 03:07:30 +08:00
parent 03d0e43d4d
commit 08000cc16e
8 changed files with 805 additions and 197 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@ pub struct Config {
pub stripe_secret_key: Option<String>,
pub stripe_webhook_secret: Option<String>,
pub stripe_api_base_url: String,
pub storage_path: String,
@@ -99,6 +100,10 @@ impl Config {
}
let stripe_secret_key = env_string("STRIPE_SECRET_KEY");
let stripe_webhook_secret = env_string("STRIPE_WEBHOOK_SECRET");
let stripe_api_base_url = env_string("STRIPE_API_BASE_URL")
.unwrap_or_else(|| "https://api.stripe.com".to_string())
.trim_end_matches('/')
.to_string();
let storage_path = env_string("STORAGE_PATH").unwrap_or_else(|| "./uploads".to_string());
@@ -140,6 +145,7 @@ impl Config {
api_key_pepper,
stripe_secret_key,
stripe_webhook_secret,
stripe_api_base_url,
storage_path,
allow_anonymous_upload,
anon_max_file_size_mb,

View File

@@ -3,7 +3,6 @@ use crate::state::AppState;
use chrono::{DateTime, Duration, Utc};
use serde_json::Value as JsonValue;
use sha2::{Digest, Sha256};
use sqlx::FromRow;
use uuid::Uuid;
@@ -27,15 +26,6 @@ struct IdemRow {
response_body: Option<JsonValue>,
}
pub fn sha256_hex(parts: &[&[u8]]) -> String {
let mut hasher = Sha256::new();
for p in parts {
hasher.update(p);
hasher.update([0u8]); // separator
}
hex::encode(hasher.finalize())
}
pub async fn begin(
state: &AppState,
scope: Scope,