Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Authorize.Net CIM Stored Card
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Nexus
|
||||
* @since 17 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -44,17 +44,50 @@ class _CreditCard extends \IPS\nexus\Customer\CreditCard
|
||||
throw new \UnexpectedValueException;
|
||||
}
|
||||
|
||||
$xml = $this->create('getCustomerPaymentProfileRequest');
|
||||
$xml = $this->createAuthenticationXml('getCustomerPaymentProfileRequest');
|
||||
$xml->addChild( 'customerProfileId', $profiles[ $this->method->id ] );
|
||||
$xml->addChild( 'customerPaymentProfileId', $this->data );
|
||||
$response = $this->api( $xml );
|
||||
|
||||
$this->_card = new \IPS\nexus\CreditCard;
|
||||
$this->_card->lastFour = mb_substr( $response->paymentProfile->payment->creditCard->cardNumber, -4 );
|
||||
$this->_card->lastFour = mb_substr( $response->paymentProfile->payment->creditCard->cardNumber, -4 );
|
||||
if ( isset( $response->paymentProfile->payment->creditCard->cardType ) )
|
||||
{
|
||||
switch ( $response->paymentProfile->payment->creditCard->cardType )
|
||||
{
|
||||
case 'Visa':
|
||||
$this->_card->type = \IPS\nexus\CreditCard::TYPE_VISA;
|
||||
break;
|
||||
case 'AmericanExpress':
|
||||
$this->_card->type = \IPS\nexus\CreditCard::TYPE_AMERICAN_EXPRESS;
|
||||
break;
|
||||
case 'MasterCard':
|
||||
$this->_card->type = \IPS\nexus\CreditCard::TYPE_MASTERCARD;
|
||||
break;
|
||||
case 'Discover':
|
||||
$this->_card->type = \IPS\nexus\CreditCard::TYPE_DISCOVER;
|
||||
break;
|
||||
case 'JCB':
|
||||
$this->_card->type = \IPS\nexus\CreditCard::TYPE_JCB;
|
||||
break;
|
||||
case 'DinersClub':
|
||||
$this->_card->type = \IPS\nexus\CreditCard::TYPE_DINERS_CLUB;
|
||||
break;
|
||||
default:
|
||||
$this->_card->type = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_card->type = NULL;
|
||||
}
|
||||
$this->_card->expYear = NULL;
|
||||
$this->_card->expMonth = NULL;
|
||||
}
|
||||
return $this->_card;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set card
|
||||
*
|
||||
@@ -67,7 +100,7 @@ class _CreditCard extends \IPS\nexus\Customer\CreditCard
|
||||
$profiles = $this->member->cm_profiles;
|
||||
if ( !isset( $profiles[ $this->method->id ] ) )
|
||||
{
|
||||
$xml = $this->create( 'createCustomerProfileRequest' );
|
||||
$xml = $this->createAuthenticationXml( 'createCustomerProfileRequest' );
|
||||
$xml->addChild( 'profile', array(
|
||||
'merchantCustomerId' => $this->member->member_id
|
||||
) );
|
||||
@@ -83,7 +116,7 @@ class _CreditCard extends \IPS\nexus\Customer\CreditCard
|
||||
}
|
||||
|
||||
/* Add the card */
|
||||
$xml = $this->create( 'createCustomerPaymentProfileRequest' );
|
||||
$xml = $this->createAuthenticationXml( 'createCustomerPaymentProfileRequest' );
|
||||
$xml->addChild( 'customerProfileId', $profiles[ $this->method->id ] );
|
||||
$xml->addChild( 'paymentProfile', array(
|
||||
'payment' => array(
|
||||
@@ -116,7 +149,7 @@ class _CreditCard extends \IPS\nexus\Customer\CreditCard
|
||||
$profiles = $this->member->cm_profiles;
|
||||
if ( isset( $profiles[ $this->method->id ] ) )
|
||||
{
|
||||
$xml = $this->create( 'deleteCustomerPaymentProfileRequest' );
|
||||
$xml = $this->createAuthenticationXml( 'deleteCustomerPaymentProfileRequest' );
|
||||
$xml->addChild( 'customerProfileId', $profiles[ $this->method->id ] );
|
||||
$xml->addChild( 'customerPaymentProfileId', $this->data );
|
||||
$response = $this->api( $xml );
|
||||
@@ -146,7 +179,7 @@ class _CreditCard extends \IPS\nexus\Customer\CreditCard
|
||||
* @param string $method The API method we will be calling
|
||||
* @return \IPS\Xml\SimpleXML
|
||||
*/
|
||||
public function create( $method )
|
||||
public function createAuthenticationXml( $method )
|
||||
{
|
||||
$settings = json_decode( $this->method->settings, TRUE );
|
||||
$xml = \IPS\Xml\SimpleXML::create( $method, 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' );
|
||||
|
||||
Reference in new issue
Block a user