Skip to content

Commit

Permalink
feat: [IOBP-1047] Add store review when a payment is completed (#6496)
Browse files Browse the repository at this point in the history
## Short description
This PR adds the store review request when a payment is completed.

## List of changes proposed in this pull request
- Invoked the API to request a store review when the payment outcome is
completed and SUCCESS.

## How to test
Start a payment flow with the dev-server and simulate a successful
outcome from the in-app browser dropdown list. After that, check that
the request to leave a review on the store dialog appears.

## Preview


https://github.com/user-attachments/assets/c9fdc561-e21e-4d8f-8ab3-c127047197c2
  • Loading branch information
Hantex9 authored Dec 5, 2024
1 parent c963455 commit a8e32df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel";
import { getPaymentsLatestBizEventsTransactionsAction } from "../../bizEventsTransaction/store/actions";
import { usePaymentReversedInfoBottomSheet } from "../hooks/usePaymentReversedInfoBottomSheet";
import { WalletPaymentStepEnum } from "../types";
import { requestAppReview } from "../../../../utils/storeReview";

type WalletPaymentOutcomeScreenNavigationParams = {
outcome: WalletPaymentOutcome;
Expand Down Expand Up @@ -146,14 +147,19 @@ const WalletPaymentOutcomeScreen = () => {
navigation.pop();
};

const handleSuccessClose = () => {
requestAppReview();
handleClose();
};

const handleShowMoreOnReversedPayment = () => {
reversedPaymentModal.present();
};

const closeSuccessAction: OperationResultScreenContentProps["action"] = {
label: I18n.t("wallet.payment.outcome.SUCCESS.button"),
accessibilityLabel: I18n.t("wallet.payment.outcome.SUCCESS.button"),
onPress: handleClose,
onPress: handleSuccessClose,
testID: "wallet-payment-outcome-success-button"
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import { WalletPaymentOutcomeEnum } from "../../types/PaymentOutcomeEnum";
import { getPaymentsLatestBizEventsTransactionsAction } from "../../../bizEventsTransaction/store/actions";
import * as useIO from "../../../../../store/hooks";

jest.mock("react-native-store-review", () => ({
isAvailable: jest.fn().mockReturnValue(true),
requestReview: jest.fn()
}));

const renderComponent = (outcome: WalletPaymentOutcomeEnum) => {
const globalState = appReducer(undefined, applicationChangeState("active"));

Expand Down

0 comments on commit a8e32df

Please sign in to comment.