Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates #6

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PUBLIC_KEY="SBTESTPUBK_p8GqvFSFNCBahSJinczKd9aIPoRUZfda"
SECRET_KEY="SBTESTSECK_kFgKytQK1KSvbR616rUMqNYOUedK3Btm5igZgxaZ"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ composer.lock
src/Seerbit/app.log
src/Seerbit/seerbit.log
/.idea
tests/
tests/seerbit.log
.env
*.bak
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":[],"times":{"Seerbit\\Request\\TokenizeTest::testTokenize":9.791}}
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog

All notable changes to `seerbit-laravel` will be documented in this file

## 2.0.0 - 201X-XX-XX
## 2.0.0 - 2021-04-01

- initial release

## 2.0.1 - 2023-02-28

- addition of card tokenization service
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM php:8.2-fpm

ENV COMPOSER_ALLOW_SUPERUSER=1
# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user

# Set working directory
WORKDIR /var/www

USER $user
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
"role": "Developer"
}],
"require": {
"php" : ">=5.5.0",
"php" : "^8.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"monolog/monolog": "^1.25"
"monolog/monolog": ">=1.16"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4",
"phpunit/phpunit": "^7.5"
"php-coveralls/php-coveralls": "^2.5",
"squizlabs/php_codesniffer": "^3.7",
"symfony/process": "~6.2",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {"Seerbit\\": "src/Seerbit"}
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.7"
services:
app:
build:
args:
user: sammy
uid: 1000
context: ./
dockerfile: Dockerfile
image: seerbit-php
container_name: seerbit-php-library
restart: unless-stopped
working_dir: /var/www/
volumes:
- ./:/var/www
63 changes: 24 additions & 39 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>

<testsuite name="Request">
<directory suffix="Test.php">./tests/Request</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
<server name="MAIL_DRIVER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
</php>
</phpunit>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory>vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Request">
<directory suffix="Test.php">./tests/Request</directory>
</testsuite>
</testsuites>
<php>
<env name="SEERBIT_PUBLIC_KEY" value="SBTESTPUBK_4v0JR58modUFJjF1Es206pveBQjOLxe2"/>
<env name="SEERBIT_SECRET_KEY" value="SBSECK_VZZXPRI2ZB5D4D4GJRTQZO3SCCGYMUY4ZCVZYJLA"/>
<env name="SEERBIT_TOKEN" value="SBSECK_VZZXPRI2ZB5D4D4GJRTQZO3SCCGYMUY4ZCVZYJLA"/>
</php>
</phpunit>
60 changes: 29 additions & 31 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@

<div align="center">
<img width="200" valign="top" src="https://res.cloudinary.com/dy2dagugp/image/upload/v1571249658/seerbit-logo_mdinom.png">
<img width="200" valign="top" src="https://assets.seerbitapi.com/images/seerbit_logo_type.png">
</div>


<h1 align="center">
<img width="60" valign="bottom" src="https://www.php.net/images/logos/php-logo.svg">
- SeerBit
</h1>

# SeerBit PHP Library

# SeerBit's API SDK for PHP (Version 2)

SeerBit PHP SDK for easy integration with SeerBit's API.
This library provides convenient access to the SeerBit API from PHP based applications. It provides Utility classses to access API resources on SeerBit.

## Integration
The Library supports all APIs under the following services:

* Standard API Checkout
* Payment via API (card and account)
* Recurrent
* Pre-auth payment
* Order
* Mobile Money
* Transaction Status
* Standard Checkout
* Payment via Card and Bank Account
* Recurrent transactions
* Card Tokenization
* Pre-authorized payment
* Order Payments
* Mobile Money Payments
* Transaction Validation

## Requirements
PHP 5.5 or higher
PHP 8

## Installation ##
You can use Composer or simply Download the Release
Expand All @@ -43,24 +39,25 @@ Once composer is installed, execute the following command in your project root t
composer require seerbit/seerbit-php-sdk
```

### Examples ###
### Find examples [**here**](./src/Examples)

#### Example 1 : Start a Standard transaction ###

Validate a transaction:

```php

try{
$token = "1KWLzpZkWaoXO9AN4qweKwqLjGcQSNt8kjeVjsdTG4lPlwg6sTvpVAay2RA7hoCEzHPkIQa+MNfDepx4VBr5JMgLb5Q5anq9XoN2pXU850bumqBWFVw1T1ZW5w8N+Sq/";
$token = "YOUR MERCHANT TOKEN";
//Instantiate SeerBit Client
$client = new Client();
$client->setToken($token);

//Configure SeerBit Client
$client->setEnvironment(\Seerbit\Environment::LIVE);
$client->setToken($token);
$client->setAuthType(\Seerbit\AuthType::BEARER);

//SETUP CREDENTIALS
$client->setPublicKey("SBTESTPUBK_p8GqvFSFNCBahSJinczKd9aIPoRUZfda");
$client->setSecretKey("SBTESTSECK_kFgKytQK1KSvbR616rUMqNYOUedK3Btm5igZgxaZ");
$client->setPublicKey("YOUR_PUBLIC_KEY"); //AS REQUIRED
$client->setSecretKey("YOUR_SECRE_KEY"); //AS REQUIRED

//Instantiate Resource Service
$standard_service = New StandardService($client);
Expand All @@ -86,10 +83,15 @@ try{
}catch (\Exception $exception){
echo $exception->getMessage();
}
```

```
Generate Token here: https://www.doc.seerbit.com/resources/hash/key-encryption

```
Find more examples [**here**](./src/Examples)

### Find more examples [**here**](./src/Examples)


## Configure Logger ##
````php
Expand All @@ -104,7 +106,7 @@ $client->setLogger = $->CustomLoggerService();
* https://doc.seerbit.com/

## Examples ##
* https://doc.seerbit.com/
[**Examples**](./src/Examples)

### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
Expand All @@ -113,12 +115,8 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen
## Support
If you have any problems, questions or suggestions, create an issue here or send your inquiry to [email protected].

## Credits

- [Victor Osas Ighalo](https://github.com/victorighalo)

## Contributing
We strongly encourage you to join us in contributing to this repository so everyone can benefit from:
We encourage you to join us in contributing to this repository so everyone can benefit from:
* New features and functionality
* Resolved bug fixes and issues
* Any general improvements
Expand Down
Loading