Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderPaymentReview() {
const ccSuffix = this.props.checkout.number.substring( this.props.checkout.number.length - 4 );
const ccType = card.type( card.parse( this.props.checkout.number ) ).replace( / /g, '' ).toLowerCase();
return <section>
<h3>{ i18n.translate( 'Total' ) }</h3>
<div>
<div>
<span></span>
<span>**** { ccSuffix }</span>
</div>
<div>
{ this.props.selectedDomain.totalCost } { this.props.selectedDomain.currencyCode }
</div>
</div>
{ i18n.translate( 'edit payment method' ) }
</section>;
}
renderCreditCards() {
const supportedCards = [
'Visa',
'MasterCard',
'Discover',
'American Express',
];
const number = this.props.fields.number.value;
const cardType = card.type( card.parse( number ), true );
const enableAllCards = supportedCards.indexOf( cardType ) === -1;
const classes = {
visa: ( enableAllCards || cardType === 'Visa' ) ? styles.visa : styles.visaDisabled,
mastercard: ( enableAllCards || cardType === 'MasterCard' ) ? styles.mastercard : styles.mastercardDisabled,
discover: ( enableAllCards || cardType === 'Discover' ) ? styles.discover : styles.discoverDisabled,
amex: ( enableAllCards || cardType === 'American Express' ) ? styles.amex : styles.amexDisabled,
};
return (
<div>
<div alt="Visa">
<div alt="Mastercard">
<div alt="Discover">
<div alt="American Express">
</div>
);</div></div></div></div>
$scope.$watch($attributes.ngModel, function (number) {
ngModel.$ccType = ccNumber.type = card.type(number)
})
$scope.$watch($viewValue, function eagerTypeCheck (number) {
number = card.parse(number)
ngModel.$ccEagerType = ccNumber.eagerType = card.type(number, true)
})
}