Skip to content

Commit 112719b

Browse files
committed
feat: add callback to api
1 parent 1c87d72 commit 112719b

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

Api/GraphqlInterface.php

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ interface GraphqlInterface
1111
*/
1212
public function graphql();
1313

14+
/**
15+
* Get callback
16+
* @return string
17+
* @api
18+
*/
19+
public function callback();
20+
1421
/**
1522
* Cors check
1623
* @return array

Model/Api/Resolver/Store/Checkout.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,14 @@ public function confirmOrder()
541541
];
542542
}
543543

544-
public function callback() {
544+
public function callback($args) {
545+
$body = $args['body'];
546+
$orderId = $args['orderId'];
547+
$status = $body['status'];
548+
$this->response->setOutput([
549+
'orderId' => $orderId,
550+
'status' => $status
551+
]);
545552

546553
}
547554

Model/Api/System/Startup.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ public function start($body, $driver)
4242
/**
4343
* @param $body
4444
* @param $driver \Magento\Framework\Filesystem\Driver\File
45+
* @param $orderId
4546
*/
46-
public function callback($body, $driver)
47+
public function callback($body, $driver, $orderId)
4748
{
48-
$this->loader->resolver('store/checkout/callback', $body);
49+
$this->loader->resolver('store/checkout/callback', array('body' => $body, 'orderId' => $orderId));
4950

5051
return $this->registry->get('response')->getOutput();
5152
}

Model/GraphqlModel.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public function callback()
8888
->getValue('vuefront/general/enable', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
8989

9090
if ($enable) {
91-
$output = $this->startup->start($this->request->getBodyParams(), $this->driver);
91+
92+
$output = $this->startup->callback($this->request->getBodyParams(), $this->driver, $this->request->getQueryValue('order_id'));
9293

9394
return $output;
9495
} else {

0 commit comments

Comments
 (0)