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

Commit 2869b5b

Browse files
committed
updates http client to use submitCancel() since Close is reserved for pfis
1 parent 7d7e6d5 commit 2869b5b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Sources/tbDEX/HttpClient/tbDEXHttpClient.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ public enum tbDEXHttpClient {
103103
try await sendMessage(message: order, messageEndpoint: "/exchanges/\(exchangeID)")
104104
}
105105

106-
/// Sends the Close message to the PFI
106+
/// Sends the Cancel message to the PFI
107107
/// - Parameters:
108-
/// - order: The Close message that will be sent to the PFI
108+
/// - cancel: The Cancel message that will be sent to the PFI
109109
/// - Throws: if message verification fails
110110
/// - Throws: if recipient DID resolution fails
111111
/// - Throws: if recipient DID does not have a PFI service entry
112-
public static func submitClose(close: Close) async throws {
113-
let exchangeID = close.metadata.exchangeID
114-
try await sendMessage(message: close, messageEndpoint: "/exchanges/\(exchangeID)")
112+
public static func submitCancel(cancel: Cancel) async throws {
113+
let exchangeID = cancel.metadata.exchangeID
114+
try await sendMessage(message: cancel, messageEndpoint: "/exchanges/\(exchangeID)")
115115
}
116116

117117
/// Sends a message to a PFI

Tests/tbDEXTests/HttpClient/tbDEXHttpClientTests.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -277,25 +277,25 @@ final class tbDEXHttpClientTests: XCTestCase {
277277
}
278278
}
279279

280-
func test_submitCloseWhenSuccess() async throws {
281-
var close = DevTools.createClose(from: did.uri, to: pfiDid)
280+
func test_submitCancelWhenSuccess() async throws {
281+
var cancel = DevTools.createCancel(from: did.uri, to: pfiDid)
282282

283-
try close.sign(did: did)
283+
try cancel.sign(did: did)
284284

285285
Mocker.mode = .optin
286286
Mock(
287287
url: URL(string: "\(endpoint)/exchanges/exchange_123")!,
288288
contentType: .json,
289289
statusCode: 200,
290290
data: [
291-
.put: try tbDEXJSONEncoder().encode(close)
291+
.put: try tbDEXJSONEncoder().encode(cancel)
292292
]
293293
).register()
294294

295295
do {
296-
try await tbDEXHttpClient.submitClose(close: close)
296+
try await tbDEXHttpClient.submitCancel(cancel: cancel)
297297
} catch {
298-
XCTFail("Error on submit order: \(error)")
298+
XCTFail("Error on submit cancel: \(error)")
299299
}
300300
}
301301

0 commit comments

Comments
 (0)