-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/refactor-discussion-search-pagination
- Loading branch information
Showing
186 changed files
with
932 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Libraries\Payments\PaypalApiContext; | ||
use App\Models\Store\Order; | ||
use Illuminate\Console\Command; | ||
use PayPalCheckoutSdk\Orders\OrdersGetRequest; | ||
|
||
class StoreGetPaypalOrder extends Command | ||
{ | ||
protected $signature = 'store:get-paypal-order {orderId}'; | ||
|
||
protected $description = 'Gets order info from paypal.'; | ||
|
||
public function handle() | ||
{ | ||
$order = Order::findOrFail(get_int($this->argument('orderId'))); | ||
if ($order->provider !== 'paypal') { | ||
$this->error('Not a Paypal order'); | ||
return static::INVALID; | ||
} | ||
|
||
$paypalOrderId = $order->reference; | ||
if ($paypalOrderId === null) { | ||
$this->error('Missing Paypal order id'); | ||
return static::INVALID; | ||
} | ||
|
||
$this->comment("Getting details for Order {$order->getKey()}, Paypal Id: {$paypalOrderId}"); | ||
$client = PaypalApiContext::client(); | ||
$response = $client->execute(new OrdersGetRequest($paypalOrderId)); | ||
|
||
$this->line(json_encode((array) $response->result, JSON_PRETTY_PRINT)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\Store\Order; | ||
use Illuminate\Console\Command; | ||
use Shopify\ApiVersion; | ||
use Shopify\Auth\FileSessionStorage; | ||
use Shopify\Clients\Storefront; | ||
use Shopify\Context; | ||
|
||
class StoreGetShopifyCheckout extends Command | ||
{ | ||
protected $signature = 'store:get-shopify-checkout {orderId}'; | ||
|
||
protected $description = 'Gets checkout info from shopify.'; | ||
|
||
public function handle() | ||
{ | ||
$order = Order::findOrFail(get_int($this->argument('orderId'))); | ||
if ($order->provider !== 'shopify') { | ||
$this->error('Not a Shopify order'); | ||
return static::INVALID; | ||
} | ||
|
||
$this->comment("Getting details for Order {$order->getKey()}"); | ||
$this->comment($order->reference); | ||
|
||
Context::initialize( | ||
// public unauthenticated Storefront API doesn't need OAuth and we can't use blanks. | ||
'unauthenticated_only', | ||
'unauthenticated_only', | ||
'unauthenticated_read_checkouts', | ||
$GLOBALS['cfg']['store']['shopify']['domain'], | ||
new FileSessionStorage(), | ||
ApiVersion::APRIL_2023, | ||
); | ||
|
||
$client = new Storefront( | ||
$GLOBALS['cfg']['store']['shopify']['domain'], | ||
$GLOBALS['cfg']['store']['shopify']['storefront_token'], | ||
); | ||
|
||
$id = '"'.$order->reference.'"'; | ||
$query = <<<QUERY | ||
{ | ||
node(id: $id) { | ||
... on Checkout { | ||
id | ||
ready | ||
webUrl | ||
orderStatusUrl | ||
completedAt | ||
createdAt | ||
updatedAt | ||
order { | ||
id | ||
processedAt | ||
orderNumber | ||
} | ||
} | ||
} | ||
} | ||
QUERY; | ||
|
||
$response = $client->query($query); | ||
$body = $response->getDecodedBody() ?? ''; | ||
$this->line(is_array($body) ? json_encode($body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : $body); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Exceptions\Store; | ||
|
||
class PaymentRejectedException extends OrderException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.