From 53ca5a06ac2358af76b13050c8388c5a6fa8d0c7 Mon Sep 17 00:00:00 2001 From: Andyg5000 Date: Fri, 20 Sep 2024 14:48:10 -0400 Subject: [PATCH] 39: Added data type for CustomerDataType including updates to test request. --- src/DataTypes/Customer.php | 14 ++++++++++++++ .../CreateTransactionRequestTestBase.php | 4 ++++ tests/CreateTransactionRequest/RefundTest.php | 5 +++++ 3 files changed, 23 insertions(+) create mode 100644 src/DataTypes/Customer.php diff --git a/src/DataTypes/Customer.php b/src/DataTypes/Customer.php new file mode 100644 index 0000000..9c40537 --- /dev/null +++ b/src/DataTypes/Customer.php @@ -0,0 +1,14 @@ +addOrder(new Order([ 'invoiceNumber' => 'INV-' . rand(10, 100), ])); + $transactionRequest->addDataType(new Customer([ + 'email' => 'bojangles@example.net', + ])); return $transactionRequest; } diff --git a/tests/CreateTransactionRequest/RefundTest.php b/tests/CreateTransactionRequest/RefundTest.php index ae1e834..7dac112 100644 --- a/tests/CreateTransactionRequest/RefundTest.php +++ b/tests/CreateTransactionRequest/RefundTest.php @@ -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 { @@ -31,6 +33,9 @@ public function testRefundTransaction() 'cardNumber' => 'XXXX1111', 'expirationDate' => 'XXXX', ])); + $transactionRequest->addDataType(new Customer([ + 'email' => 'bojangles@example.net', + ])); sleep(4); $this->assertTrue(isset($response->transactionResponse));