This repository was archived by the owner on Aug 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-9
lines changed
Components/FilterComponents Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 11import React from "react" ;
22import { connect } from "react-redux" ;
33import Chip from "@material-ui/core/Chip" ;
4- import Avatar from "@material-ui/core/Avatar" ;
54import IconButton from "@material-ui/core/IconButton" ;
65import ListItem from "@material-ui/core/ListItem" ;
76import ListItemIcon from "@material-ui/core/ListItemIcon" ;
@@ -87,7 +86,7 @@ class CardSelection extends React.Component {
8786 // ensure card exists
8887 if ( ! card ) return null ;
8988 card = card ;
90- const { cardImage, cardType } = getCardTypeImage ( card . type , card . cardType ) ;
89+ const { cardImage, cardType } = getCardTypeImage ( card ) ;
9190
9291 // display big chip or smaller icon
9392 return (
@@ -120,7 +119,7 @@ class CardSelection extends React.Component {
120119 }
121120
122121 const cardDescription = getCardDescription ( card ) ;
123- const { cardImage, cardType } = getCardTypeImage ( card . type , card . cardType ) ;
122+ const { cardImage, cardType } = getCardTypeImage ( card ) ;
124123
125124 return (
126125 < MenuItem key = { key } onClick = { this . addCardId ( card . id ) } >
Original file line number Diff line number Diff line change @@ -9,15 +9,29 @@ const styles = {
99 cardImage : { }
1010} ;
1111
12- export const getCardTypeImage = ( type , apiType = "CardDebit" ) => {
12+ export const getCardTypeImage = ( card ) => {
13+ const type = card . type ;
14+ const productType = card . product_type ;
15+ let cardType = card . cardType ;
16+
1317 let cardImage = null ;
14- let cardType = null ;
1518 switch ( type ) {
1619 case "MASTERCARD" : {
17- switch ( apiType ) {
20+ // check the different physical mastercard types
21+ switch ( cardType ) {
1822 case "CardCredit" :
19- cardType = "MasterCard Credit" ;
20- cardImage = "images/bunq-mastercard-credit.png" ;
23+ // check the different credit card types
24+ switch ( productType ) {
25+ case "MASTERCARD_GREEN" :
26+ cardType = "MasterCard Green" ;
27+ cardImage = "images/bunq-mastercard-metal.png" ;
28+ break ;
29+ default :
30+ case "MASTERCARD_TRAVEL" :
31+ cardType = "MasterCard Credit" ;
32+ cardImage = "images/bunq-mastercard-credit.png" ;
33+ break ;
34+ }
2135 break ;
2236 default :
2337 case "CardDebit" :
@@ -55,7 +69,7 @@ class CardListItem extends React.Component {
5569
5670 render ( ) {
5771 const card = this . props . card ;
58- const { cardImage } = getCardTypeImage ( card . type , card . cardType ) ;
72+ const { cardImage } = getCardTypeImage ( card ) ;
5973
6074 return [
6175 < div className = "single-card" style = { styles . cardWrapper } onClick = { this . props . onClick } >
You can’t perform that action at this time.
0 commit comments