-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added to PaymentIntent charges, paymentMethod, amountDetails properties
- Loading branch information
Showing
40 changed files
with
845 additions
and
81 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
17 changes: 17 additions & 0 deletions
17
stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/CardMappings.kt
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,17 @@ | ||
package mek.stripeterminal.mappings | ||
|
||
import com.stripe.stripeterminal.external.models.CardDetails | ||
import mek.stripeterminal.api.CardDetailsApi | ||
import mek.stripeterminal.api.cardBrandToApi | ||
import mek.stripeterminal.api.fundingToApi | ||
|
||
fun CardDetails.toApi(): CardDetailsApi { | ||
return CardDetailsApi( | ||
brand = cardBrandToApi(brand), | ||
country = country, | ||
expMonth = expMonth.toLong(), | ||
expYear = expYear.toLong(), | ||
funding = fundingToApi(funding), | ||
last4 = last4, | ||
) | ||
} |
27 changes: 27 additions & 0 deletions
27
stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/ChargeMappings.kt
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,27 @@ | ||
package mek.stripeterminal.mappings | ||
|
||
import com.stripe.stripeterminal.external.models.Charge | ||
import mek.stripeterminal.api.ChargeApi | ||
import mek.stripeterminal.api.ChargeStatusApi | ||
import mek.stripeterminal.api.toApi | ||
import mek.stripeterminal.toHashMap | ||
|
||
fun Charge.toApi(): ChargeApi { | ||
return ChargeApi( | ||
amount = amount, | ||
currency = currency!!, | ||
status = when (status) { | ||
"pending" -> ChargeStatusApi.PENDING | ||
"failed" -> ChargeStatusApi.FAILED | ||
"succeeded" -> ChargeStatusApi.SUCCEEDED | ||
else -> throw Error("Unsupported $status") | ||
}, | ||
paymentMethodDetails = paymentMethodDetails?.toApi(), | ||
description = description!!, | ||
id = id, | ||
metadata = metadata?.toHashMap() ?: hashMapOf(), | ||
statementDescriptorSuffix = statementDescriptorSuffix, | ||
calculatedStatementDescriptor = calculatedStatementDescriptor, | ||
authorizationCode = authorizationCode, | ||
) | ||
} |
10 changes: 10 additions & 0 deletions
10
stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/PaymentIntentMappings.kt
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,10 @@ | ||
package mek.stripeterminal.mappings | ||
|
||
import com.stripe.stripeterminal.external.models.AmountDetails | ||
import mek.stripeterminal.api.AmountDetailsApi | ||
|
||
fun AmountDetails.toApi(): AmountDetailsApi { | ||
return AmountDetailsApi( | ||
tip = tip?.toApi(), | ||
) | ||
} |
17 changes: 17 additions & 0 deletions
17
stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/PaymentMethod.kt
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,17 @@ | ||
package mek.stripeterminal.mappings | ||
|
||
import com.stripe.stripeterminal.external.models.PaymentMethod | ||
import mek.stripeterminal.api.PaymentMethodApi | ||
import mek.stripeterminal.api.toApi | ||
import mek.stripeterminal.toHashMap | ||
|
||
fun PaymentMethod.toApi(): PaymentMethodApi { | ||
return PaymentMethodApi( | ||
id = id, | ||
card = cardDetails?.toApi(), | ||
cardPresent = cardPresentDetails?.toApi(), | ||
interacPresent = interacPresentDetails?.toApi(), | ||
customerId = customer, | ||
metadata = metadata?.toHashMap() ?: hashMapOf(), | ||
) | ||
} |
10 changes: 10 additions & 0 deletions
10
stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/TipMappings.kt
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,10 @@ | ||
package mek.stripeterminal.mappings | ||
|
||
import com.stripe.stripeterminal.external.models.Tip | ||
import mek.stripeterminal.api.TipApi | ||
|
||
fun Tip.toApi(): TipApi { | ||
return TipApi( | ||
amount = amount, | ||
) | ||
} |
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
Oops, something went wrong.