application.services.php
6 months ago
command.bus.php
2 years ago
container.php
6 months ago
domain.event.bus.php
1 year ago
domain.services.php
1 year ago
infrastructure.services.php
4 months ago
infrastructure.user.php
1 year ago
repositories.php
6 months ago
request.php
6 months ago
request.php
56 lines
| 1 | <?php |
| 2 | |
| 3 | use Slim\Http\Request; |
| 4 | use Slim\Http\Uri; |
| 5 | |
| 6 | $entries['request'] = function (AmeliaBooking\Infrastructure\Common\Container $c) { |
| 7 | |
| 8 | $curUri = Uri::createFromEnvironment($c->get('environment')); |
| 9 | |
| 10 | // fix callback url for Razorpay payment through link since Razorpay encodes callback urls |
| 11 | $newRoute = str_replace( |
| 12 | '__payments__callback', |
| 13 | '/payments/callback', |
| 14 | $curUri->getQuery() |
| 15 | ); |
| 16 | |
| 17 | // fix callback url for whatsapp webhooks |
| 18 | $newRoute = str_replace( |
| 19 | '__notifications__whatsapp__webhook', |
| 20 | '/notifications/whatsapp/webhook', |
| 21 | $newRoute |
| 22 | ); |
| 23 | |
| 24 | $newRoute = str_replace( |
| 25 | ['XDEBUG_SESSION_START=PHPSTORM&' . AMELIA_ACTION_SLUG, AMELIA_ACTION_SLUG], |
| 26 | '', |
| 27 | $newRoute |
| 28 | ); |
| 29 | |
| 30 | $newPath = strpos($newRoute, '&') ? substr( |
| 31 | $newRoute, |
| 32 | 0, |
| 33 | strpos($newRoute, '&') |
| 34 | ) : $newRoute; |
| 35 | |
| 36 | $newQuery = strpos($newRoute, '&') ? substr( |
| 37 | $newRoute, |
| 38 | strpos($newRoute, '&') + 1 |
| 39 | ) : ''; |
| 40 | |
| 41 | $request = Request::createFromEnvironment($c->get('environment')) |
| 42 | ->withUri( |
| 43 | $curUri |
| 44 | ->withPath($newPath) |
| 45 | ->withQuery($newQuery) |
| 46 | ); |
| 47 | |
| 48 | if (method_exists($request, 'getParam') && $request->getParam('showAmeliaErrors')) { |
| 49 | ini_set('display_errors', 1); |
| 50 | ini_set('display_startup_errors', 1); |
| 51 | error_reporting(E_ALL); |
| 52 | } |
| 53 | |
| 54 | return $request; |
| 55 | }; |
| 56 |