Skip to content

Commit 7396025

Browse files
author
Frederic Minot
committed
Added prefix ability
1 parent d47c973 commit 7396025

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

Api/Service.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function generateInvoice($orderId, $paymentIntentId)
9999
}
100100
}
101101

102-
public function setQuoteAddresses($shippingAddress, $email, $quote)
102+
public function setQuoteAddresses($shippingAddress, $email, $quote, $customer)
103103
{
104104
$name = $shippingAddress['name'];
105105
$phoneNumber = $shippingAddress['phoneNumber'];
@@ -124,6 +124,7 @@ public function setQuoteAddresses($shippingAddress, $email, $quote)
124124
$names = $this->getNames($name);
125125
$shippingAddress->setFirstname($names[0]);
126126
$shippingAddress->setLastname($names[1]);
127+
$shippingAddress->setPrefix($customer->getPrefix());
127128
$shippingAddress->setTelephone($phoneNumber);
128129
$shippingAddress->setCity($locality);
129130
$shippingAddress->setRegionCode($administrativeArea);
@@ -153,10 +154,11 @@ private static function rand_string($length) {
153154
* @param string $shallCreate
154155
* @param string $sid
155156
* @param string $quoteId
157+
* @param string $prefix
156158
*
157159
* @return string
158160
*/
159-
public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptionId, $paymentMethod, $email, $shallCreate, $sid, $quoteId)
161+
public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptionId, $paymentMethod, $email, $shallCreate, $sid, $quoteId, $prefix)
160162
{
161163
$redirectUrl = $this->urlBuilder->getUrl('checkout/onepage/failure', ['_secure' => true]);
162164
try{
@@ -185,6 +187,7 @@ public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptio
185187
->setPassword($this->rand_string(12))
186188
->setFirstname($names[0])
187189
->setLastname($names[1])
190+
->setPrefix($prefix)
188191
->save();
189192
$this->customerSession->setCustomerAsLoggedIn($customer);
190193
$customerId = true;
@@ -221,7 +224,7 @@ public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptio
221224
}
222225

223226
$quote->reserveOrderId()->save();
224-
$this->setQuoteAddresses($shippingAddress, $email, $quote);
227+
$this->setQuoteAddresses($shippingAddress, $email, $quote, $customer);
225228
$quote->getShippingAddress()->setShippingMethod($shippingOptionId);
226229
$this->shippingRate
227230
->setCode($shippingOptionId)

Api/ServiceInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ interface ServiceInterface
1717
* @param string $shallCreate
1818
* @param string $sid
1919
* @param string $maskedQuoteId
20+
* @param string $prefix
2021
* @return mixed Json Object
2122
*/
22-
public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptionId, $paymentMethod, $email, $shallCreate, $sid ,$quoteId);
23+
public function orderPostMethod($shippingAddress,$paymentIntentId,$shippingOptionId, $paymentMethod, $email, $shallCreate, $sid ,$quoteId, $prefix);
2324

2425
/**
2526
* POST for Paywax Wallet api

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ There is NO configuration to be done in the Magento interface, please contact us
88

99
## Changelog
1010

11+
### v1.0.2105041539
12+
Added prefix to account creation
13+
1114
### v1.0.2104091504
1215
First release

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"php": "~7.1.3||~7.2.0||~7.3.0||~7.4.0"
66
},
77
"type": "magento2-module",
8-
"version": "1.0.2104091504",
8+
"version": "1.0.2105041539",
99
"license": [
1010
"OSL-3.0"
1111
],

0 commit comments

Comments
 (0)