How to use the creditcards.card.type function in creditcards

To help you get started, we’ve selected a few creditcards examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / delphin / app / components / ui / checkout-review / index.js View on Github external
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>;
	}
github Automattic / delphin / app / components / ui / checkout / payment-field-area.js View on Github external
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>
github bendrucker / angular-credit-cards / src / number.js View on Github external
$scope.$watch($attributes.ngModel, function (number) {
          ngModel.$ccType = ccNumber.type = card.type(number)
        })
github bendrucker / angular-credit-cards / src / number.js View on Github external
$scope.$watch($viewValue, function eagerTypeCheck (number) {
            number = card.parse(number)
            ngModel.$ccEagerType = ccNumber.eagerType = card.type(number, true)
          })
        }