Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/vendor
composer.lock
composer.phar
phpunit.xml
.idea
/composer.lock
/composer.phar
/phpunit.xml
/.idea
/.DS_Store
5 changes: 5 additions & 0 deletions src/CIMGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public function getPaymentProfile(array $parameters = array())
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMGetPaymentProfileRequest', $parameters);
}

public function updateCard(array $parameters = array())
{
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMUpdatePaymentProfileRequest', $parameters);
}

public function deleteCard(array $parameters = array())
{
return $this->createRequest('\Omnipay\AuthorizeNet\Message\CIMDeletePaymentProfileRequest', $parameters);
Expand Down
2 changes: 1 addition & 1 deletion src/Message/AIMVoidRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function getData()
$this->validate('transactionReference');

$data = $this->getBaseData();
$data->transactionRequest->refTransId = $this->getTransactionReference()->getTransId();
$data->transactionRequest->refTransId = $this->getTransactionReference();
$this->addTransactionSettings($data);

return $data;
Expand Down
2 changes: 0 additions & 2 deletions src/Message/CIMAuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ protected function addPayment(\SimpleXMLElement $data)

/** @var CardReference $cardRef */
$cardRef = $this->getCardReference(false);

$req->profile->customerProfileId = $cardRef->getCustomerProfileId();

$req->profile->paymentProfile->paymentProfileId = $cardRef->getPaymentProfileId();

if ($shippingProfileId = $cardRef->getShippingProfileId()) {
Expand Down
41 changes: 33 additions & 8 deletions src/Message/CIMCreateCardRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,42 @@ protected function addBillingData(\SimpleXMLElement $data)
/** @var CreditCard $card */
if ($card = $this->getCard()) {
$req = $data->addChild('billTo');

// A card is present, so include billing details
$req->firstName = $card->getBillingFirstName();
$req->lastName = $card->getBillingLastName();
$req->company = $card->getBillingCompany();
$req->address = trim($card->getBillingAddress1() . " \n" . $card->getBillingAddress2());
$req->city = $card->getBillingCity();
$req->state = $card->getBillingState();
$req->zip = $card->getBillingPostcode();
$req->country = $card->getBillingCountry();
if ($card->getBillingFirstName()) {
$req->firstName = $card->getBillingFirstName();
}

if ($card->getBillingLastName()) {
$req->lastName = $card->getBillingLastName();
}

if ($card->getBillingCompany()) {
$req->company = $card->getBillingCompany();
}

if ($card->getBillingAddress1()) {
$req->address = trim($card->getBillingAddress1() . " \n" . $card->getBillingAddress2());
}

if ($card->getBillingCity()) {
$req->city = $card->getBillingCity();
}

if ($card->getBillingState()) {
$req->state = $card->getBillingState();
}

if ($card->getBillingPostcode()) {
$req->zip = $card->getBillingPostcode();
}

if ($card->getBillingCountry()) {
$req->country = $card->getBillingCountry();
}

$defaultBillTo = $this->getParameter('defaultBillTo');

if (is_array($defaultBillTo)) {
// A configuration parameter to populate billTo has been specified
foreach ($defaultBillTo as $field => $value) {
Expand Down
4 changes: 4 additions & 0 deletions src/Message/CIMDeletePaymentProfileRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class CIMDeletePaymentProfileRequest extends CIMAbstractRequest

public function getData()
{
$cardRef = $this->getCardReference(false);
$this->setCustomerProfileId($cardRef->getCustomerProfileId());
$this->setCustomerPaymentProfileId($cardRef->getPaymentProfileId());

$this->validate('customerProfileId', 'customerPaymentProfileId');

$data = $this->getBaseData();
Expand Down
13 changes: 13 additions & 0 deletions src/Message/CIMUpdatePaymentProfileRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ class CIMUpdatePaymentProfileRequest extends CIMCreatePaymentProfileRequest

public function getData()
{
$cardReference = $this->getCardReference(false);

// If the customer profile and the cusromer payment profile is NOT
// already set directly, then pull both these from the car reference object.

if (! $this->getCustomerProfileId()) {
$this->setCustomerProfileId($cardReference->getCustomerProfileId());
}

if (! $this->getCustomerPaymentProfileId()) {
$this->setCustomerPaymentProfileId($cardReference->getPaymentProfileId());
}

$this->validate('card', 'customerProfileId', 'customerPaymentProfileId');

/** @var CreditCard $card */
Expand Down