Skip to content

Commit

Permalink
Merge pull request #1249 from Catappult/dev
Browse files Browse the repository at this point in the history
Master update 3.37.1 (346)
  • Loading branch information
rodolfobcardoso authored Jan 29, 2025
2 parents 05457e9 + 841367d commit 5a9fc87
Show file tree
Hide file tree
Showing 91 changed files with 27,375 additions and 1,883 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
namespace = "com.asf.wallet"
defaultConfig {
applicationId = "com.appcoins.wallet"
versionCode = 344
versionName = "3.36.1"
versionCode = 346
versionName = "3.37.1"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,60 @@ public CreditsRemoteRepository(RemoteRepository remoteRepository) {
}

@NotNull @Override
public Single<Transaction> pay(@NotNull String walletAddress, @NotNull String signature,
@NotNull BigDecimal amount, @Nullable String origin, @Nullable String sku,
@NotNull String type, @Nullable String entityOemId, @Nullable String entityDomain,
@NotNull String packageName, @Nullable String payload, @Nullable String callback,
@Nullable String orderReference, @Nullable String referrerUrl,
@Nullable String productToken, String guestWalletId) {
return remoteRepository.registerAuthorizationProof(origin, type, entityOemId, entityDomain,
null, "appcoins_credits", walletAddress, sku, packageName, amount, payload, callback,
orderReference, referrerUrl, productToken, guestWalletId);
public Single<Transaction> pay(
@NotNull String walletAddress,
@NotNull String signature,
@NotNull BigDecimal amount,
@Nullable String origin,
@Nullable String sku,
@NotNull String type,
@Nullable String entityOemId,
@Nullable String entityDomain,
@NotNull String packageName,
@Nullable String payload,
@Nullable String callback,
@Nullable String orderReference,
@Nullable String referrerUrl,
String guestWalletId
) {
return remoteRepository.registerAuthorizationProof(
origin,
type,
entityOemId,
entityDomain,
null,
"appcoins_credits",
walletAddress,
sku,
packageName,
amount,
payload,
callback,
orderReference,
referrerUrl,
guestWalletId
);
}

@NotNull @Override
public Single<Transaction> sendCredits(@NotNull String toWallet, @NotNull String walletAddress,
@NotNull String signature, @NotNull BigDecimal amount, @NotNull String origin,
@NotNull String type, @NotNull String packageName, String guestWalletId) {
return remoteRepository.transferCredits(toWallet, origin, type, "appcoins_credits",
walletAddress, signature, packageName, amount, guestWalletId);
public Single<Transaction> sendCredits(
@NotNull String toWallet,
@NotNull String walletAddress,
@NotNull BigDecimal amount,
@NotNull String origin,
@NotNull String type,
@NotNull String packageName,
String guestWalletId
) {
return remoteRepository.transferCredits(
toWallet,
origin,
type,
"appcoins_credits",
walletAddress,
packageName,
amount,
guestWalletId
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.appcoins.wallet.billing.adyen.PaymentInfoModel
import com.appcoins.wallet.billing.adyen.PaymentModel
import com.appcoins.wallet.billing.util.Error
import com.appcoins.wallet.core.analytics.analytics.partners.AddressService
import com.appcoins.wallet.core.network.base.EwtAuthenticatorService
import com.appcoins.wallet.core.network.microservices.model.CreditCardCVCResponse
import com.appcoins.wallet.core.utils.android_common.RxSchedulers
import com.appcoins.wallet.core.walletservices.WalletService
Expand Down Expand Up @@ -38,7 +37,6 @@ class AdyenPaymentInteractor @Inject constructor(
private val walletBlockedInteract: WalletBlockedInteract,
private val walletVerificationInteractor: WalletVerificationInteractor,
private val getCurrentPromoCodeUseCase: GetCurrentPromoCodeUseCase,
private val ewtObtainer: EwtAuthenticatorService,
private val rxSchedulers: RxSchedulers
) {

Expand All @@ -48,9 +46,9 @@ class AdyenPaymentInteractor @Inject constructor(
walletService.getAndSignCurrentWalletAddress()
.flatMap {
walletVerificationInteractor.isVerified(
it.address,
it.signedAddress,
verificationType
address = it.address,
signature = it.signedAddress,
type = verificationType
)
}
.onErrorReturn { true }
Expand All @@ -65,109 +63,123 @@ class AdyenPaymentInteractor @Inject constructor(
value: String,
currency: String
): Single<PaymentInfoModel> {
return Single.zip(
walletService.getWalletAddress().subscribeOn(rxSchedulers.io),
ewtObtainer.getEwtAuthentication().subscribeOn(rxSchedulers.io)
) { walletModel, ewt ->
Pair(walletModel, ewt)
}
.flatMap { pair ->
val wallet = pair.first
val ewt = pair.second
return walletService.getWalletAddress()
.subscribeOn(rxSchedulers.io)
.flatMap { wallet ->
adyenPaymentRepository
.loadPaymentInfo(
methods,
value,
currency,
wallet,
ewt
methods = methods,
value = value,
currency = currency,
walletAddress = wallet,
)
}
}

fun makePayment(
adyenPaymentMethod: ModelObject, shouldStoreMethod: Boolean, hasCvc: Boolean,
adyenPaymentMethod: ModelObject,
shouldStoreMethod: Boolean,
hasCvc: Boolean,
supportedShopperInteraction: List<String>,
returnUrl: String, value: String, currency: String, reference: String?,
paymentType: String, origin: String?, packageName: String, metadata: String?,
sku: String?, callbackUrl: String?, transactionType: String,
referrerUrl: String?, guestWalletId: String?,
returnUrl: String,
value: String,
currency: String,
reference: String?,
paymentType: String,
origin: String?,
packageName: String,
metadata: String?,
sku: String?,
callbackUrl: String?,
transactionType: String,
referrerUrl: String?,
guestWalletId: String?,
): Single<PaymentModel> {
return Single.zip(walletService.getAndSignCurrentWalletAddress(),
return Single.zip(
walletService.getAndSignCurrentWalletAddress(),
partnerAddressService.getAttribution(packageName),
{ address, attributionEntity -> Pair(address, attributionEntity) })
.flatMap { pair ->
val addressModel = pair.first
val attrEntity = pair.second
getCurrentPromoCodeUseCase().flatMap { promoCode ->
adyenPaymentRepository.makePayment(
adyenPaymentMethod = adyenPaymentMethod,
shouldStoreMethod = shouldStoreMethod,
hasCvc = hasCvc,
supportedShopperInteractions = supportedShopperInteraction,
returnUrl = returnUrl,
value = value,
currency = currency,
reference = reference,
paymentType = paymentType,
walletAddress = addressModel.address,
origin = origin,
packageName = packageName,
metadata = metadata,
sku = sku,
callbackUrl = callbackUrl,
transactionType = transactionType,
entityOemId = attrEntity.oemId,
entityDomain = attrEntity.domain,
entityPromoCode = promoCode.code,
userWallet = addressModel.address,
walletSignature = addressModel.signedAddress,
referrerUrl = referrerUrl,
guestWalletId = guestWalletId,
)
}
) { address, attributionEntity -> address to attributionEntity }
.flatMap { (addressModel, attrEntity) ->
getCurrentPromoCodeUseCase()
.flatMap { promoCode ->
adyenPaymentRepository.makePayment(
adyenPaymentMethod = adyenPaymentMethod,
shouldStoreMethod = shouldStoreMethod,
hasCvc = hasCvc,
supportedShopperInteractions = supportedShopperInteraction,
returnUrl = returnUrl,
value = value,
currency = currency,
reference = reference,
paymentType = paymentType,
walletAddress = addressModel.address,
origin = origin,
packageName = packageName,
metadata = metadata,
sku = sku,
callbackUrl = callbackUrl,
transactionType = transactionType,
entityOemId = attrEntity.oemId,
entityDomain = attrEntity.domain,
entityPromoCode = promoCode.code,
userWallet = addressModel.address,
walletSignature = addressModel.signedAddress,
referrerUrl = referrerUrl,
guestWalletId = guestWalletId,
)
}
}
}

fun addCard(
adyenPaymentMethod: ModelObject, hasCvc: Boolean,
adyenPaymentMethod: ModelObject,
hasCvc: Boolean,
supportedShopperInteraction: List<String>,
returnUrl: String, value: String, currency: String
returnUrl: String,
value: String,
currency: String
): Single<PaymentModel> {
return walletService.getAndSignCurrentWalletAddress().flatMap {
val addressModel = it
adyenPaymentRepository.makePayment(
adyenPaymentMethod = adyenPaymentMethod,
shouldStoreMethod = true,
hasCvc = hasCvc,
supportedShopperInteractions = supportedShopperInteraction,
returnUrl = returnUrl,
value = value,
currency = currency,
reference = null,
paymentType = "credit_card",
walletAddress = addressModel.address,
origin = null,
packageName = "com.appcoins.wallet", // necessary for the verification request
metadata = null,
sku = null,
callbackUrl = null,
transactionType = "VERIFICATION",
entityOemId = null,
entityDomain = null,
entityPromoCode = null,
userWallet = null,
walletSignature = addressModel.signedAddress,
referrerUrl = null,
guestWalletId = null
)
}
return walletService.getAndSignCurrentWalletAddress()
.flatMap {
val addressModel = it
adyenPaymentRepository.makePayment(
adyenPaymentMethod = adyenPaymentMethod,
shouldStoreMethod = true,
hasCvc = hasCvc,
supportedShopperInteractions = supportedShopperInteraction,
returnUrl = returnUrl,
value = value,
currency = currency,
reference = null,
paymentType = "credit_card",
walletAddress = addressModel.address,
origin = null,
packageName = "com.appcoins.wallet", // necessary for the verification request
metadata = null,
sku = null,
callbackUrl = null,
transactionType = "VERIFICATION",
entityOemId = null,
entityDomain = null,
entityPromoCode = null,
userWallet = null,
walletSignature = addressModel.signedAddress,
referrerUrl = null,
guestWalletId = null
)
}
}

fun makeTopUpPayment(
adyenPaymentMethod: ModelObject, shouldStoreMethod: Boolean, hasCvc: Boolean,
supportedShopperInteraction: List<String>, returnUrl: String, value: String,
currency: String, paymentType: String, transactionType: String,
adyenPaymentMethod: ModelObject,
shouldStoreMethod: Boolean,
hasCvc: Boolean,
supportedShopperInteraction: List<String>,
returnUrl: String,
value: String,
currency: String,
paymentType: String,
transactionType: String,
packageName: String
): Single<PaymentModel> {
return walletService.getAndSignCurrentWalletAddress()
Expand Down Expand Up @@ -201,7 +213,8 @@ class AdyenPaymentInteractor @Inject constructor(
}

fun submitRedirect(
uid: String, details: JsonObject,
uid: String,
details: JsonObject,
paymentData: String?
): Single<PaymentModel> {
return walletService.getWalletAddress()
Expand Down Expand Up @@ -230,13 +243,22 @@ class AdyenPaymentInteractor @Inject constructor(
fun removePreSelectedPaymentMethod() = inAppPurchaseInteractor.removePreSelectedPaymentMethod()

fun getCompletePurchaseBundle(
type: String, merchantName: String, sku: String?,
purchaseUid: String?, orderReference: String?, hash: String?,
type: String,
merchantName: String,
sku: String?,
purchaseUid: String?,
orderReference: String?,
hash: String?,
scheduler: Scheduler
): Single<PurchaseBundleModel> {
return inAppPurchaseInteractor.getCompletedPurchaseBundle(
type, merchantName, sku, purchaseUid,
orderReference, hash, scheduler
type,
merchantName,
sku,
purchaseUid,
orderReference,
hash,
scheduler
)
}

Expand Down
Loading

0 comments on commit 5a9fc87

Please sign in to comment.