-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for additional fields in
SignRequest
(#919)
- Loading branch information
1 parent
a05b243
commit 36f464c
Showing
14 changed files
with
351 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
github "Quick/Quick" "v7.0.0" | ||
github "Quick/Nimble" "v12.0.0" | ||
github "AliSoftware/OHHTTPStubs" "9.1.0" | ||
github "AliSoftware/OHHTTPStubs" "master" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
github "AliSoftware/OHHTTPStubs" "9.1.0" | ||
github "AliSoftware/OHHTTPStubs" "c582400a38590a3dabb4353416d9d46cb7278d06" | ||
github "Quick/Nimble" "v12.0.0" | ||
github "Quick/Quick" "v7.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,22 +47,40 @@ class SignRequestsModuleIntegrationSpecs: QuickSpec { | |
return | ||
} | ||
|
||
let signer = SignRequestCreateSigner( | ||
email: "[email protected]", | ||
role: .signer, | ||
redirectUrl: "https://www.box.com/redirect_url_signer_1", | ||
declinedRedirectUrl: "https://www.box.com/declined_redirect_url_singer_1" | ||
) | ||
let signers = [ | ||
SignRequestCreateSigner( | ||
email: "[email protected]", | ||
role: .signer, | ||
redirectUrl: "https://www.box.com/redirect_url_signer_1", | ||
declinedRedirectUrl: "https://www.box.com/declined_redirect_url_singer_1", | ||
loginRequired: false, | ||
password: "password", | ||
signerGroupId: "SignerGroup" | ||
), | ||
SignRequestCreateSigner( | ||
email: "[email protected]", | ||
role: .signer, | ||
redirectUrl: "https://www.box.com/redirect_url_signer_2", | ||
declinedRedirectUrl: "https://www.box.com/declined_redirect_url_singer_2", | ||
loginRequired: false, | ||
verificationPhoneNumber: "+48123456789", | ||
password: "password", | ||
signerGroupId: "SignerGroup" | ||
) | ||
] | ||
|
||
let signParameters = SignRequestCreateParameters( | ||
redirectUrl: "https://www.box.com/redirect_url", | ||
declinedRedirectUrl: "https://www.box.com/declined_redirect_url" | ||
declinedRedirectUrl: "https://www.box.com/declined_redirect_url", | ||
name: "Sign created by iOS SDK", | ||
isPhoneVerificationRequiredToView: false, | ||
signatureColor: .black | ||
) | ||
|
||
// Create | ||
waitUntil(timeout: .seconds(Constants.Timeout.large)) { done in | ||
client.signRequests.create( | ||
signers: [signer], | ||
signers: signers, | ||
sourceFiles: [ | ||
SignRequestCreateSourceFile(id: fileToSign1.id), | ||
SignRequestCreateSourceFile(id: fileToSign2.id) | ||
|
@@ -73,10 +91,30 @@ class SignRequestsModuleIntegrationSpecs: QuickSpec { | |
switch result { | ||
case let .success(signRequestResult): | ||
signRequest = signRequestResult | ||
expect(signRequest?.name).to(equal(signParameters.name)) | ||
expect(signRequest?.isPhoneVerificationRequiredToView).to(equal(signParameters.isPhoneVerificationRequiredToView)) | ||
expect(signRequest?.signatureColor).to(equal(signParameters.signatureColor)) | ||
expect(signRequest?.redirectUrl).to(equal(signParameters.redirectUrl)) | ||
expect(signRequest?.declinedRedirectUrl).to(equal(signParameters.declinedRedirectUrl)) | ||
expect(signRequest?.parentFolder.id).to(equal(rootFolder.id)) | ||
expect(signRequest?.signFiles?.files?.count).to(equal(2)) | ||
// first signer is the sender with role final_copy_reader, second and third is the recipient with role signer | ||
expect(signRequest?.signers.count).to(equal(3)) | ||
expect(signRequest?.signers[0].role).to(equal(.finalCopyReader)) | ||
expect(signRequest?.signers[1].signerGroupId).notTo(beNil()) | ||
expect(signRequest?.signers[1].signerGroupId).to(equal(signRequest?.signers[2].signerGroupId)) | ||
expect(signRequest?.signers[1].role).to(equal(.signer)) | ||
expect(signRequest?.signers[1].email).to(equal(signers[0].email)) | ||
expect(signRequest?.signers[1].redirectUrl).to(equal(signers[0].redirectUrl)) | ||
expect(signRequest?.signers[1].declinedRedirectUrl).to(equal(signers[0].declinedRedirectUrl)) | ||
expect(signRequest?.signers[1].loginRequired).to(equal(signers[0].loginRequired)) | ||
expect(signRequest?.signers[2].signerGroupId).notTo(beNil()) | ||
expect(signRequest?.signers[2].role).to(equal(.signer)) | ||
expect(signRequest?.signers[2].email).to(equal(signers[1].email)) | ||
expect(signRequest?.signers[2].redirectUrl).to(equal(signers[1].redirectUrl)) | ||
expect(signRequest?.signers[2].declinedRedirectUrl).to(equal(signers[1].declinedRedirectUrl)) | ||
expect(signRequest?.signers[2].loginRequired).to(equal(signers[1].loginRequired)) | ||
expect(signRequest?.signers[2].verificationPhoneNumber).to(equal(signers[1].verificationPhoneNumber)) | ||
case let .failure(error): | ||
fail("Expected create call to succeed, but instead got \(error)") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// SignRequestSignatureColor.swift | ||
// BoxSDK-iOS | ||
// | ||
// Created by Artur Jankowski on 05/03/2024. | ||
// Copyright © 2024 box. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Force a specific color for the signature | ||
public enum SignRequestSignatureColor: BoxEnum { | ||
/// blue color | ||
case blue | ||
/// black color | ||
case black | ||
/// red color | ||
case red | ||
/// A custom value not implemented in this version of SDK. | ||
case customValue(String) | ||
|
||
public init(_ value: String) { | ||
switch value { | ||
case "blue": | ||
self = .blue | ||
case "black": | ||
self = .black | ||
case "red": | ||
self = .red | ||
default: | ||
self = .customValue(value) | ||
} | ||
} | ||
|
||
public var description: String { | ||
switch self { | ||
case .blue: | ||
return "blue" | ||
case .black: | ||
return "black" | ||
case .red: | ||
return "red" | ||
case let .customValue(userValue): | ||
return userValue | ||
} | ||
} | ||
} |
Oops, something went wrong.