Skip to content

Commit

Permalink
Remove request type from metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
sshropshire committed Nov 5, 2024
1 parent c0d455a commit 70a0d62
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ internal class CardAuthLauncher(
) {

companion object {
private const val METADATA_KEY_REQUEST_TYPE = "request_type"
private const val REQUEST_TYPE_APPROVE_ORDER = "approve_order"
private const val REQUEST_TYPE_VAULT = "vault"

private const val METADATA_KEY_ORDER_ID = "order_id"
private const val METADATA_KEY_SETUP_TOKEN_ID = "setup_token_id"
}
Expand All @@ -30,14 +26,12 @@ internal class CardAuthLauncher(
is CardAuthChallenge.ApproveOrder -> {
val request = authChallenge.request
JSONObject()
.put(METADATA_KEY_REQUEST_TYPE, REQUEST_TYPE_APPROVE_ORDER)
.put(METADATA_KEY_ORDER_ID, request.orderId)
}

is CardAuthChallenge.Vault -> {
val request = authChallenge.request
JSONObject()
.put(METADATA_KEY_REQUEST_TYPE, REQUEST_TYPE_VAULT)
.put(METADATA_KEY_SETUP_TOKEN_ID, request.setupTokenId)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ class CardAuthLauncherUnitTest {
private val card = Card("4111111111111111", "01", "25", "123")

private val approveOrderMetadata = JSONObject()
.put("request_type", "approve_order")
.put("order_id", "fake-order-id")

private val vaultMetadata = JSONObject()
.put("request_type", "vault")
.put("setup_token_id", "fake-setup-token-id")

@Before
Expand Down Expand Up @@ -81,7 +79,6 @@ class CardAuthLauncherUnitTest {

val browserSwitchOptions = slot.captured
val metadata = browserSwitchOptions.metadata
assertEquals("approve_order", metadata?.getString("request_type"))
assertEquals("fake-order-id", metadata?.getString("order_id"))
assertEquals("merchant.app", browserSwitchOptions.returnUrlScheme)
assertEquals(Uri.parse("https://fake.com/destination"), browserSwitchOptions.url)
Expand All @@ -104,7 +101,6 @@ class CardAuthLauncherUnitTest {

val browserSwitchOptions = slot.captured
val metadata = browserSwitchOptions.metadata
assertEquals("vault", metadata?.getString("request_type"))
assertEquals("fake-setup-token-id", metadata?.getString("setup_token_id"))
assertEquals("merchant.app", browserSwitchOptions.returnUrlScheme)
assertEquals(Uri.parse("https://fake.com/destination"), browserSwitchOptions.url)
Expand Down

0 comments on commit 70a0d62

Please sign in to comment.