Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

39: Added data type for CustomerDataType #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
14 changes: 14 additions & 0 deletions src/DataTypes/Customer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace CommerceGuys\AuthNet\DataTypes;

class Customer extends BaseDataType
{
protected $propertyMap = [
'type',
'id',
'email',
'driversLicense',
'taxId',
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use CommerceGuys\AuthNet\DataTypes\Order;
use CommerceGuys\AuthNet\DataTypes\CreditCard;
use CommerceGuys\AuthNet\DataTypes\BankAccount;
use CommerceGuys\AuthNet\DataTypes\Customer;
use CommerceGuys\AuthNet\DataTypes\TransactionRequest;

abstract class CreateTransactionRequestTestBase extends TestBase {
Expand All @@ -31,6 +32,9 @@ protected function createChargableTransactionRequest($type, $cardNum = '41111111
$transactionRequest->addOrder(new Order([
'invoiceNumber' => 'INV-' . rand(10, 100),
]));
$transactionRequest->addDataType(new Customer([
'email' => '[email protected]',
]));

return $transactionRequest;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/CreateTransactionRequest/RefundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
namespace CommerceGuys\AuthNet\Tests\CreateTransactionRequest;

use CommerceGuys\AuthNet\DataTypes\CreditCard;
use CommerceGuys\AuthNet\DataTypes\Customer;
use CommerceGuys\AuthNet\DataTypes\TransactionRequest;


class RefundTest extends CreateTransactionRequestTestBase
{

Expand All @@ -31,6 +33,9 @@ public function testRefundTransaction()
'cardNumber' => 'XXXX1111',
'expirationDate' => 'XXXX',
]));
$transactionRequest->addDataType(new Customer([
'email' => '[email protected]',
]));

sleep(4);
$this->assertTrue(isset($response->transactionResponse));
Expand Down
Loading