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:
Enable optional metadata to flow through SpotDraftManager, ClickwrapService, ClickwrapRepository, and SubmissionRequestModel so the /execute/ endpoint can capture the six custom consent fields. Clarify ConsentStatusRequest to only send user_identifier to keep the consent status payload aligned with the API.

TopicDetails
Consent status payload Trim the ConsentStatusRequest body to only include user_identifier to reflect the backend contract.
Modified files (1)
  • spotdraftclickwrap/src/main/java/com/app/android/clickwrap/networking/models/request/ConsentStatusRequest.kt
Latest Contributors(2)
UserCommitDate
neo@spotdraft.comfix: add missing metad...May 18, 2026
himanshu.m@tequity.techInitial commitNovember 17, 2025
Metadata submission Enable metadata fields captured by ClickwrapSubmitMetadata to pass through the manager, service, repository, and request model so custom user and contract context reaches the /execute/ endpoint.
Modified files (5)
  • spotdraftclickwrap/src/main/java/com/app/android/clickwrap/core/ClickwrapService.kt
  • spotdraftclickwrap/src/main/java/com/app/android/clickwrap/core/SpotDraftManager.kt
  • spotdraftclickwrap/src/main/java/com/app/android/clickwrap/domain/models/ClickwrapSubmitMetadata.kt
  • spotdraftclickwrap/src/main/java/com/app/android/clickwrap/networking/models/request/SubmissionRequestModel.kt
  • spotdraftclickwrap/src/main/java/com/app/android/clickwrap/repository/ClickwrapRepository.kt
Latest Contributors(2)
UserCommitDate
neo@spotdraft.comfix: add missing metad...May 18, 2026
himanshu.m@tequity.techInitial commitNovember 17, 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.kt - new public data class for optional submit metadata
- Update RequestBody to include all 6 optional API fields (null fields are omitted by
  Gson so existing integrations are unaffected)
- Extend ClickwrapService.submitAcceptance() and ClickwrapRepository (interface +
  DefaultClickwrapRepository) to accept and forward ClickwrapSubmitMetadata
- Extend SpotDraftManager.submitAcceptance(userIdentifier, metadata) with the new
  optional metadata parameter (@jvmoverloads ensures Java callers are unaffected)

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