Repository navigation
feat(sdk): recognize the Ban Credit waiver claim verdicts #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
purpshell
wants to merge
1
commit into
main
Choose a base branch
from
t3/ban-credit-waiver-verdicts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+399
−23
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,72 @@ | ||
| { | ||
| "repository": "polymorfa/polymorfa", | ||
| "sourceCommit": "5ccd3dcb7016d87994bcf19c58f2cc148ac82428", | ||
| "published": false, | ||
| "scope": "Ban Credit claim waivers: verdicts linked_device_interactive and referral_group_send, and claim evidence linkedDeviceInteractive and referralGroupSend (polymorfa/polymorfa#845, unmerged). Other SDK contracts retain their recorded source revisions.", | ||
| "sources": { | ||
| "platform": { | ||
| "sourcePath": "apps/api/docs/openapi.management.json", | ||
| "sha256": "bc15edfa17c674f3aed5a192624bacaa96984155d2cc072ce1938d67f28fffa9" | ||
| }, | ||
| "messaging": { | ||
| "sourcePath": "apps/api/docs/openapi.json", | ||
| "sha256": "b8a96e1f31e33ed5c4b1fb59fa9939f7f05456ed583a7ac9c68cbb10a7e29eb6" | ||
| } | ||
| }, | ||
| "verdicts": { | ||
| "BanSafeClaim": { | ||
| "family": "platform", | ||
| "enum": [ | ||
| "other_device", | ||
| "customer_conduct", | ||
| "shared_network", | ||
| "ours", | ||
| "inconclusive", | ||
| "simultaneous_calls", | ||
| "linked_device_interactive", | ||
| "referral_group_send" | ||
| ] | ||
| }, | ||
| "BanSafeClaimPayload": { | ||
| "family": "messaging", | ||
| "enum": [ | ||
| "other_device", | ||
| "customer_conduct", | ||
| "shared_network", | ||
| "ours", | ||
| "inconclusive", | ||
| "simultaneous_calls", | ||
| "linked_device_interactive", | ||
| "referral_group_send" | ||
| ] | ||
| } | ||
| }, | ||
| "evidence": { | ||
| "BanSafeClaimEvidence": { | ||
| "family": "platform", | ||
| "required": [ | ||
| "attributionRuleVersion", | ||
| "windowDays", | ||
| "deviceEvidence", | ||
| "otherDevices", | ||
| "restrictedInWindow", | ||
| "criticalFindingDays", | ||
| "sharedConnection", | ||
| "measuredHours", | ||
| "simultaneousCalls", | ||
| "linkedDeviceInteractive", | ||
| "referralGroupSend" | ||
| ], | ||
| "properties": { | ||
| "linkedDeviceInteractive": { | ||
| "type": "boolean", | ||
| "description": "Whether this number sent an interactive message (buttons, lists, product messages, Flows and similar) from a linked device inside the window. When true, Ban Credit does not cover the ban and the claim is denied when filed. False for claims filed before this was recorded." | ||
| }, | ||
| "referralGroupSend": { | ||
| "type": "boolean", | ||
| "description": "Whether this number posted a referral message to WhatsApp groups inside the window. When true, Ban Credit does not cover the ban and the claim is denied when filed. False for claims filed before this was recorded." | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,41 @@ | ||
| package polymorfa | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestBanCreditWaiverVerdictsAndEvidence(t *testing.T) { | ||
| for _, tc := range []struct { | ||
| verdict string | ||
| evidence string | ||
| linked bool | ||
| referral bool | ||
| }{ | ||
| {"linked_device_interactive", `{"attributionRuleVersion":3,"linkedDeviceInteractive":true,"referralGroupSend":false}`, true, false}, | ||
| {"referral_group_send", `{"attributionRuleVersion":3,"linkedDeviceInteractive":false,"referralGroupSend":true}`, false, true}, | ||
| } { | ||
| var claim BanSafeClaim | ||
| if err := json.Unmarshal([]byte(`{"status":"denied","amountCents":0,"verdict":"`+tc.verdict+`","evidence":`+tc.evidence+`}`), &claim); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| if claim.Verdict != tc.verdict || claim.Evidence.AttributionRuleVersion == nil || *claim.Evidence.AttributionRuleVersion != 3 { | ||
| t.Fatalf("decoded %+v", claim) | ||
| } | ||
| if claim.Evidence.LinkedDeviceInteractive != tc.linked || claim.Evidence.ReferralGroupSend != tc.referral { | ||
| t.Fatalf("evidence %+v", claim.Evidence) | ||
| } | ||
| encoded, err := json.Marshal(claim.Evidence) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| var round map[string]any | ||
| if err := json.Unmarshal(encoded, &round); err != nil || round["linkedDeviceInteractive"] != tc.linked || round["referralGroupSend"] != tc.referral { | ||
| t.Fatalf("round trip %s", encoded) | ||
| } | ||
| var payload BanSafeClaimPayload | ||
| if err := json.Unmarshal([]byte(`{"verdict":"`+tc.verdict+`"}`), &payload); err != nil || payload.Verdict != tc.verdict { | ||
| t.Fatalf("webhook payload %+v %v", payload, err) | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This supplement and the package changes leave
contracts/doc-snippets.jsonandscripts/doc-snippets/recipes.mjsbound to32c75bd, whose tracked inputs match the parent commit but not this commit (5 added files and 24 changed files).sourceDigest()inscripts/doc-snippets/catalog.mjsrejects that inventory mismatch, so the requiredcheck:doc-snippetsstep in.github/workflows/ci.ymlcannot pass once dependencies are installed. Rebind the catalog to the updated SDK source, regenerate it, and verify the emitted programs with all six native checkers as required byAGENTS.md.AGENTS.md reference: AGENTS.md:L62-L66
Useful? React with 👍 / 👎.