7
7
8
8
namespace Magento \QuoteGraphQl \Model \Cart ;
9
9
10
- use Magento \CustomerGraphQl \Model \Customer \Address \GetCustomerAddress ;
11
10
use Magento \CustomerGraphQl \Model \Customer \GetCustomer ;
11
+ use Magento \Framework \GraphQl \Exception \GraphQlAuthenticationException ;
12
+ use Magento \Framework \GraphQl \Exception \GraphQlAuthorizationException ;
12
13
use Magento \Framework \GraphQl \Exception \GraphQlInputException ;
13
14
use Magento \Framework \GraphQl \Exception \GraphQlNoSuchEntityException ;
14
15
use Magento \Framework \GraphQl \Query \Resolver \ContextInterface ;
@@ -29,11 +30,6 @@ class SetBillingAddressOnCart
29
30
*/
30
31
private $ getCustomer ;
31
32
32
- /**
33
- * @var GetCustomerAddress
34
- */
35
- private $ getCustomerAddress ;
36
-
37
33
/**
38
34
* @var AssignBillingAddressToCart
39
35
*/
@@ -42,18 +38,15 @@ class SetBillingAddressOnCart
42
38
/**
43
39
* @param QuoteAddressFactory $quoteAddressFactory
44
40
* @param GetCustomer $getCustomer
45
- * @param GetCustomerAddress $getCustomerAddress
46
41
* @param AssignBillingAddressToCart $assignBillingAddressToCart
47
42
*/
48
43
public function __construct (
49
44
QuoteAddressFactory $ quoteAddressFactory ,
50
45
GetCustomer $ getCustomer ,
51
- GetCustomerAddress $ getCustomerAddress ,
52
46
AssignBillingAddressToCart $ assignBillingAddressToCart
53
47
) {
54
48
$ this ->quoteAddressFactory = $ quoteAddressFactory ;
55
49
$ this ->getCustomer = $ getCustomer ;
56
- $ this ->getCustomerAddress = $ getCustomerAddress ;
57
50
$ this ->assignBillingAddressToCart = $ assignBillingAddressToCart ;
58
51
}
59
52
@@ -65,6 +58,8 @@ public function __construct(
65
58
* @param array $billingAddressInput
66
59
* @return void
67
60
* @throws GraphQlInputException
61
+ * @throws GraphQlAuthenticationException
62
+ * @throws GraphQlAuthorizationException
68
63
* @throws GraphQlNoSuchEntityException
69
64
*/
70
65
public function execute (ContextInterface $ context , CartInterface $ cart , array $ billingAddressInput ): void
@@ -97,8 +92,10 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
97
92
$ billingAddress = $ this ->quoteAddressFactory ->createBasedOnInputData ($ addressInput );
98
93
} else {
99
94
$ customer = $ this ->getCustomer ->execute ($ context );
100
- $ customerAddress = $ this ->getCustomerAddress ->execute ((int )$ customerAddressId , (int )$ customer ->getId ());
101
- $ billingAddress = $ this ->quoteAddressFactory ->createBasedOnCustomerAddress ($ customerAddress );
95
+ $ billingAddress = $ this ->quoteAddressFactory ->createBasedOnCustomerAddress (
96
+ (int )$ customerAddressId ,
97
+ (int )$ customer ->getId ()
98
+ );
102
99
}
103
100
104
101
$ this ->assignBillingAddressToCart ->execute ($ cart , $ billingAddress , $ useForShipping );
0 commit comments