Skip to content

fix: add missing metadata fields to /execute/ payload and clean up consent status request#1

Draft
sd-gh-bot wants to merge 1 commit into
mainfrom
fix/submit-metadata-fields
Draft

fix: add missing metadata fields to /execute/ payload and clean up consent status request#1
sd-gh-bot wants to merge 1 commit into
mainfrom
fix/submit-metadata-fields

Conversation

@sd-gh-bot
Copy link
Copy Markdown

@sd-gh-bot sd-gh-bot commented May 18, 2026

User description

Summary

Fixes two gaps identified in the mobile SDK vs API alignment analysis.

Gap 1 — /execute/ payload missing 6 optional fields (Critical)

The SpotDraft backend POST .../execute/ endpoint accepts first_name, last_name, user_email, additional_custom_information, key_pointer_information, and external_metadata but the SDK was silently dropping all of them. Teams that need custom metadata or user-detail capture on consent records were completely blocked.

Changes:

File Change
ClickwrapSubmitMetadata New public model with 6 optional fields
SubmissionRequestModel / RequestBody Added all 6 optional fields; null values are omitted from the JSON payload — backward-compatible
ClickwrapRepository (interface + impl) Accept and forward ClickwrapSubmitMetadata?
ClickwrapService.submitAcceptance() Accept and forward ClickwrapSubmitMetadata?
SpotDraftManager.submitAcceptance() New optional metadata parameter (default nil/null) — backward-compatible

Gap 2 — ConsentStatusRequest sending unused fields (Minor / Cleanup)

ConsentStatusRequest was sending additional_custom_information, key_pointer_information, and agreements to POST .../consent_status/ which the API does not consume. Stripped back to user_identifier only to keep the wire format accurate.


How to validate

1. Backward-compatibility — existing call sites still compile unchanged

// iOS — no change needed from callers
SpotDraftManager.submitAcceptance(userIdentifier: userId)
// Android — no change needed from callers
SpotDraftManager.submitAcceptance(userIdentifier = userId)

2. New metadata path — pass metadata and verify it reaches the backend

// iOS
let metadata = ClickwrapSubmitMetadata(
    firstName: "Jane",
    lastName: "Doe",
    userEmail: "jane@example.com",
    additionalCustomInformation: ["plan": "enterprise"],
    keyPointerInformation: ["contractRef": "MSA-2024"],
    externalMetadata: ["crmId": "SF-00001"]
)
SpotDraftManager.submitAcceptance(userIdentifier: userId, metadata: metadata)
// Android
val metadata = ClickwrapSubmitMetadata(
    firstName = "Jane",
    lastName = "Doe",
    userEmail = "jane@example.com",
    additionalCustomInformation = mapOf("plan" to "enterprise"),
    keyPointerInformation = mapOf("contractRef" to "MSA-2024"),
    externalMetadata = mapOf("crmId" to "SF-00001")
)
SpotDraftManager.submitAcceptance(userIdentifier = userId, metadata = metadata)

Enable SDK logging (enableLogging = true in ClickwrapConfig) and confirm the POST body printed to the log includes the metadata fields.

3. Verify consent status request is slim

Enable logging and confirm POST .../consent_status/ body is {"user_identifier": "<id>"} only.

4. Integration test against staging

Point baseURL to the staging environment, trigger submitAcceptance with metadata, and confirm the created contract record on the SpotDraft dashboard shows the custom information fields populated.


References: Gap analysis — [mobile-sdk-api-gap-analysis.md]


Generated description

Below is a concise technical summary of the changes proposed in this PR:
Wire optional ClickwrapSubmitMetadata from SpotDraftManager through ClickwrapService and ClickwrapRepository into SubmissionRequestModel so /execute/ submissions can carry the user and custom metadata captured by the backend. Align ConsentStatusRequest to encode only user_identifier so the consent-status payload matches what the API consumes.

TopicDetails
Submission metadata Propagate optional metadata from SpotDraftManager through ClickwrapService/ClickwrapRepository into SubmissionRequestModel by introducing ClickwrapSubmitMetadata, encoding optional fields with AnyCodable, and omitting nil values so the /execute/ payload can now include the six metadata fields the backend expects.
Modified files (6)
  • ClickwrapDemoApp/SpotDraftClickwrap/Core/ClickwrapService.swift
  • ClickwrapDemoApp/SpotDraftClickwrap/Core/SpotDraftManager.swift
  • ClickwrapDemoApp/SpotDraftClickwrap/Domain/Models/ClickwrapSubmitMetadata.swift
  • ClickwrapDemoApp/SpotDraftClickwrap/Networking/Models/Request/SubmissionRequestModel.swift
  • ClickwrapDemoApp/SpotDraftClickwrap/Networking/Utils/AnyCodable.swift
  • ClickwrapDemoApp/SpotDraftClickwrap/Repository/ClickwrapRepository.swift
Latest Contributors(2)
UserCommitDate
neo@spotdraft.comfix: add missing metad...May 18, 2026
himanshu.m@tequity.techrefactor- remove appli...November 14, 2025
Consent status Trim ConsentStatusRequest to only encode user_identifier, keeping the consent-status payload aligned with the backend contract by removing unused fields and helper types.
Modified files (1)
  • ClickwrapDemoApp/SpotDraftClickwrap/Networking/Models/Request/ConsentStatusRequest.swift
Latest Contributors(2)
UserCommitDate
neo@spotdraft.comfix: add missing metad...May 18, 2026
himanshu.m@tequity.techrefactor: improve code...November 13, 2025
Review this PR on Baz | Customize your next review

…ent status request

Gap 1 (Critical): The /execute/ endpoint accepts first_name, last_name, user_email,
additional_custom_information, key_pointer_information, and external_metadata but the
SDK was not sending any of them.

Changes:
- Add ClickwrapSubmitMetadata.swift - new public struct for optional submit metadata
- Update SubmissionRequestModel to include all 6 optional API fields (omitted from
  JSON when nil, so existing integrations are unaffected)
- Extend ClickwrapService.submitAcceptance() and ClickwrapRepository.submitAcceptance()
  to accept and forward ClickwrapSubmitMetadata
- Extend SpotDraftManager.submitAcceptance(userIdentifier:metadata:) with the new
  optional metadata parameter (default nil, fully backward-compatible)
- Move AnyCodable to its own file (Networking/Utils/AnyCodable.swift)

Gap 2 (Minor): ConsentStatusRequest was sending additional_custom_information,
key_pointer_information, and agreements to the consent_status endpoint which the
API does not consume. Stripped back to user_identifier only.

Co-authored-by: Prakasha G <prakasha@spotdraft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant