-
Notifications
You must be signed in to change notification settings - Fork 996
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix embedded update preserving invalid paymentoption (#4189)
## Summary Previously, embedded would always preserve the selected payment option across `update`, even if it's no longer valid. This PR fixes that. Also contains some minor unrelated tweaks. ## Testing See test ## Changelog Not user facing
- Loading branch information
1 parent
5275d8d
commit 62085fb
Showing
9 changed files
with
70 additions
and
16 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
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
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
31 changes: 31 additions & 0 deletions
31
Example/PaymentSheet Example/PaymentSheetUITest/EmbeddedUITest.swift
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,31 @@ | ||
// | ||
// EmbeddedUITest.swift | ||
// PaymentSheet Example | ||
// | ||
// Created by Yuki Tokuhiro on 10/23/24. | ||
// | ||
|
||
import XCTest | ||
|
||
class EmbeddedUITests: PaymentSheetUITestCase { | ||
func testUpdate() { | ||
var settings = PaymentSheetTestPlaygroundSettings.defaultValues() | ||
settings.customerMode = .new | ||
settings.mode = .payment | ||
settings.integrationType = .deferred_csc | ||
settings.uiStyle = .embedded | ||
loadPlayground(app, settings) | ||
app.buttons["Present embedded payment element"].waitForExistenceAndTap() | ||
// TODO: Test card form (see PaymentSheetVerticalUITests testUpdate) | ||
|
||
// Selecting Alipay w/ deferred PaymentIntent... | ||
app.buttons["Alipay"].waitForExistenceAndTap() | ||
XCTAssertEqual(app.staticTexts["Payment method"].label, "Alipay") | ||
// ...and *updating* to a SetupIntent... | ||
app.buttons.matching(identifier: "Setup").element(boundBy: 1).tap() | ||
// ...(wait for it to finish updating)... | ||
_ = app.buttons["Reload"].waitForExistence(timeout: 10) | ||
// ...should cause Alipay to no longer be the selected payment method, since it is not valid for setup. | ||
XCTAssertFalse(app.staticTexts["Payment method"].exists) | ||
} | ||
} |
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