Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -86,6 +86,21 @@ class _CreditCard extends \IPS\nexus\Customer\CreditCard
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check it doesn't already exist */
|
||||
$otherCards = \IPS\Db::i()->select( 'card_data', 'nexus_customer_cards', array( 'card_member=? AND card_method=?', $this->member->member_id, $this->method->id ) );
|
||||
if ( count( $otherCards ) )
|
||||
{
|
||||
foreach ( $otherCards as $otherCardId )
|
||||
{
|
||||
$otherCardData = $this->method->api( 'vault/credit-card/' . $otherCardId, NULL, 'get' );
|
||||
if ( $otherCardData['state'] === 'ok' and mb_substr( $otherCardData['number'], -4 ) === mb_substr( $card->number, -4 ) and intval( $otherCardData['expire_month'] ) === intval( $card->expMonth ) and intval( $otherCardData['expire_year'] ) === intval( $card->expYear ) )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack('card_is_duplicate') );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Save */
|
||||
$response = $this->method->api( 'vault/credit-card', array(
|
||||
'number' => $card->number,
|
||||
'type' => $cardType,
|
||||
@@ -95,7 +110,6 @@ class _CreditCard extends \IPS\nexus\Customer\CreditCard
|
||||
'first_name' => $this->member->cm_first_name,
|
||||
'last_name' => $this->member->cm_last_name,
|
||||
) );
|
||||
|
||||
$this->data = $response['id'];
|
||||
$this->save();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user