Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/vaults_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type LinkCardSpec = {
provider: "link";
wallet: string; // wallet item key
payment_method_id: string; // from wallets payment-methods
amount: number; // integer minor units; 1..500000; a virtual card allows at most 50000
amount: number; // integer minor units; 1..50000
currency: string; // three letters
merchant_name: string; // 1..255 characters
merchant_url: string; // uri; a virtual card authorized without a checkout fills only this origin
Expand Down
9 changes: 4 additions & 5 deletions cmd/vaults_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ checkout is open in exactly one tab at page_url, then authorize again. if checko
keeps failing, authorize without --browser-id and --page-url to issue a virtual card that fills
any page on the merchant_url origin. once a card is authorized at a checkout, cards update
returns 409: delete the card and create a new one. if authorization is declined or expires,
read status_reason, then delete the card and create a new one. if the amount exceeds the
50000 minor-unit virtual card limit on a checkout without Link Pay Token support, delete the
card and tell the user. if the result of submitting payment is unclear, check the merchant's
order confirmation or order history before paying again.`
read status_reason, then delete the card and create a new one. if the result of submitting
payment is unclear, check the merchant's order confirmation or order history before paying
again.`

const linkAuthorizeBrowserGuidance = "no payment request was made. make sure the checkout is open in exactly one tab at page_url in a browser with this vault attached, then authorize again. if checkout inspection keeps failing, authorize without --browser-id and --page-url to issue a virtual card that fills any page on the merchant_url origin"

Expand Down Expand Up @@ -110,7 +109,7 @@ func linkAuthorizeError(err error, checkout bool) error {
case checkout && apiErr.StatusCode >= 500:
guidance = linkAuthorizeServerErrorGuidance
case body.Code == "invalid_request":
guidance = "fix the reported input, then authorize again. if it reports that the amount exceeds the Link virtual card limit, delete this card and tell the user this checkout cannot be paid with a Link virtual card"
guidance = "fix the reported input, then authorize again"
default:
guidance = "re-get the item and follow its advertised operations"
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/vaults_link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func TestLinkCardFlowHelpOrder(t *testing.T) {
"make sure the checkout is open in exactly one tab at page_url, then authorize again",
"authorize without --browser-id and --page-url to issue a virtual card",
"cards update returns 409: delete the card and create a new one",
"50000 minor-unit virtual card limit",
"check the merchant's order confirmation or order history before paying again",
"failed or unknown fills are safe to retry, but only after checking the page and not in an automatic loop",
} {
Expand Down Expand Up @@ -150,7 +149,7 @@ func TestVaultLinkAuthorizeErrorGuidance(t *testing.T) {
{403, "destination_denied", "checkout destination is not authorized", linkAuthorizeBrowserGuidance, "", false},
{400, "timeout", "checkout inspection failed", linkAuthorizeBrowserGuidance, "", false},
{500, "browser_error", "checkout inspection failed", linkAuthorizeBrowserGuidance, "", false},
{400, "invalid_request", "amount exceeds the Link virtual card limit", "fix the reported input, then authorize again. if it reports that the amount exceeds the Link virtual card limit, delete this card and tell the user this checkout cannot be paid with a Link virtual card", "", false},
{400, "invalid_request", "spec.payment_method_id was not found in the wallet", "fix the reported input, then authorize again", "", false},
{429, "rate_limited", "too many requests", "wait for the rate limit to clear, then authorize again", "", false},
{429, "rate_limited", "too many requests", "wait until Retry-After (30) has elapsed, then authorize again", "30", false},
{500, "provider_error", "failed to perform item operation", linkAuthorizeServerErrorGuidance, "", false},
Expand Down
Loading