Skip to content

Commit 5b1cd92

Browse files
asavaleMetaAmeya Savalesol-loup
authored
Handle phone number (#689)
* populate address information if it is missing * update comments * fix static analysis issues * add phone number to shipping address, and make discount nullable in product item * poopulate phone number * remove phone from phpdocs --------- Co-authored-by: Ameya Savale <[email protected]> Co-authored-by: Paul Kang <[email protected]>
1 parent fc62eab commit 5b1cd92

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

app/code/Meta/BusinessExtension/Model/Api/CustomApiKey/Authenticator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ class Authenticator
4545
/**
4646
* Authenticator constructor
4747
*
48-
* @param ScopeConfigInterface $scopeConfig
49-
* @param Http $httpRequest
50-
* @param SystemConfig $systemConfig
48+
* @param ScopeConfigInterface $scopeConfig
49+
* @param Http $httpRequest
50+
* @param SystemConfig $systemConfig
5151
*/
5252
public function __construct(
53-
ScopeConfigInterface $scopeConfig,
54-
Http $httpRequest,
55-
SystemConfig $systemConfig
53+
ScopeConfigInterface $scopeConfig,
54+
Http $httpRequest,
55+
SystemConfig $systemConfig
5656
) {
5757
$this->scopeConfig = $scopeConfig;
5858
$this->httpRequest = $httpRequest;

app/code/Meta/Sales/Api/Data/CreateOrderApiProductItemInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ public function setQuantity(int $quantity): CreateOrderApiProductItemInterface;
158158
/**
159159
* Get discount
160160
*
161-
* @return \Meta\Sales\Api\Data\CreateOrderApiDiscountInterface
161+
* @return \Meta\Sales\Api\Data\CreateOrderApiDiscountInterface | null
162162
*/
163-
public function getDiscount(): CreateOrderApiDiscountInterface;
163+
public function getDiscount(): ?CreateOrderApiDiscountInterface;
164164

165165
/**
166166
* Set discount

app/code/Meta/Sales/Model/Api/CreateOrderApi.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ private function populateAddress(
302302
if (!$address->getLastname()) {
303303
$address->setLastname($metaAddressInfo->getLastname());
304304
}
305+
306+
if (!$address->getTelephone()) {
307+
$address->setTelephone($metaAddressInfo->getTelephone());
308+
}
305309
}
306310

307311
/**
@@ -477,6 +481,9 @@ public function createOrder(
477481
'email' => $email,
478482
'firstName' => $firstName,
479483
'lastName' => $lastName,
484+
'productItems' => $productItems,
485+
'shipmentDetails' => $shipmentDetails,
486+
'billingAddress' => $billingAddress,
480487
'channel' => $channel,
481488
'buyerRemarketingOptIn' => $buyerRemarketingOptIn,
482489
'createInvoice' => $createInvoice

app/code/Meta/Sales/Model/Api/Data/CreateOrderApiProductItem.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getName(): string
4040
/**
4141
* Sets the name of the product item.
4242
*
43-
* @param string $name
43+
* @param string $name
4444
* @return CreateOrderApiProductItemInterface
4545
*/
4646
public function setName(string $name): CreateOrderApiProductItemInterface
@@ -61,7 +61,7 @@ public function getSku(): string
6161
/**
6262
* Sets the SKU of the product item.
6363
*
64-
* @param string $sku
64+
* @param string $sku
6565
* @return CreateOrderApiProductItemInterface
6666
*/
6767
public function setSku(string $sku): CreateOrderApiProductItemInterface
@@ -82,7 +82,7 @@ public function getPerUnitBasePrice(): float
8282
/**
8383
* Sets the per unit base price of the product item.
8484
*
85-
* @param float $perUnitBasePrice
85+
* @param float $perUnitBasePrice
8686
* @return CreateOrderApiProductItemInterface
8787
*/
8888
public function setPerUnitBasePrice(float $perUnitBasePrice): CreateOrderApiProductItemInterface
@@ -103,7 +103,7 @@ public function getNetPrice(): float
103103
/**
104104
* Sets the net price of the product item.
105105
*
106-
* @param float $netPrice
106+
* @param float $netPrice
107107
* @return CreateOrderApiProductItemInterface
108108
*/
109109
public function setNetPrice(float $netPrice): CreateOrderApiProductItemInterface
@@ -124,7 +124,7 @@ public function getSubTotalPrice(): float
124124
/**
125125
* Sets the subtotal price of the product item.
126126
*
127-
* @param float $subTotalPrice
127+
* @param float $subTotalPrice
128128
* @return CreateOrderApiProductItemInterface
129129
*/
130130
public function setSubTotalPrice(float $subTotalPrice): CreateOrderApiProductItemInterface
@@ -145,7 +145,7 @@ public function getTax(): float
145145
/**
146146
* Sets the tax amount of the product item.
147147
*
148-
* @param float $tax
148+
* @param float $tax
149149
* @return CreateOrderApiProductItemInterface
150150
*/
151151
public function setTax(float $tax): CreateOrderApiProductItemInterface
@@ -166,7 +166,7 @@ public function getTaxRate(): float
166166
/**
167167
* Sets the tax rate of the product item.
168168
*
169-
* @param float $taxRate
169+
* @param float $taxRate
170170
* @return CreateOrderApiProductItemInterface
171171
*/
172172
public function setTaxRate(float $taxRate): CreateOrderApiProductItemInterface
@@ -187,7 +187,7 @@ public function getQuantity(): int
187187
/**
188188
* Sets the quantity of the product item.
189189
*
190-
* @param int $quantity
190+
* @param int $quantity
191191
* @return CreateOrderApiProductItemInterface
192192
*/
193193
public function setQuantity(int $quantity): CreateOrderApiProductItemInterface
@@ -198,17 +198,17 @@ public function setQuantity(int $quantity): CreateOrderApiProductItemInterface
198198
/**
199199
* Retrieves the discount applied to the product item.
200200
*
201-
* @return CreateOrderApiDiscountInterface
201+
* @return CreateOrderApiDiscountInterface | null
202202
*/
203-
public function getDiscount(): CreateOrderApiDiscountInterface
203+
public function getDiscount(): ?CreateOrderApiDiscountInterface
204204
{
205205
return $this->_getData(self::DATA_DISCOUNT);
206206
}
207207

208208
/**
209209
* Sets the discount applied to the product item.
210210
*
211-
* @param CreateOrderApiDiscountInterface $discount
211+
* @param CreateOrderApiDiscountInterface $discount
212212
* @return CreateOrderApiProductItemInterface
213213
*/
214214
public function setDiscount(CreateOrderApiDiscountInterface $discount): CreateOrderApiProductItemInterface

0 commit comments

Comments
 (0)