Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-braintree
Gateway
Request
AddressDataBuilder.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Braintree\Gateway\Request
;
7
8
use
Magento\Payment\Gateway\Request\BuilderInterface
;
9
use
Magento\Braintree\Gateway\SubjectReader
;
10
14
class
AddressDataBuilder
implements
BuilderInterface
15
{
19
const
SHIPPING_ADDRESS
=
'shipping'
;
20
24
const
BILLING_ADDRESS
=
'billing'
;
25
29
const
FIRST_NAME
=
'firstName'
;
30
34
const
LAST_NAME
=
'lastName'
;
35
39
const
COMPANY
=
'company'
;
40
45
const
STREET_ADDRESS
=
'streetAddress'
;
46
50
const
EXTENDED_ADDRESS
=
'extendedAddress'
;
51
55
const
LOCALITY
=
'locality'
;
56
61
const
REGION
=
'region'
;
62
68
const
POSTAL_CODE
=
'postalCode'
;
69
76
const
COUNTRY_CODE
=
'countryCodeAlpha2'
;
77
81
private
$subjectReader;
82
88
public
function
__construct
(
SubjectReader
$subjectReader)
89
{
90
$this->subjectReader = $subjectReader;
91
}
92
96
public
function
build
(array $buildSubject)
97
{
98
$paymentDO = $this->subjectReader->readPayment($buildSubject);
99
100
$order
= $paymentDO->getOrder();
101
$result
= [];
102
103
$billingAddress
=
$order
->getBillingAddress();
104
if
(
$billingAddress
) {
105
$result
[
self::BILLING_ADDRESS
] = [
106
self::FIRST_NAME =>
$billingAddress
->getFirstname(),
107
self::LAST_NAME =>
$billingAddress
->getLastname(),
108
self::COMPANY =>
$billingAddress
->getCompany(),
109
self::STREET_ADDRESS =>
$billingAddress
->getStreetLine1(),
110
self::EXTENDED_ADDRESS =>
$billingAddress
->getStreetLine2(),
111
self::LOCALITY =>
$billingAddress
->getCity(),
112
self::REGION =>
$billingAddress
->getRegionCode(),
113
self::POSTAL_CODE =>
$billingAddress
->getPostcode(),
114
self::COUNTRY_CODE =>
$billingAddress
->getCountryId()
115
];
116
}
117
118
$shippingAddress
=
$order
->getShippingAddress();
119
if
(
$shippingAddress
) {
120
$result
[
self::SHIPPING_ADDRESS
] = [
121
self::FIRST_NAME =>
$shippingAddress
->getFirstname(),
122
self::LAST_NAME =>
$shippingAddress
->getLastname(),
123
self::COMPANY =>
$shippingAddress
->getCompany(),
124
self::STREET_ADDRESS =>
$shippingAddress
->getStreetLine1(),
125
self::EXTENDED_ADDRESS =>
$shippingAddress
->getStreetLine2(),
126
self::LOCALITY =>
$shippingAddress
->getCity(),
127
self::REGION =>
$shippingAddress
->getRegionCode(),
128
self::POSTAL_CODE =>
$shippingAddress
->getPostcode(),
129
self::COUNTRY_CODE =>
$shippingAddress
->getCountryId()
130
];
131
}
132
133
return
$result
;
134
}
135
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Braintree\Gateway\Request\AddressDataBuilder\SHIPPING_ADDRESS
const SHIPPING_ADDRESS
Definition:
AddressDataBuilder.php:19
Magento\Braintree\Gateway\Request\AddressDataBuilder\build
build(array $buildSubject)
Definition:
AddressDataBuilder.php:96
Magento\Braintree\Gateway\Request\AddressDataBuilder\__construct
__construct(SubjectReader $subjectReader)
Definition:
AddressDataBuilder.php:88
$billingAddress
$billingAddress
Definition:
order.php:25
Magento\Braintree\Gateway\Request
Definition:
AddressDataBuilder.php:6
Magento\Braintree\Gateway\Request\AddressDataBuilder\COMPANY
const COMPANY
Definition:
AddressDataBuilder.php:39
Magento\Braintree\Gateway\Request\AddressDataBuilder\BILLING_ADDRESS
const BILLING_ADDRESS
Definition:
AddressDataBuilder.php:24
Magento\Braintree\Gateway\Request\AddressDataBuilder\POSTAL_CODE
const POSTAL_CODE
Definition:
AddressDataBuilder.php:68
$shippingAddress
$shippingAddress
Definition:
order.php:40
$order
$order
Definition:
order.php:55
Magento\Braintree\Gateway\Request\AddressDataBuilder\COUNTRY_CODE
const COUNTRY_CODE
Definition:
AddressDataBuilder.php:76
Magento\Payment\Gateway\Request\BuilderInterface
Definition:
BuilderInterface.php:14
Magento\Braintree\Gateway\Request\AddressDataBuilder
Definition:
AddressDataBuilder.php:14
Magento\Braintree\Gateway\Request\AddressDataBuilder\REGION
const REGION
Definition:
AddressDataBuilder.php:61
Magento\Braintree\Gateway\Request\AddressDataBuilder\LAST_NAME
const LAST_NAME
Definition:
AddressDataBuilder.php:34
Magento\Braintree\Gateway\Request\AddressDataBuilder\FIRST_NAME
const FIRST_NAME
Definition:
AddressDataBuilder.php:29
Magento\Braintree\Gateway\Request\AddressDataBuilder\LOCALITY
const LOCALITY
Definition:
AddressDataBuilder.php:55
Magento\Braintree\Gateway\SubjectReader
Definition:
SubjectReader.php:16
Magento\Braintree\Gateway\Request\AddressDataBuilder\EXTENDED_ADDRESS
const EXTENDED_ADDRESS
Definition:
AddressDataBuilder.php:50
Magento\Braintree\Gateway\Request\AddressDataBuilder\STREET_ADDRESS
const STREET_ADDRESS
Definition:
AddressDataBuilder.php:45