Integrate recoverable native purchases, registered rentals and explicit payment consent

This commit is contained in:
archipelago
2026-10-06 22:44:06 -04:00
parent e4eae71314
commit 49703d7e88
63 changed files with 8028 additions and 134 deletions
+26
View File
@@ -1897,3 +1897,29 @@ mod payment_source_tests {
}
}
}
// Make existing content_file_path pub(crate). Add this method in content_server.
pub(crate) async fn publish_snapshot_offer(
data_dir: &Path,
original: &ContentItem,
offer: &crate::content_purchase_protocol::Offer,
) -> Result<crate::content_purchase_protocol::Offer> {
let _held = CATALOG_WRITES.lock().await;
let current = load_catalog(data_dir).await?;
let item = current
.items
.iter()
.find(|item| item.id == original.id)
.context("Content was unshared before this offer")?;
anyhow::ensure!(
serde_json::to_value(item)? == serde_json::to_value(original)?,
"Shared content terms changed before offer publication"
);
crate::content_purchase_protocol::save_offer(
data_dir,
offer,
&offer.buyer_did,
chrono::Utc::now().timestamp(),
)
.await
}