Skip to content

Commit

Permalink
fix: passing correct partner (#1672)
Browse files Browse the repository at this point in the history
  • Loading branch information
Merculiar authored Jan 23, 2025
1 parent 1d36df5 commit dcc065a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,24 @@ class BrijOffRampOrderService implements Disposable {
OffRampOrderStatus.refunded,
OffRampOrderStatus.rejected,
]) &
tbl.partner.equalsValue(RampPartner.brij),
tbl.partner.isInValues([RampPartner.brij, RampPartner.scalexBrij]),
);

final orders = await query.get();

for (final order in orders) {
if (order.partner != RampPartner.brij) {
continue;
switch (order.partner) {
case RampPartner.kado:
case RampPartner.coinflow:
case RampPartner.scalex:
case RampPartner.guardarian:
case RampPartner.rampNetwork:
case RampPartner.moneygram:
continue;
case RampPartner.brij:
case RampPartner.scalexBrij:
_subscribe(order.id);
}

_subscribe(order.id);
}
}

Expand Down Expand Up @@ -156,10 +163,11 @@ class BrijOffRampOrderService implements Disposable {
AsyncResult<String> create({
required CryptoAmount submittedAmount,
required FiatAmount receiveAmount,
required String partnerAuthPk,
required RampPartner partner,
}) =>
tryEitherAsync((_) async {
{
final partnerAuthPk = partner.partnerPK ?? '';
await _kycRepository.grantPartnerAccess(partnerAuthPk);

final user = await _kycRepository.fetchUser();
Expand Down Expand Up @@ -194,7 +202,7 @@ class BrijOffRampOrderService implements Disposable {
created: DateTime.now(),
humanStatus: '',
machineStatus: '',
partner: RampPartner.brij,
partner: partner,
status: OffRampOrderStatus.waitingPartnerReview,
transaction: '',
depositAddress: '',
Expand All @@ -210,7 +218,7 @@ class BrijOffRampOrderService implements Disposable {
);

_analytics.rampInitiated(
partnerName: RampPartner.brij.name,
partnerName: partner.name,
rampType: RampType.offRamp.name,
amount: submittedAmount.value.toString(),
countryCode: countryCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,24 @@ class BrijOnRampOrderService implements Disposable {
OnRampOrderStatus.completed,
OnRampOrderStatus.failure,
]) &
tbl.partner.equalsValue(RampPartner.brij),
tbl.partner.isInValues([RampPartner.brij, RampPartner.scalexBrij]),
);

final orders = await query.get();

for (final order in orders) {
if (order.partner != RampPartner.brij) {
continue;
switch (order.partner) {
case RampPartner.kado:
case RampPartner.coinflow:
case RampPartner.scalex:
case RampPartner.guardarian:
case RampPartner.rampNetwork:
case RampPartner.moneygram:
continue;
case RampPartner.brij:
case RampPartner.scalexBrij:
_subscribe(order.id);
}

_subscribe(order.id);
}
}

Expand Down Expand Up @@ -99,10 +106,11 @@ class BrijOnRampOrderService implements Disposable {
AsyncResult<String> create({
required FiatAmount submittedAmount,
required CryptoAmount receiveAmount,
required String partnerAuthPk,
required RampPartner partner,
}) =>
tryEitherAsync((_) async {
{
final partnerAuthPk = partner.partnerPK ?? '';
await _kycRepository.grantPartnerAccess(partnerAuthPk);

final orderId = await _kycRepository.createOnRampOrder(
Expand All @@ -123,7 +131,7 @@ class BrijOnRampOrderService implements Disposable {
isCompleted: false,
created: DateTime.now(),
txHash: '',
partner: RampPartner.brij,
partner: partner,
receiveAmount: receiveAmount.value,
status: OnRampOrderStatus.waitingPartnerReview,
bankAccount: null,
Expand All @@ -140,7 +148,7 @@ class BrijOnRampOrderService implements Disposable {
final countryCode = _kycSharingService.value?.countryCode;

_analytics.rampInitiated(
partnerName: RampPartner.brij.name,
partnerName: partner.name,
rampType: RampType.onRamp.name,
amount: submittedAmount.value.toString(),
countryCode: countryCode ?? '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extension BuildContextExt on BuildContext {
.create(
receiveAmount: equivalentAmount,
submittedAmount: submittedAmount as FiatAmount,
partnerAuthPk: partner.partnerPK ?? '',
partner: partner,
)
.then(
(order) => order.fold(
Expand Down Expand Up @@ -226,7 +226,7 @@ extension BuildContextExt on BuildContext {
.create(
receiveAmount: equivalentAmount,
submittedAmount: submittedAmount,
partnerAuthPk: partner.partnerPK ?? '',
partner: partner,
)
.then(
(order) => order.fold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ class OnRampOrderService implements Disposable {
) as FiatAmount,
);

final submittedAmount = row.partner == RampPartner.brij
final isFiat = row.partner == RampPartner.brij ||
row.partner == RampPartner.scalexBrij;

final submittedAmount = isFiat
? FiatAmount(
value: row.amount,
fiatCurrency: currencyFromString(row.fiatSymbol ?? 'USD'),
Expand Down

0 comments on commit dcc065a

Please sign in to comment.