Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
add CancellationDetails to Offering (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-tbd authored Aug 29, 2024
1 parent 7d7e6d5 commit 5f000a4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Sources/tbDEX/Protocol/DevTools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ enum DevTools {
)
]
),
requiredClaims: nil
requiredClaims: nil,
cancellation: .init(enabled: false)
)

if let `protocol` = `protocol` {
Expand Down
31 changes: 30 additions & 1 deletion Sources/tbDEX/Protocol/Models/Resources/Offering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ public struct OfferingData: ResourceData {
/// Details and options associated to the payout currency
public let payout: PayoutDetails

/// Articulates the claim(s) required when submitting an RFQ for this offering.
/// Articulates the claim(s) required when submitting an RFQ for this offering
public let requiredClaims: PresentationDefinitionV2?

/// Details about PFI's cancellation policy
public let cancellation: CancellationDetails

/// Returns the ResourceKind of offering
public func kind() -> ResourceKind {
Expand Down Expand Up @@ -203,3 +206,29 @@ public struct PayoutMethod: Codable, Equatable {
self.max = max
}
}

/// Details about cancellation within an Offering
///
/// [Specification Reference](https://github.com/TBD54566975/tbdex/tree/main/specs/protocol#cancellationdetails)
public struct CancellationDetails: Codable, Equatable {

/// Whether cancellation is enabled for this offering
public let enabled: Bool

/// A link to a page that describes the terms of cancellation
public let termsUrl: URL?

/// A human-readable description of the terms of cancellation in plaintext
public let terms: String?

/// Default initializer
init(
enabled: Bool,
termsUrl: URL? = nil,
terms: String? = nil
) {
self.enabled = enabled
self.termsUrl = termsUrl
self.terms = terms
}
}

0 comments on commit 5f000a4

Please sign in to comment.