pub struct Receipt {
pub receipt_id: ReceiptId,
pub payment_reference: PaymentReference,
pub payment_request_id: Option<PaymentRequestId>,
pub billing_period: Option<BillingPeriod>,
pub recipient_public_key: PublicKey,
pub payment_endpoint_identifier: Option<PaymentEndpointIdentifier>,
pub amount: Option<PaymentAmount>,
pub metadata: Map<String, Value>,
}Expand description
Canonical receipt plaintext encrypted before storage.
Fields§
§receipt_id: ReceiptIdReceipt artifact identifier.
payment_reference: PaymentReferencePayment Reference this receipt corresponds to.
payment_request_id: Option<PaymentRequestId>Optional Payment Request ID this receipt corresponds to.
billing_period: Option<BillingPeriod>Optional Billing Period for recurring Payment Request receipts.
recipient_public_key: PublicKeyPublic key of the intended receipt recipient.
payment_endpoint_identifier: Option<PaymentEndpointIdentifier>Optional Payment Endpoint Identifier used for the payment.
amount: Option<PaymentAmount>Optional Payment Amount this receipt corresponds to.
metadata: Map<String, Value>Caller-defined Receipt Metadata as a JSON object.
Implementations§
Source§impl Receipt
impl Receipt
Sourcepub fn encrypt(&self, key: &ReceiptDecryptionKey) -> Result<String>
pub fn encrypt(&self, key: &ReceiptDecryptionKey) -> Result<String>
Encrypt this receipt for storage at its canonical Receipt Location path
using key.
The location path is derived from the Receipt ID and authenticated as AEAD associated data; callers must use that same canonical path when decrypting.
Sourcepub fn decrypt(
encrypted_json: &str,
key: &ReceiptDecryptionKey,
location: &str,
) -> Result<Self>
pub fn decrypt( encrypted_json: &str, key: &ReceiptDecryptionKey, location: &str, ) -> Result<Self>
Decrypt an Encrypted Receipt fetched from a homeserver.
key and location normally come from a ReceiptAccess message. The
location path is authenticated as AEAD associated data and the decrypted
Receipt ID must match the canonical path.