Skip to content

Commit b9884e2

Browse files
committed
Initial commit
0 parents  commit b9884e2

26 files changed

+1086
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Zeros Developer
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Tripay Library
2+
3+
For usage examples. See `/examples` directory.

autoload.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
array_map(function ($class) {
4+
return require_once $class;
5+
}, array_merge(
6+
glob(__DIR__.'/src/Constants/*.php'),
7+
glob(__DIR__.'/src/Exceptions/*.php'),
8+
glob(__DIR__.'/src/Drivers/*.php'),
9+
glob(__DIR__.'/src/*.php')
10+
));

composer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "trijayadigital/tripay-php",
3+
"description": "TriPay Payment Library for PHP",
4+
"type": "library",
5+
"homepage": "https://tripay.co.id",
6+
"license": "MIT",
7+
"support": {
8+
"issues": "https://github.com/trijayadigital/tripay-php/issues",
9+
"source": "https://github.com/trijayadigital/tripay-php"
10+
},
11+
"authors": [
12+
{
13+
"name": "PT Trijaya Digital Grup",
14+
"email": "cs@p-store.net"
15+
},
16+
{
17+
"name": "Suyadi",
18+
"email": "suyadi.1992@gmail.com"
19+
},
20+
{
21+
"name": "Zeros Technology",
22+
"email": "admin@zeros.co.id"
23+
}
24+
],
25+
"minimum-stability": "dev",
26+
"require": {
27+
"php": ">=5.4.0",
28+
"ext-json": "*",
29+
"ext-curl": "*"
30+
},
31+
"autoload": {
32+
"psr-4" : {
33+
"Tripay\\": "src"
34+
}
35+
},
36+
"require-dev": {
37+
"phpunit/phpunit": "^7"
38+
}
39+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
require '../../autoload.php';
4+
5+
use Tripay\Constants\Environment;
6+
use Tripay\Transaction;
7+
8+
$environment = Environment::PRODUCTION;
9+
10+
$apiKey = 'CzAxUSKPk7e5vWxhxz7GpXjHVwlFT2VtslWlxuke';
11+
$reference = 'T00042MIWYR'; // Didapat setelah menjalankan request transaksi
12+
13+
14+
$transaction = (new Transaction($environment))
15+
->apiKey($apiKey)
16+
17+
->forClosedPayment();
18+
19+
20+
$detail = $transaction->detail($reference);
21+
22+
print_r($detail);
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
require '../../autoload.php';
3+
4+
use Tripay\Constants\Environment;
5+
use Tripay\Transaction;
6+
7+
$environment = Environment::PRODUCTION;
8+
9+
$apiKey = 'CzAxUSKPk7e5vWxhxz7GpXjHVwlFT2VtslWlxuke';
10+
$privateKey = 'uyPNa-5VDDJ-jPoNo-YxnJE-2caD9';
11+
12+
$merchantCode = 'T0004';
13+
$merchantRef = 'TRX-123456'; // Isi sembarang
14+
$channelCode = 'BRIVA';
15+
16+
$minutes = 1440; // Waktu kedaluwarsa invoice (dalam menit, default 1440 = 24 jam);
17+
18+
$customerName = 'Asep Balon';
19+
$customerEmail = 'asep.balon@gmail.com';
20+
$customerPhone = '0812345667890';
21+
22+
23+
24+
25+
$transaction = (new Transaction($environment))
26+
->apiKey($apiKey)
27+
->privateKey($privateKey)
28+
->merchantCode($merchantCode)
29+
->merchantRef($merchantRef)
30+
->channelCode($channelCode)
31+
32+
->expiresAfter($minutes)
33+
34+
->customerName($customerName)
35+
->customerEmail($customerEmail)
36+
->customerPhone($customerPhone)
37+
38+
// ->addItem('Nama Produk', 'Harga Satuan', 'Jumlah', 'Kode SKU')
39+
->addItem('Nama Produk 1', 100000, 2, 'SKU-PRODUK-1')
40+
->addItem('Nama Produk 2', 100000, 6, 'SKU-PRODUK-2')
41+
->addItem('Nama Produk 3', 100000, 3, 'SKU-PRODUK-3')
42+
->addItem('Nama Produk 4', 100000, 1, 'SKU-PRODUK-4')
43+
44+
->forClosedPayment();
45+
46+
47+
$response = $transaction->process();
48+
49+
print_r($response);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
require '../../autoload.php';
4+
5+
use Tripay\Constants\Environment;
6+
use Tripay\Merchant;
7+
8+
$environment = Environment::PRODUCTION;
9+
$apiKey = 'CzAxUSKPk7e5vWxhxz7GpXjHVwlFT2VtslWlxuke';
10+
11+
$merchant = (new Merchant($environment))
12+
->apiKey($apiKey);
13+
14+
// Jika panggil, hanya akan ditampilkan data sesuai channel code saja
15+
// ->channelCode('BRIVA');
16+
17+
$channels = $merchant->channels();
18+
19+
print_r($channels);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
require '../../autoload.php';
4+
5+
use Tripay\Constants\Environment;
6+
use Tripay\Merchant;
7+
8+
$environment = Environment::PRODUCTION;
9+
10+
$apiKey = 'CzAxUSKPk7e5vWxhxz7GpXjHVwlFT2VtslWlxuke';
11+
12+
$page = 1;
13+
$per_page = 25;
14+
15+
$merchant = (new Merchant($environment))
16+
->apiKey($apiKey);
17+
18+
$transactions = $merchant->transactions($page, $per_page);
19+
20+
print_r($transactions);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
require '../../autoload.php';
4+
5+
use Tripay\Constants\Environment;
6+
use Tripay\Merchant;
7+
8+
$environment = Environment::PRODUCTION;
9+
10+
$apiKey = 'CzAxUSKPk7e5vWxhxz7GpXjHVwlFT2VtslWlxuke';
11+
12+
$channelCode = 'BRIVA';
13+
$amount = 100000;
14+
15+
$merchant = (new Merchant($environment))
16+
->apiKey($apiKey)
17+
->channelCode($channelCode);
18+
19+
20+
$calculate = $merchant->calculate($amount);
21+
22+
print_r($calculate);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
require '../../autoload.php';
4+
5+
use Tripay\Constants\Environment;
6+
use Tripay\Transaction;
7+
8+
$environment = Environment::PRODUCTION;
9+
10+
$apiKey = 'CzAxUSKPk7e5vWxhxz7GpXjHVwlFT2VtslWlxuke';
11+
$uuid = 'T0001-OP1-7lXjI'; // Didapat setelah menjalankan request transaksi
12+
13+
14+
$transaction = (new Transaction($environment))
15+
->apiKey($apiKey)
16+
17+
->forOpenPayment();
18+
19+
20+
$payments = $transaction->payments($uuid);
21+
22+
print_r($payments);

0 commit comments

Comments
 (0)