Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
83038ae
PreferredSchemeConfiguration
vitalii-vanziak-cko Apr 22, 2025
c18f1e3
Added radio button style
vitalii-vanziak-cko Apr 22, 2025
843755c
Added localizedMessage to ProcessOutResult.Failure
vitalii-vanziak-cko Apr 22, 2025
a5b6617
Prioritize localizedMessage as error message
vitalii-vanziak-cko Apr 22, 2025
1df957a
Update example delegate
vitalii-vanziak-cko Apr 22, 2025
287ebd0
Update futurePaymentsSection()
vitalii-vanziak-cko Apr 22, 2025
880ab30
Preferred scheme UI (radio/dropdown)
vitalii-vanziak-cko Apr 22, 2025
531da6e
preferredSchemeField in interactor
vitalii-vanziak-cko Apr 22, 2025
1c67ccc
Replace preferredScheme property with preferredSchemeField in interactor
vitalii-vanziak-cko Apr 22, 2025
c29ff80
POCardScheme
vitalii-vanziak-cko Apr 23, 2025
61efbc7
EnumExtensions in UI module
vitalii-vanziak-cko Apr 23, 2025
acc6e48
Use POCardScheme in CardSchemeDrawableResProvider
vitalii-vanziak-cko Apr 23, 2025
a109137
Use POCardScheme in CardSchemeProvider
vitalii-vanziak-cko Apr 23, 2025
c82377d
Update preferredSchemeField
vitalii-vanziak-cko Apr 23, 2025
27e663d
Preferred scheme subsection with animations
vitalii-vanziak-cko Apr 24, 2025
65b66db
PreferredSchemeConfiguration on DC
vitalii-vanziak-cko Apr 24, 2025
7f3dede
Apply schemeSelectionAllowed on DC
vitalii-vanziak-cko Apr 24, 2025
f7d0dd2
Add RadioField on DC card
vitalii-vanziak-cko Apr 24, 2025
d964556
Preferred scheme UI on DC card
vitalii-vanziak-cko Apr 24, 2025
dcb66ea
Update POCardTokenizationConfiguration
vitalii-vanziak-cko Apr 24, 2025
3536137
KDoc
vitalii-vanziak-cko Apr 24, 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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DefaultCardTokenizationDelegate(
if (invoice == null) {
return ProcessOutResult.Failure(
code = Generic(),
message = "Failed to create an invoice."
localizedMessage = "Failed to create an invoice."
)
}
return invoices.authorize(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
package com.processout.sdk.api.model.response

/**
* Supported card schemes and co-schemes.
*/
enum class POCardScheme(
val rawValue: String,
val displayName: String
) {

/** American Express is a key credit card around the world. */
AMEX(
rawValue = "american express",
displayName = "American Express"
),

/** Atos Private Label is a private label credit card that is branded for Atos. */
ATOS_PRIVATE_LABEL(
rawValue = "atos private label",
displayName = "Atos Private Label"
),

/** Bancontact is the most popular online payment method in Belgium. */
BANCONTACT(
rawValue = "bancontact",
displayName = "Bancontact"
),

/** BC Global is a South Korean domestic card brand with international acceptance. */
BC_GLOBAL(
rawValue = "global bc",
displayName = "BC Global"
),

/** Cabal is a local credit and debit card payment method based in Argentina. */
CABAL(
rawValue = "cabal",
displayName = "Cabal"
),

/** Carnet is a leading brand of Mexican acceptance, with more than 50 years of experience. */
CARNET(
rawValue = "carnet",
displayName = "Carnet"
),

/** Carte Bancaire is France's local card scheme and the most widely used payment method in the region. */
CARTE_BANCAIRE(
rawValue = "carte bancaire",
displayName = "Carte Bancaire"
),

/** Cirrus is a worldwide interbank network that provides cash to Mastercard cardholders. */
CIRRUS(
rawValue = "cirrus",
displayName = "Cirrus"
),

/** Cielo is a domestic debit and credit card brand of Brazil. */
CIELO(
rawValue = "cielo",
displayName = "Cielo"
),

/** Comprocard is a domestic debit and credit card brand of Brazil. */
COMPROCARD(
rawValue = "comprocard",
displayName = "Comprocard"
),

/** Dankort is the national debit card of Denmark. */
DANKORT(
rawValue = "dankort",
displayName = "Dankort"
),

/** DinaCard is a national payment card of the Republic of Serbia. */
DINA_CARD(
rawValue = "dinacard",
displayName = "DinaCard"
),

/** Diners charge card. */
DINERS_CLUB(
rawValue = "diners club",
displayName = "Diners Club"
),

/** Diners charge card. */
DINERS_CLUB_CARTE_BLANCHE(
rawValue = "diners club carte blanche",
displayName = "Diners Club Carte Blanche"
),

/** Diners charge card. */
DINERS_CLUB_INTERNATIONAL(
rawValue = "diners club international",
displayName = "Diners Club International"
),

/** Diners charge card. */
DINERS_CLUB_UNITED_STATES_AND_CANADA(
rawValue = "diners club united states & canada",
displayName = "Diners Club United States & Canada"
),

/** Discover is a credit card brand issued primarily in the United States. */
DISCOVER(
rawValue = "discover",
displayName = "Discover"
),

/** Elo is a domestic debit and credit card brand of Brazil. */
ELO(
rawValue = "elo",
displayName = "Elo"
),

/** An Electron debit card. */
ELECTRON(
rawValue = "electron",
displayName = "Electron"
),

/** GE Capital is the financial services division of General Electric. */
GE_CAPITAL(
rawValue = "ge capital",
displayName = "GE Capital"
),

/** A Girocard payment method. */
GIROCARD(
rawValue = "girocard",
displayName = "Girocard"
),

/** Giropay is an Internet payment system in Germany. */
GIROPAY(
rawValue = "giropay",
displayName = "Giropay"
),

/** Hipercard is a domestic debit and credit card brand of Brazil. */
HIPERCARD(
rawValue = "hipercard",
displayName = "Hipercard"
),

/** An iD payment card. */
ID_CREDIT(
rawValue = "idCredit",
displayName = "iD Credit"
),

/** An Interac payment method. */
INTERAC(
rawValue = "interac",
displayName = "Interac"
),

/** JCB is a major card issuer and acquirer from Japan. */
JCB(
rawValue = "jcb",
displayName = "JCB"
),

/** Maestro is a brand of debit cards and prepaid cards owned by Mastercard. */
MAESTRO(
rawValue = "maestro",
displayName = "Maestro"
),

/** Mada is the national payment scheme of Saudi Arabia. */
MADA(
rawValue = "mada",
displayName = "Mada"
),

/** Mastercard is a market leading card scheme worldwide. */
MASTERCARD(
rawValue = "mastercard",
displayName = "Mastercard"
),

/** A Meeza payment card. */
MEEZA(
rawValue = "meeza",
displayName = "Meeza"
),

/** A Mir payment card. */
MIR(
rawValue = "nspk mir",
displayName = "Mir"
),

/** A Nanaco payment card. */
NANACO(
rawValue = "nanaco",
displayName = "Nanaco"
),

/** UK Credit Cards issued by NewDay. */
NEWDAY(
rawValue = "newday",
displayName = "NewDay"
),

/** NYCE is an interbank network connecting the ATMs of various financial institutions in the United States and Canada. */
NYCE(
rawValue = "nyce",
displayName = "NYCE"
),

/** Ourocard is a domestic debit and credit card brand of Brazil. */
OUROCARD(
rawValue = "ourocard",
displayName = "Ourocard"
),

/** A Bancomat payment card. */
PAGO_BANCOMAT(
rawValue = "pagoBancomat",
displayName = "PagoBancomat"
),

/** A PostFinance AG payment card. */
POST_FINANCE(
rawValue = "postFinance",
displayName = "PostFinance"
),

/** Private Label is a type of credit card that is branded for a specific retailer or brand. */
PRIVATE_LABEL(
rawValue = "private label",
displayName = "Private Label"
),

/** RuPay is an Indian multinational financial services and payment service system. */
RUPAY(
rawValue = "rupay",
displayName = "RuPay"
),

/** Sodexo is a company that offers prepaid meal cards and other prepaid services. */
SODEXO(
rawValue = "sodexo",
displayName = "Sodexo"
),

/** A Suica payment card. */
SUICA(
rawValue = "suica",
displayName = "Suica"
),

/** A T-money payment card. */
T_MONEY(
rawValue = "tmoney",
displayName = "T-money"
),

/** TROY (acronym of Türkiye’nin Ödeme Yöntemi) is a Turkish card scheme. */
TROY(
rawValue = "troy",
displayName = "TROY"
),

/** UnionPay is the world’s biggest card network with more than 7 billion cards issued. */
UNION_PAY(
rawValue = "china union pay",
displayName = "UnionPay"
),

/**
* V Pay is a Single Euro Payments Area (SEPA) debit card for use in Europe, issued by Visa Europe.
* It uses the EMV chip and PIN system and may be co-branded with various national debit card schemes such as the German Girocard.
*/
V_PAY(
rawValue = "vpay",
displayName = "V Pay"
),

/** Verve is Africa's most successful card brand. */
VERVE(
rawValue = "verve",
displayName = "Verve"
),

/** Visa is the largest global card network in the world by transaction value, ubiquitous worldwide. */
VISA(
rawValue = "visa",
displayName = "Visa"
),

/** A WAON payment card. */
WAON(
rawValue = "waon",
displayName = "WAON"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ internal class ApiFailureMapper(
append(" | Reason: $it")
}
}
return ProcessOutResult.Failure(failureCode, message, apiError?.invalidFields)
return ProcessOutResult.Failure(
code = failureCode,
message = message,
invalidFields = apiError?.invalidFields
)
}

private fun failureCode(statusCode: Int, errorType: String): POFailure.Code {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sealed class ProcessOutResult<out T : Any> {
data class Failure(
val code: POFailure.Code,
val message: String? = null,
val localizedMessage: String? = null,
val invalidFields: List<POFailure.InvalidField>? = null,
val cause: Exception? = null
) : ProcessOutResult<Nothing>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ internal class NativeAlternativePaymentMethodViewModel private constructor(

private fun Options.validate() = copy(
paymentConfirmationTimeoutSeconds =
if (paymentConfirmationTimeoutSeconds in 0..MAX_PAYMENT_CONFIRMATION_TIMEOUT_SECONDS)
paymentConfirmationTimeoutSeconds else DEFAULT_PAYMENT_CONFIRMATION_TIMEOUT_SECONDS
if (paymentConfirmationTimeoutSeconds in 0..MAX_PAYMENT_CONFIRMATION_TIMEOUT_SECONDS)
paymentConfirmationTimeoutSeconds else DEFAULT_PAYMENT_CONFIRMATION_TIMEOUT_SECONDS
)
}

Expand Down Expand Up @@ -322,9 +322,9 @@ internal class NativeAlternativePaymentMethodViewModel private constructor(
val invalidFields = uiModel.inputParameters.mapNotNull { it.validate() }
if (invalidFields.isNotEmpty()) {
val failure = ProcessOutResult.Failure(
Validation(POFailure.ValidationCode.general),
"Invalid fields.",
invalidFields
code = Validation(POFailure.ValidationCode.general),
message = "Invalid fields.",
invalidFields = invalidFields
)
handlePaymentFailure(uiModel, failure, replaceToLocalMessage = false)
return@doWhenUserInput
Expand Down Expand Up @@ -620,8 +620,13 @@ internal class NativeAlternativePaymentMethodViewModel private constructor(
fun onViewFailure(failure: PONativeAlternativePaymentMethodResult.Failure) {
with(failure) {
dispatch(
DidFail(ProcessOutResult.Failure(code, message, invalidFields)
.also { POLogger.warn("View failed: %s", it, attributes = logAttributes) })
DidFail(
ProcessOutResult.Failure(
code = code,
message = message,
invalidFields = invalidFields
).also { POLogger.warn("View failed: %s", it, attributes = logAttributes) }
)
)
}
}
Expand Down
Loading