Skip to content
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

feat(POM-447): (Dynamic Checkout) Delete saved payment methods #255

Merged
merged 95 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
91ce51d
Fix example app
vitalii-vanziak-cko Jan 9, 2025
96384e5
'customer_id' and 'removing_allowed'
vitalii-vanziak-cko Jan 9, 2025
489c0de
Extract CLIENT_SECRET to HeaderConstants
vitalii-vanziak-cko Jan 9, 2025
64e90ab
deleteCustomerToken() api method
vitalii-vanziak-cko Jan 9, 2025
f995d0b
Update KDoc
vitalii-vanziak-cko Jan 9, 2025
2c0eeaf
deleteCustomerToken() in repository and service
vitalii-vanziak-cko Jan 9, 2025
14881ba
Activity, bottom sheet, configuration, contract, launcher
vitalii-vanziak-cko Jan 10, 2025
baca753
SavedPaymentMethodsEvent
vitalii-vanziak-cko Jan 10, 2025
37fe104
SavedPaymentMethodsInteractorState
vitalii-vanziak-cko Jan 10, 2025
435d7da
SavedPaymentMethodsViewModelState
vitalii-vanziak-cko Jan 10, 2025
065a46f
VM update
vitalii-vanziak-cko Jan 10, 2025
0986e32
SavedPaymentMethodsInteractor
vitalii-vanziak-cko Jan 10, 2025
a854691
SavedPaymentMethodsViewModel
vitalii-vanziak-cko Jan 10, 2025
56fb616
Init VM
vitalii-vanziak-cko Jan 10, 2025
593ac88
Handle completion and activity result
vitalii-vanziak-cko Jan 10, 2025
67e834c
Apply screenModeAsState()
vitalii-vanziak-cko Jan 10, 2025
c2b1dc2
Error message
vitalii-vanziak-cko Jan 10, 2025
7971072
Code format
vitalii-vanziak-cko Jan 10, 2025
92b5dfd
Basic screen and style
vitalii-vanziak-cko Jan 10, 2025
dfa8b91
Add Idempotency-Key on PUT and DELETE
vitalii-vanziak-cko Jan 13, 2025
29b463d
deleting_allowed
vitalii-vanziak-cko Jan 13, 2025
2c6210e
Screens startup configuration validation
vitalii-vanziak-cko Jan 13, 2025
4412a14
po_dynamic_checkout_express_checkout (string)
vitalii-vanziak-cko Jan 13, 2025
49ad8d4
Localizations
vitalii-vanziak-cko Jan 13, 2025
c400aab
Delete Confirmation strings
vitalii-vanziak-cko Jan 13, 2025
a6821bf
icons
vitalii-vanziak-cko Jan 13, 2025
521691f
confirmationDialogStyle in POActionsContainer
vitalii-vanziak-cko Jan 13, 2025
3f7af44
ActionKey -> ActionId
vitalii-vanziak-cko Jan 13, 2025
02726dd
Update POActionsContainer params
vitalii-vanziak-cko Jan 13, 2025
39b44b2
New POButton composable function that incapsulates confirmation dialog
vitalii-vanziak-cko Jan 13, 2025
e1c6801
AGP 8.8.0
vitalii-vanziak-cko Jan 14, 2025
50478c6
Ghost button style and updated dialog style
vitalii-vanziak-cko Jan 15, 2025
20316e2
Updated secondaryBackgroundPressed color
vitalii-vanziak-cko Jan 15, 2025
6a4be99
Set button height externally via modifier
vitalii-vanziak-cko Jan 15, 2025
9b5fc1d
Extracted button icon size
vitalii-vanziak-cko Jan 15, 2025
cb76247
PODrawableImage with POImageRenderingMode applied to all buttons on a…
vitalii-vanziak-cko Jan 16, 2025
d4219e5
SubmitButton -> Button (Card Update)
vitalii-vanziak-cko Jan 16, 2025
e663fa4
SubmitButton -> Button (Card Tokenization)
vitalii-vanziak-cko Jan 16, 2025
16d9bba
SubmitButton -> Button (nAPM)
vitalii-vanziak-cko Jan 16, 2025
e97b42f
SubmitButton -> Button (DC)
vitalii-vanziak-cko Jan 16, 2025
c09c6d4
Message fix
vitalii-vanziak-cko Jan 16, 2025
0efbbbb
Deprecate Options in POCardUpdateConfiguration
vitalii-vanziak-cko Jan 16, 2025
1353845
Deprecate Options in PONativeAlternativePaymentConfiguration, related…
vitalii-vanziak-cko Jan 16, 2025
8b6e5dc
ExpressCheckout and SectionHeaderStyle
vitalii-vanziak-cko Jan 17, 2025
b1a50b2
Button styles: ghost & ghostEqualPadding
vitalii-vanziak-cko Jan 17, 2025
0e0c9bf
ExpressCheckout section on DC
vitalii-vanziak-cko Jan 21, 2025
e5a86fb
Launch SavedPaymentMethods on DC
vitalii-vanziak-cko Jan 21, 2025
97df84b
Scaffold with Header and style
vitalii-vanziak-cko Jan 21, 2025
2d3609a
Refactored POHeader to add 'trailingContent'
vitalii-vanziak-cko Jan 22, 2025
f4c7718
Configuration, style and cancel button
vitalii-vanziak-cko Jan 22, 2025
9f84826
Handle cancel
vitalii-vanziak-cko Jan 22, 2025
0d41926
Loading state
vitalii-vanziak-cko Jan 22, 2025
3e26639
Add 'metadata' to POCreateInvoiceRequest
vitalii-vanziak-cko Jan 23, 2025
49bdb20
Delete TODO
vitalii-vanziak-cko Jan 23, 2025
e5cda44
Extract Header
vitalii-vanziak-cko Jan 23, 2025
deed0af
Fix screen style
vitalii-vanziak-cko Jan 23, 2025
e975123
Animated loader
vitalii-vanziak-cko Jan 23, 2025
18ef546
Added 'regularPayment.backgroundColor'
vitalii-vanziak-cko Jan 23, 2025
aa803b9
Regular payment border style on DC
vitalii-vanziak-cko Jan 23, 2025
fd4aa90
DC style fix
vitalii-vanziak-cko Jan 23, 2025
e3b3b8c
Style fix
vitalii-vanziak-cko Jan 23, 2025
fff4d0c
HeaderStyle fix
vitalii-vanziak-cko Jan 23, 2025
42137dc
PaymentMethodStyle border
vitalii-vanziak-cko Jan 23, 2025
392036d
Added 'backgroundColor' to PaymentMethodStyle
vitalii-vanziak-cko Jan 23, 2025
4404439
Updated SavedPaymentMethodsViewModelState
vitalii-vanziak-cko Jan 24, 2025
68bbe7e
DC VM update: Starting -> Loading / Started -> Loaded
vitalii-vanziak-cko Jan 24, 2025
aca68d7
Added Success state to DC VM and screen
vitalii-vanziak-cko Jan 27, 2025
65bb2d9
Nullable ExpressCheckout on DC VM
vitalii-vanziak-cko Jan 27, 2025
44c768a
VM update
vitalii-vanziak-cko Jan 27, 2025
17106cc
Remove unused suppress from DC screen
vitalii-vanziak-cko Jan 27, 2025
4e194a0
Empty view and style
vitalii-vanziak-cko Jan 27, 2025
dda8400
Fetch and map payment methods, preload all images
vitalii-vanziak-cko Jan 27, 2025
1ff268e
borderColor on DC
vitalii-vanziak-cko Jan 27, 2025
f7bb9bc
PaymentMethod's UI
vitalii-vanziak-cko Jan 27, 2025
f74bc5d
Empty view paddings
vitalii-vanziak-cko Jan 28, 2025
82ce581
Added processing state to delete action
vitalii-vanziak-cko Jan 28, 2025
5497213
POButton.ProgressIndicatorSize Small/Medium
vitalii-vanziak-cko Jan 28, 2025
efb3f9f
Delete customer token
vitalii-vanziak-cko Jan 28, 2025
34974a1
Reformat VM
vitalii-vanziak-cko Jan 28, 2025
727ea12
Fix crossfade
vitalii-vanziak-cko Jan 28, 2025
b13a6b4
Fix transition animation
vitalii-vanziak-cko Jan 28, 2025
e5715fd
po_saved_payment_methods_error_generic
vitalii-vanziak-cko Jan 28, 2025
49a02d9
Error handling
vitalii-vanziak-cko Jan 28, 2025
4ea0b76
Delete payment method from interactor state
vitalii-vanziak-cko Jan 29, 2025
a09dba2
POSavedPaymentMethodsEvent and POSavedPaymentMethodsDelegate
vitalii-vanziak-cko Jan 29, 2025
a4989ca
Dispatch events to delegate in launcher
vitalii-vanziak-cko Jan 29, 2025
2b70f80
deleteLocalCustomerToken() on DC
vitalii-vanziak-cko Jan 29, 2025
45b94ab
Disable express settings button while processing payment
vitalii-vanziak-cko Jan 29, 2025
c2d1e00
Fullscreen SavedPaymentMethodsBottomSheet
vitalii-vanziak-cko Jan 29, 2025
3144fd8
Propagate POSavedPaymentMethodsEvent via PODynamicCheckoutDelegate
vitalii-vanziak-cko Jan 29, 2025
b5f668c
dispatchSavedPaymentMethodsConfiguration() via DC launcher
vitalii-vanziak-cko Jan 29, 2025
af69a33
Allow to alter POSavedPaymentMethodsConfiguration on DC
vitalii-vanziak-cko Jan 29, 2025
1775962
Keep express settings button always enabled
vitalii-vanziak-cko Jan 29, 2025
25e0039
Compose 2025.01.01
vitalii-vanziak-cko Jan 29, 2025
079c0a1
Update DC config in example app
vitalii-vanziak-cko Jan 29, 2025
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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildscript {
ext {
androidGradlePluginVersion = '8.7.3'
androidGradlePluginVersion = '8.8.0'
kotlinVersion = '2.1.0'
kspVersion = '2.1.0-1.0.29'
dokkaVersion = '1.9.20'
Expand Down Expand Up @@ -46,7 +46,7 @@ ext {
androidxSwipeRefreshLayoutVersion = '1.1.0'
androidxBrowserVersion = '1.8.0'

androidxComposeBOMVersion = '2024.12.01'
androidxComposeBOMVersion = '2025.01.01'
composeGooglePayButtonVersion = '1.0.0'

materialVersion = '1.12.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.processout.sdk.core.ProcessOutActivityResult
import com.processout.sdk.core.onFailure
import com.processout.sdk.core.onSuccess
import com.processout.sdk.ui.card.tokenization.POCardTokenizationConfiguration
import com.processout.sdk.ui.card.tokenization.POCardTokenizationConfiguration.SubmitButton
import com.processout.sdk.ui.card.tokenization.POCardTokenizationConfiguration.Button
import com.processout.sdk.ui.card.tokenization.POCardTokenizationLauncher
import com.processout.sdk.ui.shared.view.dialog.POAlertDialog
import com.processout.sdk.ui.threeds.PO3DSRedirectCustomTabLauncher
Expand Down Expand Up @@ -100,7 +100,7 @@ class CardPaymentFragment : BaseFragment<FragmentCardPaymentBinding>(
launcher.launch(
POCardTokenizationConfiguration(
savingAllowed = true,
submitButton = SubmitButton()
submitButton = Button()
)
)
}
Expand Down Expand Up @@ -179,7 +179,7 @@ class CardPaymentFragment : BaseFragment<FragmentCardPaymentBinding>(

private fun handleControls(uiState: CardPaymentUiState) {
when (uiState) {
Initial -> enableControls(true)
Initial, is Failure -> enableControls(true)
else -> enableControls(false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import com.processout.sdk.core.onFailure
import com.processout.sdk.core.onSuccess
import com.processout.sdk.ui.checkout.PODynamicCheckoutConfiguration
import com.processout.sdk.ui.checkout.PODynamicCheckoutConfiguration.AlternativePaymentConfiguration
import com.processout.sdk.ui.checkout.PODynamicCheckoutConfiguration.AlternativePaymentConfiguration.PaymentConfirmationConfiguration
import com.processout.sdk.ui.checkout.PODynamicCheckoutConfiguration.SubmitButton
import com.processout.sdk.ui.checkout.PODynamicCheckoutLauncher
import com.processout.sdk.ui.shared.view.dialog.POAlertDialog
import com.processout.sdk.ui.threeds.PO3DSRedirectCustomTabLauncher
Expand Down Expand Up @@ -97,10 +95,7 @@ class DynamicCheckoutFragment : BaseFragment<FragmentDynamicCheckoutBinding>(
clientSecret = uiModel.clientSecret
),
alternativePayment = AlternativePaymentConfiguration(
returnUrl = Constants.RETURN_URL,
paymentConfirmation = PaymentConfirmationConfiguration(
confirmButton = SubmitButton()
)
returnUrl = Constants.RETURN_URL
)
)
)
Expand Down Expand Up @@ -142,7 +137,7 @@ class DynamicCheckoutFragment : BaseFragment<FragmentDynamicCheckoutBinding>(

private fun handleControls(uiState: DynamicCheckoutUiState) {
when (uiState) {
Initial -> enableControls(true)
Initial, is Failure -> enableControls(true)
else -> enableControls(false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.processout.sdk.api.model.response.POCard
import com.processout.sdk.api.model.response.POGooglePayCardTokenizationData
import com.processout.sdk.core.*
import com.processout.sdk.ui.card.update.POCardUpdateConfiguration
import com.processout.sdk.ui.card.update.POCardUpdateConfiguration.*
import com.processout.sdk.ui.card.update.POCardUpdateConfiguration.CardInformation
import com.processout.sdk.ui.card.update.POCardUpdateLauncher
import com.processout.sdk.ui.googlepay.POGooglePayCardTokenizationLauncher
import com.processout.sdk.ui.shared.configuration.POCancellationConfiguration
Expand Down Expand Up @@ -91,19 +91,16 @@ class FeaturesFragment : BaseFragment<FragmentFeaturesBinding>(
cardUpdateLauncher.launch(
POCardUpdateConfiguration(
cardId = card?.id ?: String(),
options = Options(
cardInformation = CardInformation(
maskedNumber = maskedNumber,
iin = card?.iin,
scheme = card?.scheme,
preferredScheme = card?.coScheme
),
submitButton = SubmitButton(),
cancellation = POCancellationConfiguration(
backPressed = true,
dragDown = true,
touchOutside = false
)
cardInformation = CardInformation(
maskedNumber = maskedNumber,
iin = card?.iin,
scheme = card?.scheme,
preferredScheme = card?.coScheme
),
cancellation = POCancellationConfiguration(
backPressed = true,
dragDown = true,
touchOutside = false
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.processout.example.ui.screen.nativeapm.NativeApmUiState.*
import com.processout.sdk.core.onFailure
import com.processout.sdk.core.onSuccess
import com.processout.sdk.ui.napm.PONativeAlternativePaymentConfiguration
import com.processout.sdk.ui.napm.PONativeAlternativePaymentConfiguration.Button
import com.processout.sdk.ui.napm.PONativeAlternativePaymentLauncher
import com.processout.sdk.ui.nativeapm.PONativeAlternativePaymentMethodConfiguration
import com.processout.sdk.ui.nativeapm.PONativeAlternativePaymentMethodLauncher
Expand Down Expand Up @@ -96,7 +97,8 @@ class NativeApmFragment : BaseFragment<FragmentNativeApmBinding>(
launcherCompose.launch(
PONativeAlternativePaymentConfiguration(
invoiceId = uiModel.invoiceId,
gatewayConfigurationId = uiModel.gatewayConfigurationId
gatewayConfigurationId = uiModel.gatewayConfigurationId,
submitButton = Button()
)
)
} else {
Expand All @@ -112,7 +114,7 @@ class NativeApmFragment : BaseFragment<FragmentNativeApmBinding>(

private fun handleControls(uiState: NativeApmUiState) {
when (uiState) {
Initial -> enableControls(true)
Initial, is Failure -> enableControls(true)
else -> enableControls(false)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.processout.sdk.api.model.event

import com.processout.sdk.core.ProcessOutResult
import com.processout.sdk.core.annotation.ProcessOutInternalApi

/**
* Defines saved payment methods lifecycle events.
*/
/** @suppress */
@ProcessOutInternalApi
sealed class POSavedPaymentMethodsEvent {

/**
* Initial event that is sent prior any other event.
*/
data object WillStart : POSavedPaymentMethodsEvent()

/**
* Event indicates that initialization is complete.
*/
data object DidStart : POSavedPaymentMethodsEvent()

/**
* Event is sent when customer token has been deleted.
*/
data class DidDeleteCustomerToken(
val customerId: String,
val tokenId: String
) : POSavedPaymentMethodsEvent()

/**
* Event is sent when unretryable error occurs. This is a final event.
*/
data class DidFail(
val failure: ProcessOutResult.Failure
) : POSavedPaymentMethodsEvent()
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ data class POCreateInvoiceRequest(
val customerId: String? = null,
@Json(name = "return_url")
val returnUrl: String? = null,
val device: Map<String, String> = mapOf("channel" to "android")
val device: Map<String, String> = mapOf("channel" to "android"),
val metadata: Map<String, String>? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.processout.sdk.api.model.request

/**
* Request to delete a customer token.
*
* @param[customerId] ID of the customer.
* @param[tokenId] Token ID that belong to the customer.
* @param[clientSecret] Client secret is a value of __X-ProcessOut-Client-Secret__ header of the invoice.
*/
data class PODeleteCustomerTokenRequest(
val customerId: String,
val tokenId: String,
val clientSecret: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import java.util.Date
* @param captureAmount Amount of money to capture when partial captures are available. Note that this only applies if you are also using the [autoCaptureAt] option.
* @param authorizeOnly Boolean value indicating whether should only authorize the invoice or also capture it. Default value is _true_.
* @param allowFallbackToSale Boolean value indicating whether should fallback to sale if the gateway does not support separation between authorization and capture. Default value is _false_.
* @param clientSecret Client secret is a value of __x-processout-client-secret__ header of the invoice.
* @param clientSecret Client secret is a value of __X-ProcessOut-Client-Secret__ header of the invoice.
* @param metadata Additional metadata.
*/
data class POInvoiceAuthorizationRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.parcelize.Parcelize
* Request to get single invoice details.
*
* @param[invoiceId] Requested invoice ID.
* @param[clientSecret] Client secret is a value of __x-processout-client-secret__ header of the invoice.
* @param[clientSecret] Client secret is a value of __X-ProcessOut-Client-Secret__ header of the invoice.
* When provided payment methods saved by the customer will be included in the response if the invoice has assigned customer ID.
*/
@Parcelize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ internal data class InvoiceResponseBody(
val currency: String,
@Json(name = "return_url")
val returnUrl: String?,
@Json(name = "customer_id")
val customerId: String?,
val transaction: POTransaction?,
@Json(name = "payment_methods")
val paymentMethods: List<PODynamicCheckoutPaymentMethod>?
Expand All @@ -28,15 +30,17 @@ internal data class InvoiceResponseBody(
* @param[amount] Invoice amount.
* @param[currency] Invoice currency.
* @param[returnUrl] Return URL or deep link for web based operations.
* @param[customerId] Customer identifier.
* @param[transaction] Transaction details.
* @param[paymentMethods] Dynamic checkout configuration.
* @param[clientSecret] Client secret is a value of __x-processout-client-secret__ header of the invoice.
* @param[clientSecret] Client secret is a value of __X-ProcessOut-Client-Secret__ header of the invoice.
*/
data class POInvoice(
val id: String,
val amount: String = String(),
val currency: String = String(),
val returnUrl: String? = null,
val customerId: String? = null,
@ProcessOutInternalApi val transaction: POTransaction? = null,
@ProcessOutInternalApi val paymentMethods: List<PODynamicCheckoutPaymentMethod>? = null,
@ProcessOutInternalApi val clientSecret: String? = null
Expand Down Expand Up @@ -244,7 +248,9 @@ sealed class PODynamicCheckoutPaymentMethod {
@Json(name = "customer_token_id")
val customerTokenId: String,
@Json(name = "redirect_url")
val redirectUrl: String?
val redirectUrl: String?,
@Json(name = "deleting_allowed")
val deletingAllowed: Boolean
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import com.processout.sdk.api.model.request.POCreateCustomerRequest
import com.processout.sdk.api.model.request.POCreateCustomerTokenRequestBody
import com.processout.sdk.api.model.response.CustomerResponse
import com.processout.sdk.api.model.response.CustomerTokenResponse
import com.processout.sdk.api.network.HeaderConstants.CLIENT_SECRET
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.*

internal interface CustomerTokensApi {

Expand All @@ -20,12 +18,21 @@ internal interface CustomerTokensApi {
@Body request: AssignCustomerTokenRequestWithDeviceData
): Response<CustomerTokenResponse>

@DELETE("/customers/{customer_id}/tokens/{token_id}")
suspend fun deleteCustomerToken(
@Path("customer_id") customerId: String,
@Path("token_id") tokenId: String,
@Header(CLIENT_SECRET) clientSecret: String
): Response<Unit>

@POST("/customers/{customer_id}/tokens")
suspend fun createCustomerToken(
@Path("customer_id") customerId: String,
@Body request: POCreateCustomerTokenRequestBody
): Response<CustomerTokenResponse>

@POST("/customers")
suspend fun createCustomer(@Body request: POCreateCustomerRequest): Response<CustomerResponse>
suspend fun createCustomer(
@Body request: POCreateCustomerRequest
): Response<CustomerResponse>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.processout.sdk.api.network

internal object HeaderConstants {
const val CLIENT_SECRET = "X-ProcessOut-Client-Secret"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ import com.processout.sdk.api.model.request.NativeAPMRequestBody
import com.processout.sdk.api.model.request.NativeAlternativePaymentCaptureRequest
import com.processout.sdk.api.model.request.POCreateInvoiceRequest
import com.processout.sdk.api.model.response.*
import com.processout.sdk.api.network.HeaderConstants.CLIENT_SECRET
import retrofit2.Response
import retrofit2.http.*

internal interface InvoicesApi {

companion object {
const val HEADER_CLIENT_SECRET = "x-processout-client-secret"
}

@POST("/invoices/{id}/authorize")
suspend fun authorizeInvoice(
@Path("id") invoiceId: String,
@Body request: InvoiceAuthorizationRequestWithDeviceData,
@Header(HEADER_CLIENT_SECRET) clientSecret: String?
@Header(CLIENT_SECRET) clientSecret: String?
): Response<InvoiceAuthorizationResponse>

@POST("/invoices/{id}/native-payment")
Expand All @@ -42,7 +39,7 @@ internal interface InvoicesApi {
@GET("/invoices/{id}?expand=transaction")
suspend fun invoice(
@Path("id") invoiceId: String,
@Header(HEADER_CLIENT_SECRET) clientSecret: String?
@Header(CLIENT_SECRET) clientSecret: String?
): Response<InvoiceResponse>

@POST("/invoices")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal class RetryInterceptor(

private fun Request.addIdempotencyKey(): Request =
when (method) {
"POST" -> newBuilder()
"POST", "PUT", "DELETE" -> newBuilder()
.header("Idempotency-Key", UUID.randomUUID().toString())
.build()
else -> this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.processout.sdk.api.repository
import com.processout.sdk.api.model.request.POAssignCustomerTokenRequest
import com.processout.sdk.api.model.request.POCreateCustomerRequest
import com.processout.sdk.api.model.request.POCreateCustomerTokenRequest
import com.processout.sdk.api.model.request.PODeleteCustomerTokenRequest
import com.processout.sdk.api.model.response.CustomerTokenResponse
import com.processout.sdk.api.model.response.POCustomer
import com.processout.sdk.api.model.response.POCustomerToken
Expand All @@ -15,6 +16,10 @@ internal interface CustomerTokensRepository {
request: POAssignCustomerTokenRequest
): ProcessOutResult<CustomerTokenResponse>

suspend fun deleteCustomerToken(
request: PODeleteCustomerTokenRequest
): ProcessOutResult<Unit>

/** @suppress */
@ProcessOutInternalApi
suspend fun createCustomerToken(
Expand All @@ -23,5 +28,7 @@ internal interface CustomerTokensRepository {

/** @suppress */
@ProcessOutInternalApi
suspend fun createCustomer(request: POCreateCustomerRequest): ProcessOutResult<POCustomer>
suspend fun createCustomer(
request: POCreateCustomerRequest
): ProcessOutResult<POCustomer>
}
Loading