Skip to content
This repository was archived by the owner on Sep 29, 2024. It is now read-only.

Commit d9f3dc0

Browse files
committed
psr-4
1 parent 7712d56 commit d9f3dc0

File tree

8 files changed

+90
-1661
lines changed

8 files changed

+90
-1661
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor/

Example.php

+38-29
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,45 @@
11
<?php
22

3-
require_once('Gojek.php');
4-
5-
$accessToken = '';
6-
7-
$gojek = new Gojek($accessToken);
8-
9-
print_r($gojek->login('[PHONE]'));
10-
print_r($gojek->relogin('[PHONE]', '[PIN]'));
11-
print_r($gojek->verifyOtp('[OTP]', '[OTP_TOKEN]'));
12-
print_r($gojek->verifyMFA('[CHALLENGE_ID]', '[PIN]'));
13-
print_r($gojek->verifyMFAToken('[CHALLENGE_TOKEN]', '[TOKEN]'));
14-
print_r($gojek->resendOtp('[OTP_TOKEN'));
15-
print_r($gojek->getProfile());
16-
print_r($gojek->getBalance());
17-
print_r($gojek->getTransactionList());
18-
print_r($gojek->getTransactionDetail('[payment_id|order_id]'));
19-
print_r($gojek->getBankList());
20-
print_r($gojek->validateBank('[BANK_CODE]', '[ACCOUNT_NUMBER]'));
21-
print_r($gojek->validateP2P('[PHONE_NUMBER]'));
22-
print_r($gojek->transferBank('[BANK_CODE]', '[ACCOUNT_NUMBER]', '[AMOUNT]', '[NOTES]', '[PIN]'));
23-
print_r($gojek->transferP2P('[PHONE_NUMBER]', [AMOUNT], '[PIN]'));
24-
$validateQRCode = $gojek->validateQRCode('[QRIS_STRING]');
25-
if ($validateQRCode->success) {
26-
print_r($gojek->payStaticQR($validateQRCode->data->payee, $validateQRCode->data->additional_data, $validateQRCode->data->metadata, $validateQRCode->data->order_signature, [AMOUNT], '[PIN]'));
3+
require_once 'vendor/autoload.php';
4+
5+
use Decoderid\GojekApi;
6+
7+
$gojek = new GojekApi();
8+
9+
/** SET UUID */
10+
$uuid = $gojek->generateUuid();
11+
$gojek->setUuid($uuid);
12+
13+
/** LOGIN */
14+
$phone = '[PHONE]';
15+
$pin = '[PIN]';
16+
17+
$login = $gojek->login($phone, $pin);
18+
19+
/**
20+
* VERIFY OTP
21+
*/
22+
$verifyOtp = $gojek->verifyOtp('[OTP]', $login->data->otp_token);
23+
24+
if ($verifyOtp->access_token) {
25+
print_r($verifyOtp);
2726
}
2827

29-
$validateQRCode = $gojek->validateQRCode('[QRIS_STRING]');
30-
if ($validateQRCode->success) {
31-
print_r($gojek->payDynamicQR($validateQRCode->data->payment_id, $validateQRCode->data->additional_data, $validateQRCode->data->metadata, $validateQRCode->data->order_signature, [AMOUNT], '[PIN]'));
28+
if ($verifyOtp->success) {
29+
print_r($verifyOtp);
3230
}
3331

32+
/**
33+
* IF PIN AUTHENTICATION AFTER OTP
34+
*/
35+
if ($verifyOtp->errors[0]->code === 'mfa:customer_send_challenge:challenge_required') {
36+
$challengeToken = $verifyOtp->errors[0]->details->challenge_token;
37+
$challengeId = $verifyOtp->errors[0]->details->challenges[0]->gopay_challenge_id;
38+
39+
$verifyMFA = $gojek->verifyMFA($challengeId, $pin);
3440

35-
print_r($gojek->updatePIN('[OLD_PIN]', '[NEW_PIN]'));
36-
print_r($gojek->logout());
41+
if ($verifyMFA->success) {
42+
$verifyMFAToken = $gojek->verifyMFAToken($challengeToken, $verifyMFA->data->token);
43+
print_r($verifyMFAToken);
44+
}
45+
}

LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1717
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1818
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1919
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ Gimme Buff to Get More Power: https://trakteer.id/decoderid
3333
## Example: Login
3434
```php
3535
<?php
36-
require_once('Gojek.php');
36+
require_once 'vendor/autoload.php';
37+
38+
use Decoderid/GojekApi;
3739

3840
$phone = '[PHONE]';
3941
$pin = '[PIN]';
4042

41-
$gojek = new Gojek();
43+
$gojek = new GojekApi();
4244
$login = $gojek->login($phone, $pin);
4345

4446
/**
@@ -97,4 +99,4 @@ Telegram: [@decoderid](https://t.me/decoderid)
9799
[license-shield]: https://img.shields.io/github/license/decoderid/gojek-api-php-native.svg?style=for-the-badge
98100
[license-url]: https://github.com/decoderid/gojek-api-php-native/blob/master/LICENSE.txt
99101
[hits-view]: https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fdecoderid%2Fgojek-api-php-native&count_bg=%2379C83D&title_bg=%23555555&icon=github.svg&icon_color=%23E7E7E7&title=hits&edge_flat=true
100-
[hits-view-url]: https://hits.seeyoufarm.com
102+
[hits-view-url]: https://hits.seeyoufarm.com

0 commit comments

Comments
 (0)