File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ manifest:
358358 tests/appsec/test_automated_login_events.py::Test_V3_Login_Events_Anon::test_login_wrong_user_failure_basic : missing_feature (Basic auth not implemented)
359359 tests/appsec/test_automated_login_events.py::Test_V3_Login_Events_Blocking : v1.8.0
360360 tests/appsec/test_automated_login_events.py::Test_V3_Login_Events_RC : v1.8.0
361- tests/appsec/test_automated_payment_events.py : missing_feature
361+ tests/appsec/test_automated_payment_events.py : v1.17.0-dev
362362 tests/appsec/test_automated_user_and_session_tracking.py::Test_Automated_Session_Blocking : missing_feature
363363 tests/appsec/test_automated_user_and_session_tracking.py::Test_Automated_User_Blocking : v1.8.0
364364 tests/appsec/test_automated_user_and_session_tracking.py::Test_Automated_User_Tracking : v1.8.0
Original file line number Diff line number Diff line change 55 "weblog/acme" : " *" ,
66 "monolog/monolog" : " *" ,
77 "openai-php/client" : " *" ,
8- "guzzlehttp/guzzle" : " *"
8+ "guzzlehttp/guzzle" : " *" ,
9+ "stripe/stripe-php" : " ^10.0"
910 },
1011 "repositories" : [
1112 {
Original file line number Diff line number Diff line change 33 "type" : " project" ,
44 "require" : {
55 "weblog/acme" : " *" ,
6- "monolog/monolog" : " *"
6+ "monolog/monolog" : " *" ,
7+ "stripe/stripe-php" : " ^10.0"
78 },
89 "repositories" : [
910 {
Original file line number Diff line number Diff line change @@ -4,6 +4,28 @@ set -eux
44
55IS_APACHE=${1:- 0}
66
7+ if [ -z " $PHP_VERSION " ]; then
8+ PHP_VERSION=$( php -r " echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" )
9+ fi
10+
11+ cd /var/www/html
12+ export COMPOSER=composer.json
13+ if [ " $( printf ' %s\n' " $PHP_VERSION " " 8.2" | sort -V | head -n1) " = " 8.2" ]; then
14+ export COMPOSER=composer.gte8.2.json
15+ fi
16+ if [ -f " $COMPOSER " ] && grep -Fq ' stripe/stripe-php' " $COMPOSER " ; then
17+ apt-get update -qq && apt-get install -y --no-install-recommends unzip
18+ if [[ " $( printf ' %s\n' " $PHP_VERSION " " 8.1" | sort -V | head -n1) " = " 8.1" ]]; then
19+ # Also require open-telemetry/sdk so composer does not remove it from vendor/:
20+ # the Dockerfile ADD overwrites composer.json with the repo version (which has
21+ # stripe but not OTel), causing a bare `composer require stripe` to drop OTel
22+ # from the resolved tree and wipe it from vendor/.
23+ COMPOSER_DISCARD_CHANGES=true composer require stripe/stripe-php " ^10.0" " open-telemetry/sdk:^1.0.0" --no-interaction --ignore-platform-req=ext-mbstring
24+ else
25+ COMPOSER_DISCARD_CHANGES=true composer require stripe/stripe-php " ^10.0" --no-interaction --ignore-platform-req=ext-mbstring
26+ fi
27+ fi
28+
729cd /binaries
830
931ARCH=$( uname -m)
Original file line number Diff line number Diff line change @@ -39,3 +39,6 @@ RewriteRule "^/exceptionreplay/(.*)$" "/debugger/exceptionreplay/$1" [QSA]
3939RewriteRule "^/llm$" "/llm/"
4040RewriteRule "^/stats-unique$" "/stats-unique/"
4141RewriteRule "^/await-agent-info$" "/await-agent-info/"
42+ RewriteRule "^/stripe/webhook$" "/stripe_webhook.php" [QSA,L]
43+ RewriteRule "^/stripe/create_checkout_session$" "/stripe_create_checkout_session.php" [QSA,L]
44+ RewriteRule "^/stripe/create_payment_intent$" "/stripe_create_payment_intent.php" [QSA,L]
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once '/var/www/html/vendor/autoload.php ' ;
4+
5+ header ('Content-Type: application/json ' );
6+
7+ try {
8+ // Configure Stripe client
9+ \Stripe \Stripe::setApiKey ('sk_FAKE ' );
10+ \Stripe \Stripe::$ apiBase = 'http://internal_server:8089 ' ;
11+
12+ // Get JSON request body
13+ $ input = file_get_contents ('php://input ' );
14+ $ data = json_decode ($ input , true );
15+
16+ if (json_last_error () !== JSON_ERROR_NONE ) {
17+ throw new Exception ('Invalid JSON: ' . json_last_error_msg ());
18+ }
19+
20+ // Create checkout session with the request body data
21+ $ result = \Stripe \Checkout \Session::create ($ data );
22+
23+ // Return the result as JSON
24+ echo json_encode ($ result );
25+ } catch (\Stripe \Exception \ApiErrorException $ e ) {
26+ http_response_code (500 );
27+ echo json_encode (['error ' => $ e ->getMessage ()]);
28+ } catch (Exception $ e ) {
29+ http_response_code (500 );
30+ echo json_encode (['error ' => $ e ->getMessage ()]);
31+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once '/var/www/html/vendor/autoload.php ' ;
4+
5+ header ('Content-Type: application/json ' );
6+
7+ try {
8+ // Configure Stripe client
9+ \Stripe \Stripe::setApiKey ('sk_FAKE ' );
10+ \Stripe \Stripe::$ apiBase = 'http://internal_server:8089 ' ;
11+
12+ // Get JSON request body
13+ $ input = file_get_contents ('php://input ' );
14+ $ data = json_decode ($ input , true );
15+
16+ if (json_last_error () !== JSON_ERROR_NONE ) {
17+ throw new Exception ('Invalid JSON: ' . json_last_error_msg ());
18+ }
19+
20+ // Create payment intent with the request body data
21+ $ result = \Stripe \PaymentIntent::create ($ data );
22+
23+ // Return the result as JSON
24+ echo json_encode ($ result );
25+ } catch (\Stripe \Exception \ApiErrorException $ e ) {
26+ http_response_code (500 );
27+ echo json_encode (['error ' => $ e ->getMessage ()]);
28+ } catch (Exception $ e ) {
29+ http_response_code (500 );
30+ echo json_encode (['error ' => $ e ->getMessage ()]);
31+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require_once '/var/www/html/vendor/autoload.php ' ;
4+
5+ header ('Content-Type: application/json ' );
6+
7+ try {
8+ // Configure Stripe client
9+ \Stripe \Stripe::setApiKey ('sk_FAKE ' );
10+ \Stripe \Stripe::$ apiBase = 'http://internal_server:8089 ' ;
11+
12+ // Get raw request body
13+ $ payload = file_get_contents ('php://input ' );
14+
15+ // Get Stripe signature from header
16+ $ sigHeader = $ _SERVER ['HTTP_STRIPE_SIGNATURE ' ] ?? '' ;
17+
18+ // Webhook secret
19+ $ webhookSecret = 'whsec_FAKE ' ;
20+
21+ // Construct and verify the event
22+ $ event = \Stripe \Webhook::constructEvent (
23+ $ payload ,
24+ $ sigHeader ,
25+ $ webhookSecret
26+ );
27+
28+ // Return the event.data.object as JSON
29+ echo json_encode ($ event ->data ->object );
30+ } catch (\Stripe \Exception \SignatureVerificationException $ e ) {
31+ http_response_code (403 );
32+ echo json_encode (['error ' => $ e ->getMessage ()]);
33+ } catch (Exception $ e ) {
34+ http_response_code (403 );
35+ echo json_encode (['error ' => $ e ->getMessage ()]);
36+ }
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ nala update
3131printf ' #!/bin/sh\n\nexit 101\n' > /usr/sbin/policy-rc.d
3232chmod +x /usr/sbin/policy-rc.d
3333
34- nala install -y --no-install-recommends tzdata publicsuffix curl apache2 libapache2-mod-fcgid jq ca-certificates git php$PHP_VERSION -fpm php$PHP_VERSION -curl apache2 php$PHP_VERSION -mysql php$PHP_VERSION -pgsql php$PHP_VERSION -xml php$PHP_VERSION -mongodb
34+ nala install -y --no-install-recommends tzdata publicsuffix curl apache2 libapache2-mod-fcgid jq ca-certificates git unzip php$PHP_VERSION -fpm php$PHP_VERSION -curl apache2 php$PHP_VERSION -mysql php$PHP_VERSION -pgsql php$PHP_VERSION -xml php$PHP_VERSION -mongodb
3535
3636rm -rf /usr/sbin/policy-rc.d
3737rm -rf /var/lib/apt/lists/*
You can’t perform that action at this time.
0 commit comments