Skip to content

Commit

Permalink
Fix incorrect handling of userFields in response.
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed Jun 22, 2019
1 parent 28ad913 commit 711d1f1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/Request/Model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
namespace Academe\AuthorizeNet\Request\Model;

/**
*
* FIXME: the driversLicense is an object, not a scalar.
* See https://github.com/academe/authorizenet-objects/issues/10
*/

use Academe\AuthorizeNet\TransactionRequestInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Response/Collections/UserFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(array $data = [])
$this->setData($data);

// An array of userField records.
foreach ($this->getDataValue('userField') as $userField_data) {
foreach ($data as $userField_data) {
$this->push(new UserField($userField_data));
}
}
Expand Down
13 changes: 0 additions & 13 deletions src/Response/Model/UserField

This file was deleted.

27 changes: 27 additions & 0 deletions src/Response/Model/UserField.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Academe\AuthorizeNet\Response\Model;

/**
* The Response UserField is identical to the Request UserField.
*/

use Academe\AuthorizeNet\Request\Model\UserField as RequestUserField;

class UserField extends RequestUserField
{
public function __construct(
$name,
$value = null
) {
if (is_string($name) && is_string($value)) {
parent::__construct($name, $value);
}

if (is_array($name) && is_null($value)) {
parent::__construct($name['name'], $name['value']);
}
}
}


2 changes: 1 addition & 1 deletion tests/ServerRequest/NotificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Academe\AuthorizeNet\ServerRequest;

/**
*
* The notification webhook.
*/

use PHPUnit\Framework\TestCase;
Expand Down

0 comments on commit 711d1f1

Please sign in to comment.