Skip to content

Commit

Permalink
feat: [#175708197] Report an issue about credit card onboarding (#2378)
Browse files Browse the repository at this point in the history
* [#175708197] list of credit card onboarding attempts

* [#175708197] add credit card attempts list, detail, instabug report

* [#175708197] fix

* [#175708197] fixes

* [#175708197] add comment

* [#175708197] fix

* [#175708197] update texts

* Update ts/utils/profile.ts

Co-authored-by: fabriziofff <[email protected]>
  • Loading branch information
Undermaken and fabriziofff authored Nov 13, 2020
1 parent f68b937 commit c19cf41
Show file tree
Hide file tree
Showing 19 changed files with 546 additions and 35 deletions.
1 change: 1 addition & 0 deletions locales/en/bonus/bpd/faq/faqBpd1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Access the [payment methods added status](ioit://CREDIT_CARD_ONBOARDING_ATTEMPTS_SCREEN) page to select the failed operations from the list and contact support.
2 changes: 1 addition & 1 deletion locales/en/faq/faq57.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
If you have had problems during a payment and do not know if it has been successful, or why it has failed, check the [status of your payments](ioit://PAYMENTS_HISTORY_SCREEN). From the list you can select the failed operations and contact support.
Access the [status of your payments](ioit://PAYMENTS_HISTORY_SCREEN) page to select the failed operations from the list and contact support.
21 changes: 17 additions & 4 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,17 @@ payment:
iuv: IUV payment {{iuv}}
wallet:
wallet: Wallet
creditCard:
onboardingAttempts:
title: Attempts to onboard payment method
emptyTitle: No attempts to onboard payment method
emptyBody: IO did not log attempts to add a payment method. Here you will find the most recent attempts
lastAttemptsTitle: Last attempts
success: Success
failure: Failure
dateTime: Date and time
detailTitle: Details
help: If you have encountered a problem entering this payment method, write for more information and details
searchAbi:
title: Add Bancomat card
description:
Expand Down Expand Up @@ -696,9 +707,8 @@ wallet:
transactionsLoadMessage: Loading transactions...
transactionsLoadFailure: Loading your transactions has failed, please retry.
transactionHelpMessage:
text1: If you have had problems during a payment,
text2: consult the help
text3: at the top right of this page
text1: Problems with a payment or adding a new method?
text2: Consult the help at the top right of this page.
transactionsLoadMore: Load previous
transacionsLoadingMore: Loading previous...
pickPaymentMethod:
Expand Down Expand Up @@ -1411,7 +1421,7 @@ faq:
title: "How to delete all my personal data associated to IO?"
content: !include faq/faq56.md
57:
title: "Did you have problems during a payment?"
title: "Did you have problems during a payment or onboarding a payment instrument?"
content: !include faq/faq57.md
58:
title: "How do I claim the Bonus Vacanze?"
Expand Down Expand Up @@ -1473,6 +1483,9 @@ faq:
77:
title: "Is any kind of ISEE right to request the Bonus Vacanze?"
content: !include bonus/faq/faq77.md
78:
title: "Did you have problems adding a new payment method?"
content: !include bonus/bpd/faq/faqBpd1.md
bonus:
bonusVacanze:
accessibility:
Expand Down
1 change: 1 addition & 0 deletions locales/it/bonus/bpd/faq/faqBpd1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Accedi alla pagina [stato aggiunta metodi di pagamento](ioit://CREDIT_CARD_ONBOARDING_ATTEMPTS_SCREEN) per selezionare dalla lista le operazioni fallite e contattare l’assistenza.
2 changes: 1 addition & 1 deletion locales/it/faq/faq57.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Se hai avuto problemi durante un pagamento e non sai se sia andato a buon fine, o perché sia fallito, controlla lo [stato dei tuoi pagamenti](ioit://PAYMENTS_HISTORY_SCREEN). Dalla lista potrai selezionare le operazioni che risultano fallite e contattare l'assistenza.
Accedi alla pagina [stato dei tuoi pagamenti](ioit://PAYMENTS_HISTORY_SCREEN) per selezionare dalla lista le operazioni fallite e contattare lassistenza.
19 changes: 16 additions & 3 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,17 @@ payment:
iuv: Codice IUV {{iuv}}
wallet:
wallet: Portafoglio
creditCard:
onboardingAttempts:
title: Tentativi aggiunta metodo di pagamento
emptyTitle: Nessun tentitivo di aggiunta di un metodo di pagamento
emptyBody: IO non ha memorizzato tentativi di aggiunta di un metodo di pagamento. Qui troverai i tentativi più recenti
lastAttemptsTitle: Ultimi tentativi
success: Aggiunto
failure: Fallito
dateTime: Data e ora
detailTitle: Dettaglio
help: Se hai riscontrato un problema durante l'inserimento di questo metodo di pagamento, scrivi per maggiori informazioni e dettagli
searchAbi:
title: Aggiungi carta Bancomat
description:
Expand Down Expand Up @@ -717,9 +728,8 @@ wallet:
transactionsLoadMessage: Carico lo storico delle transazioni...
transactionsLoadFailure: Non è stato possibile caricare lo storico delle tue operazioni, riprova per piacere.
transactionHelpMessage:
text1: Se hai avuto problemi durante un pagamento,
text2: consulta l'help
text3: in alto a destra su questa pagina
text1: Problemi con un pagamento o l’aggiunta di un nuovo metodo?
text2: Consulta l’help in alto a destra su questa pagina.
transactionsLoadMore: Carica precedenti
transacionsLoadingMore: Carico precedenti...
pickPaymentMethod:
Expand Down Expand Up @@ -1505,6 +1515,9 @@ faq:
77:
title: "Qualsiasi tipo di ISEE è valido per richiedere il Bonus Vacanze tramite l’app IO?"
content: !include bonus/faq/faq77.md
78:
title: "Hai avuto problemi nell’aggiunta di un nuovo metodo di pagamento?"
content: !include bonus/bpd/faq/faqBpd1.md
bonus:
bonusVacanze:
accessibility:
Expand Down
3 changes: 2 additions & 1 deletion ts/components/ui/Markdown/handlers/internalLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const ROUTE_NAMES: ReadonlyArray<string> = [
ROUTES.PROFILE_PRIVACY_MAIN,
ROUTES.WALLET_HOME,
ROUTES.WALLET_LIST,
ROUTES.PAYMENTS_HISTORY_SCREEN
ROUTES.PAYMENTS_HISTORY_SCREEN,
ROUTES.CREDIT_CARD_ONBOARDING_ATTEMPTS_SCREEN
];

const BONUS_VACANZE_ROUTE_NAMES: ReadonlyArray<string> = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { Content, Text, View } from "native-base";
import * as React from "react";
import { FlatList, ListRenderItemInfo, StyleSheet } from "react-native";
import variables from "../../../theme/variables";
import I18n from "../../../i18n";
import ItemSeparatorComponent from "../../ItemSeparatorComponent";
import { EdgeBorderComponent } from "../../screens/EdgeBorderComponent";
import { formatDateAsLocal } from "../../../utils/dates";
import {
CreditCardInsertion,
CreditCardInsertionState
} from "../../../store/reducers/wallet/creditCard";
import TouchableDefaultOpacity from "../../TouchableDefaultOpacity";
import { BadgeComponent } from "../../screens/BadgeComponent";
import IconFont from "../../ui/IconFont";
import customVariables from "../../../theme/variables";
import { Label } from "../../core/typography/Label";
import { IOStyles } from "../../core/variables/IOStyles";

type Props = Readonly<{
title: string;
creditCardAttempts: CreditCardInsertionState;
onAttemptPress: (attempt: CreditCardInsertion) => void;
ListEmptyComponent: React.ReactNode;
}>;

const styles = StyleSheet.create({
whiteContent: {
backgroundColor: variables.colorWhite,
flex: 1
},
subHeaderContent: {
flexDirection: "row",
alignItems: "baseline",
justifyContent: "space-between"
}
});

const itemStyles = StyleSheet.create({
verticalPad: {
paddingVertical: customVariables.spacerHeight
},
spaced: {
justifyContent: "flex-start",
flexDirection: "row",
alignItems: "center"
},
text11: {
paddingLeft: 8
},
icon: {
width: 64,
alignItems: "flex-end",
alignContent: "center",
alignSelf: "center",
justifyContent: "center"
}
});

const FOUR_UNICODE_CIRCLES = "●".repeat(4);
const ICON_WIDTH = 24;
const labelColor = "bluegrey";
export const getPanDescription = (attempt: CreditCardInsertion) =>
`${FOUR_UNICODE_CIRCLES} ${attempt.blurredPan}\n ${I18n.t(
"cardComponent.validUntil"
).toLowerCase()} ${attempt.expireMonth}/${attempt.expireYear}`;

const getAttemptData = (attempt: CreditCardInsertion) => {
const conditionalData = attempt.onboardingComplete
? {
color: "green",
header: I18n.t("wallet.creditCard.onboardingAttempts.success")
}
: {
color: "red",
header: I18n.t("wallet.creditCard.onboardingAttempts.failure")
};
const startDate = new Date(attempt.startDate);
const when = `${formatDateAsLocal(
startDate,
true,
true
)} - ${startDate.toLocaleTimeString()}`;
return {
panAndExpiringDate: getPanDescription(attempt),
when,
...conditionalData
};
};

/**
* This component shows a list with the last credit card onboarding attempts
*/
export const CreditCardAttemptsList: React.FC<Props> = (props: Props) => {
const { ListEmptyComponent, creditCardAttempts } = props;
const renderCreditCardAttempt = (
info: ListRenderItemInfo<CreditCardInsertion>
) => {
const attemptData = getAttemptData(info.item);
return (
<View style={IOStyles.flex}>
<TouchableDefaultOpacity
onPress={() => props.onAttemptPress(info.item)}
style={itemStyles.verticalPad}
>
<View style={[IOStyles.flex, IOStyles.row]}>
<View style={IOStyles.flex}>
<View style={itemStyles.spaced}>
<BadgeComponent color={attemptData.color} />
<Label color={labelColor} style={itemStyles.text11}>
{attemptData.header}
</Label>
</View>
<View small={true} />
<Label color={labelColor} weight={"Regular"}>
{attemptData.panAndExpiringDate}
</Label>
<Label color={labelColor} weight={"Regular"}>
{attemptData.when}
</Label>
</View>
<View style={itemStyles.icon}>
<IconFont
name={"io-right"}
size={ICON_WIDTH}
color={customVariables.contentPrimaryBackground}
/>
</View>
</View>
</TouchableDefaultOpacity>
</View>
);
};

return (
<Content style={styles.whiteContent}>
<View>
<View style={styles.subHeaderContent}>
<Text>{props.title}</Text>
</View>
</View>

<FlatList
scrollEnabled={false}
data={creditCardAttempts}
renderItem={renderCreditCardAttempt}
ListEmptyComponent={ListEmptyComponent}
ItemSeparatorComponent={() => (
<ItemSeparatorComponent noPadded={true} />
)}
ListFooterComponent={
creditCardAttempts.length > 0 && <EdgeBorderComponent />
}
keyExtractor={c => c.hashedPan}
/>
</Content>
);
};
8 changes: 8 additions & 0 deletions ts/navigation/WalletNavigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import TransactionDetailsScreen from "../screens/wallet/TransactionDetailsScreen
import TransactionsScreen from "../screens/wallet/TransactionsScreen";
import WalletHomeScreen from "../screens/wallet/WalletHomeScreen";
import WalletsScreen from "../screens/wallet/WalletsScreen";
import CreditCardOnboardingAttemptsScreen from "../screens/wallet/creditCardOnboardingAttempts/CreditCardOnboardingAttemptsScreen";
import CreditCardOnboardingAttemptDetailScreen from "../screens/wallet/creditCardOnboardingAttempts/CreditCardOnboardingAttemptDetailScreen";
import ROUTES from "./routes";

const baseRouteConfigMap = {
Expand Down Expand Up @@ -76,6 +78,12 @@ const baseRouteConfigMap = {
},
[ROUTES.PAYMENT_HISTORY_DETAIL_INFO]: {
screen: PaymentHistoryDetailsScreen
},
[ROUTES.CREDIT_CARD_ONBOARDING_ATTEMPTS_SCREEN]: {
screen: CreditCardOnboardingAttemptsScreen
},
[ROUTES.CREDIT_CARD_ONBOARDING_ATTEMPT_DETAIL]: {
screen: CreditCardOnboardingAttemptDetailScreen
}
};

Expand Down
5 changes: 4 additions & 1 deletion ts/navigation/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ const ROUTES = {
PAYMENT_PICK_PSP: "PAYMENT_PICK_PSP",
PAYMENTS_HISTORY_SCREEN: "PAYMENTS_HISTORY_SCREEN",
PAYMENT_HISTORY_DETAIL_INFO: "PAYMENT_HISTORY_DETAIL_INFO",

CREDIT_CARD_ONBOARDING_ATTEMPTS_SCREEN:
"CREDIT_CARD_ONBOARDING_ATTEMPTS_SCREEN",
CREDIT_CARD_ONBOARDING_ATTEMPT_DETAIL:
"CREDIT_CARD_ONBOARDING_ATTEMPT_DETAIL",
// Pin
PIN_LOGIN_NAVIGATOR: "PIN_LOGIN_NAVIGATOR",
PIN_LOGIN: "PIN_LOGIN",
Expand Down
7 changes: 5 additions & 2 deletions ts/screens/wallet/PaymentHistoryDetailsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,19 @@ const renderItem = (label: string, value?: string) => {
</React.Fragment>
);
};

const instabugTag = "payment-support";
/**
* Payment Details
*/
class PaymentHistoryDetailsScreen extends React.Component<Props> {
private instabugLogAndOpenReport = () => {
Instabug.appendTags(["payment-support"]);
Instabug.appendTags([instabugTag]);
pot.map(this.props.profile, p => {
instabugLog(
getPaymentHistoryDetails(this.props.navigation.getParam("payment"), p),
TypeLogs.INFO
TypeLogs.INFO,
instabugTag
);
});
openInstabugBugReport();
Expand Down
Loading

0 comments on commit c19cf41

Please sign in to comment.