Skip to content

Commit 6ecf109

Browse files
Merge pull request #94 from Flutterwave/dev
Signoz monitoring implementation
2 parents 41d8c14 + 0d97294 commit 6ecf109

24 files changed

Lines changed: 1199 additions & 177 deletions

.devcontainer/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM mcr.microsoft.com/devcontainers/base:0-focal
2+
3+
RUN apt-get update && \
4+
apt-get install -y software-properties-common && \
5+
add-apt-repository ppa:ondrej/php -y && \
6+
apt-get update && \
7+
apt-get install -y \
8+
php7.4 php7.4-cli php7.4-common php7.4-curl \
9+
php7.4-mysql php7.4-bcmath php7.4-soap php7.4-zip php7.4-intl \
10+
php7.4-gd php7.4-xsl php7.4-dom php7.4-mbstring \
11+
unzip && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
RUN curl -sS https://getcomposer.org/installer | php -- \
15+
--install-dir=/usr/local/bin --filename=composer

.devcontainer/devcontainer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Ona",
3+
"build": {
4+
"context": ".",
5+
"dockerfile": "Dockerfile"
6+
},
7+
"features": {
8+
"ghcr.io/devcontainers/features/node:2": {},
9+
"ghcr.io/devcontainers/features/python:1": {},
10+
"ghcr.io/devcontainers/features/docker-in-docker:3.0.1": {}
11+
}
12+
}

.github/workflows/artifact-release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1113

1214
strategy:
1315
matrix:
@@ -30,6 +32,20 @@ jobs:
3032
id: tag
3133
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
3234

35+
- name: Inject SigNoz API key
36+
env:
37+
SIGNOZ_API_KEY: ${{ secrets.SIGNOZ_API_KEY }}
38+
run: |
39+
if [ -z "$SIGNOZ_API_KEY" ]; then
40+
echo "::error::SIGNOZ_API_KEY secret is not set"
41+
exit 1
42+
fi
43+
sed -i "s|%%SIGNOZ_API_KEY%%|${SIGNOZ_API_KEY}|g" src/Monitoring/SignozServiceLogger.php
44+
if grep -q '%%SIGNOZ_API_KEY%%' src/Monitoring/SignozServiceLogger.php; then
45+
echo "::error::Placeholder replacement failed"
46+
exit 1
47+
fi
48+
3349
- name: Create release artifact
3450
run: |
3551
mkdir -p build

.github/workflows/change-review.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: [7.4, 8.1, 8.2, 8.3]
17+
php: [7.4, 8.1, 8.2, 8.3, 8.4]
1818

1919
env:
2020
XDEBUG_MODE: coverage
2121
PUBLIC_KEY: ${{ secrets.PUBLIC_KEY }}
2222
SECRET_KEY: ${{ secrets.SECRET_KEY }}
2323
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
2424
ENV: ${{ secrets.ENV }}
25+
SIGNOZ_API_KEY: ${{ secrets.SIGNOZ_API_KEY }}
2526

2627
steps:
2728
- uses: actions/checkout@v3
@@ -48,14 +49,27 @@ jobs:
4849
- name: Install dependencies
4950
run: composer install --prefer-dist --no-progress
5051

52+
- name: Inject SigNoz API key
53+
env:
54+
SIGNOZ_API_KEY: ${{ secrets.SIGNOZ_API_KEY }}
55+
run: |
56+
if [ -z "$SIGNOZ_API_KEY" ]; then
57+
echo "::error::SIGNOZ_API_KEY secret is not set"
58+
exit 1
59+
fi
60+
sed -i "s|%%SIGNOZ_API_KEY%%|${SIGNOZ_API_KEY}|g" src/Monitoring/SignozServiceLogger.php
61+
if grep -q '%%SIGNOZ_API_KEY%%' src/Monitoring/SignozServiceLogger.php; then
62+
echo "::error::Placeholder replacement failed"
63+
exit 1
64+
fi
65+
5166
- name: run unit tests and coverage scan
5267
run: ./vendor/bin/pest --coverage --min=20 --coverage-clover ./coverage.xml
5368
env:
5469
PUBLIC_KEY: ${{ secrets.PUBLIC_KEY }}
5570
SECRET_KEY: ${{ secrets.SECRET_KEY }}
5671
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
5772
ENV: ${{ secrets.ENV }}
58-
5973
- name: Upload to Codecov
6074
uses: codecov/codecov-action@v2
6175
with:

.github/workflows/package-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: true
1313
matrix:
14-
php: [7.4, 8.1, 8.2]
14+
php: [7.4, 8.1, 8.2, 8.3, 8.4]
1515

1616
steps:
1717
- uses: actions/checkout@v2

.github/workflows/security-scan.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"mockery/mockery": ">=1.2",
3131
"symfony/var-dumper": "5.4.13",
3232
"phpstan/phpstan": "^1.9",
33-
"pestphp/pest": "^1.22",
33+
"pestphp/pest": "1.22",
3434
"nunomaduro/phpinsights": "^2.6",
3535
"eloquent/liberator": "^3.0",
3636
"squizlabs/php_codesniffer": "3.*",
@@ -45,6 +45,9 @@
4545
}
4646
],
4747
"config": {
48+
"platform": {
49+
"php": "7.4"
50+
},
4851
"allow-plugins": {
4952
"pestphp/pest-plugin": true,
5053
"dealerdirect/phpcodesniffer-composer-installer": true

paymentForm.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
<!-- Replace the value with the payment button text you prefer (optional) -->
4444
<!-- <input type="hidden" name="tx_ref" value="TEST_TXREF_--><?//= uniqid() ?><!--"/>-->
4545
<!-- Replace the value with your transaction reference. It must be unique per transaction. You can delete this line if you want one to be generated for you. -->
46-
<input type="hidden" name="success_url" value="http://request.lendlot.com/13b9gxc1?status=success">
46+
<input type="hidden" name="success_url" value="https://example.com/success">
4747
<!-- Put your success url here -->
48-
<input type="hidden" name="failure_url" value="http://request.lendlot.com/13b9gxc1?status=failed">
48+
<input type="hidden" name="failure_url" value="https://example.com/failure">
4949
<!-- Put your failure url here -->
5050
<center><input id="btn-of-destiny" class="btn btn-warning" type="submit" value="Pay Now"/></center>
5151
</form>

processPayment.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Flutterwave\Library\Modal;
1212
use \Flutterwave\Config\ForkConfig;
1313

14-
// start a session.
14+
// start a session for redirect metadata.
1515
session_start();
1616

1717
// Define custom config.
@@ -39,9 +39,15 @@
3939
$controller = new PaymentController( $client, $customHandler, $modalType );
4040
} catch(\Exception $e ) {
4141
echo $e->getMessage();
42+
exit();
4243
}
4344

4445
if ($_SERVER["REQUEST_METHOD"] === "POST") {
46+
if ($controller === null) {
47+
echo 'Unable to initialize payment controller.';
48+
exit();
49+
}
50+
4551
$request = $_REQUEST;
4652
$request['redirect_url'] = $_SERVER['HTTP_ORIGIN'] . $_SERVER['REQUEST_URI'];
4753
try {
@@ -54,6 +60,11 @@
5460
$request = $_GET;
5561
# Confirming Payment.
5662
if(isset($request['tx_ref'])) {
63+
if ($controller === null) {
64+
echo 'Unable to initialize payment controller.';
65+
exit();
66+
}
67+
5768
$controller->callback( $request );
5869
} else {
5970

src/AbstractPayment.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Flutterwave\Contract\ConfigInterface;
88
use Flutterwave\EventHandlers\EventHandlerInterface;
99
use Flutterwave\Helper\EnvVariables;
10+
use Flutterwave\Monitoring\SignozServiceLogger;
1011
use Flutterwave\Traits\ApiOperations as Api;
1112
use Flutterwave\Traits\PayloadOperations as Payload;
1213
use Psr\Log\LoggerInterface;

0 commit comments

Comments
 (0)