diff --git a/Gateway/Request/CompanyDataBuilder.php b/Gateway/Request/CompanyDataBuilder.php
new file mode 100644
index 0000000000..2425ca24c3
--- /dev/null
+++ b/Gateway/Request/CompanyDataBuilder.php
@@ -0,0 +1,45 @@
+
+ */
+
+namespace Adyen\Payment\Gateway\Request;
+
+use Magento\Payment\Gateway\Data\PaymentDataObject;
+use Magento\Payment\Gateway\Helper\SubjectReader;
+use Magento\Payment\Gateway\Request\BuilderInterface;
+use Magento\Sales\Model\Order;
+
+class CompanyDataBuilder implements BuilderInterface
+{
+ public function build(array $buildSubject): array
+ {
+ /** @var PaymentDataObject $paymentDataObject */
+ $paymentDataObject = SubjectReader::readPayment($buildSubject);
+ $payment = $paymentDataObject->getPayment();
+ /** @var Order $order */
+ $order = $payment->getOrder();
+ $billingAddress = $order->getBillingAddress();
+ $company = [];
+
+ if (!empty($billingAddress->getVatId())) {
+ $company['taxId'] = $billingAddress->getVatId();
+ }
+
+ if (!empty($billingAddress->getCompany())) {
+ $company['name'] = $billingAddress->getCompany();
+ }
+
+ return [
+ 'body' => [
+ 'company' => $company
+ ]
+ ];
+ }
+}
diff --git a/Test/Unit/Gateway/Request/CompanyDataBuilderTest.php b/Test/Unit/Gateway/Request/CompanyDataBuilderTest.php
new file mode 100644
index 0000000000..f6c3f6347d
--- /dev/null
+++ b/Test/Unit/Gateway/Request/CompanyDataBuilderTest.php
@@ -0,0 +1,58 @@
+
+ */
+
+namespace Adyen\Payment\Test\Gateway\Request;
+
+use Adyen\Payment\Gateway\Request\CompanyDataBuilder;
+use Adyen\Payment\Test\Unit\AbstractAdyenTestCase;
+use Magento\Payment\Gateway\Data\PaymentDataObject;
+use Magento\Sales\Api\Data\OrderAddressInterface;
+use Magento\Sales\Model\Order;
+use Magento\Sales\Model\Order\Payment;
+
+class CompanyDataBuilderTest extends AbstractAdyenTestCase
+{
+ /**
+ * @return void
+ */
+ function testBuild()
+ {
+ $companyName = 'Adyen';
+ $vatId = 'NL-123456789';
+
+ $billingAddressMock = $this->createMock(OrderAddressInterface::class);
+ $billingAddressMock->expects($this->exactly(2))
+ ->method('getCompany')
+ ->willReturn('Adyen');
+ $billingAddressMock->expects($this->exactly(2))
+ ->method('getVatId')
+ ->willReturn($vatId);
+
+ $orderMock = $this->createMock(Order::class);
+ $orderMock->expects($this->once())
+ ->method('getBillingAddress')
+ ->willReturn($billingAddressMock);
+
+ $paymentMock = $this->createMock(Payment::class);
+ $paymentMock->method('getOrder')->willReturn($orderMock);
+
+ $buildSubject = [
+ 'payment' => $this->createConfiguredMock(PaymentDataObject::class, [
+ 'getPayment' => $paymentMock
+ ])
+ ];
+
+ $builder = new CompanyDataBuilder();
+ $result = $builder->build($buildSubject);
+
+ $this->assertEquals(['body' => ['company' => ['name' => $companyName, 'taxId' => $vatId]]], $result);
+ }
+}
diff --git a/etc/di.xml b/etc/di.xml
index e7fc019f4f..e7369bb61b 100755
--- a/etc/di.xml
+++ b/etc/di.xml
@@ -1081,6 +1081,7 @@
- Adyen\Payment\Gateway\Request\OriginDataBuilder
- Adyen\Payment\Gateway\Request\Header\HeaderDataBuilder
- Adyen\Payment\Gateway\Request\GiftcardDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder
@@ -1098,6 +1099,7 @@
- Adyen\Payment\Gateway\Request\ShopperInteractionDataBuilder
- Adyen\Payment\Gateway\Request\ChannelDataBuilder
- Adyen\Payment\Gateway\Request\OriginDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder
@@ -1114,6 +1116,7 @@
- Adyen\Payment\Gateway\Request\DescriptionDataBuilder
- Adyen\Payment\Gateway\Request\CheckoutDataBuilder
- Adyen\Payment\Gateway\Request\Header\HeaderDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder
@@ -1135,6 +1138,7 @@
- Adyen\Payment\Gateway\Request\ShopperInteractionDataBuilder
- Adyen\Payment\Gateway\Request\Header\HeaderDataBuilder
- Adyen\Payment\Gateway\Request\GiftcardDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder
@@ -1155,6 +1159,7 @@
- Adyen\Payment\Gateway\Request\ShopperInteractionDataBuilder
- Adyen\Payment\Gateway\Request\Header\HeaderDataBuilder
- Adyen\Payment\Gateway\Request\GiftcardDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder
@@ -1206,6 +1211,7 @@
- Adyen\Payment\Gateway\Request\ChannelDataBuilder
- Adyen\Payment\Gateway\Request\OriginDataBuilder
- Adyen\Payment\Gateway\Request\GiftcardDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder
@@ -1226,6 +1232,7 @@
- Adyen\Payment\Gateway\Request\ChannelDataBuilder
- Adyen\Payment\Gateway\Request\OriginDataBuilder
- Adyen\Payment\Gateway\Request\GiftcardDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder
@@ -1254,6 +1261,7 @@
- Adyen\Payment\Gateway\Request\ChannelDataBuilder
- Adyen\Payment\Gateway\Request\OriginDataBuilder
- Adyen\Payment\Gateway\Request\GiftcardDataBuilder
+ - Adyen\Payment\Gateway\Request\CompanyDataBuilder