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

Commit

Permalink
psr-4
Browse files Browse the repository at this point in the history
  • Loading branch information
decoderid committed Oct 20, 2023
1 parent 7712d56 commit d9f3dc0
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 1,661 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/
67 changes: 38 additions & 29 deletions Example.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
<?php

require_once('Gojek.php');

$accessToken = '';

$gojek = new Gojek($accessToken);

print_r($gojek->login('[PHONE]'));
print_r($gojek->relogin('[PHONE]', '[PIN]'));
print_r($gojek->verifyOtp('[OTP]', '[OTP_TOKEN]'));
print_r($gojek->verifyMFA('[CHALLENGE_ID]', '[PIN]'));
print_r($gojek->verifyMFAToken('[CHALLENGE_TOKEN]', '[TOKEN]'));
print_r($gojek->resendOtp('[OTP_TOKEN'));
print_r($gojek->getProfile());
print_r($gojek->getBalance());
print_r($gojek->getTransactionList());
print_r($gojek->getTransactionDetail('[payment_id|order_id]'));
print_r($gojek->getBankList());
print_r($gojek->validateBank('[BANK_CODE]', '[ACCOUNT_NUMBER]'));
print_r($gojek->validateP2P('[PHONE_NUMBER]'));
print_r($gojek->transferBank('[BANK_CODE]', '[ACCOUNT_NUMBER]', '[AMOUNT]', '[NOTES]', '[PIN]'));
print_r($gojek->transferP2P('[PHONE_NUMBER]', [AMOUNT], '[PIN]'));
$validateQRCode = $gojek->validateQRCode('[QRIS_STRING]');
if ($validateQRCode->success) {
print_r($gojek->payStaticQR($validateQRCode->data->payee, $validateQRCode->data->additional_data, $validateQRCode->data->metadata, $validateQRCode->data->order_signature, [AMOUNT], '[PIN]'));
require_once 'vendor/autoload.php';

use Decoderid\GojekApi;

$gojek = new GojekApi();

/** SET UUID */
$uuid = $gojek->generateUuid();
$gojek->setUuid($uuid);

/** LOGIN */
$phone = '[PHONE]';
$pin = '[PIN]';

$login = $gojek->login($phone, $pin);

/**
* VERIFY OTP
*/
$verifyOtp = $gojek->verifyOtp('[OTP]', $login->data->otp_token);

if ($verifyOtp->access_token) {
print_r($verifyOtp);
}

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

/**
* IF PIN AUTHENTICATION AFTER OTP
*/
if ($verifyOtp->errors[0]->code === 'mfa:customer_send_challenge:challenge_required') {
$challengeToken = $verifyOtp->errors[0]->details->challenge_token;
$challengeId = $verifyOtp->errors[0]->details->challenges[0]->gopay_challenge_id;

$verifyMFA = $gojek->verifyMFA($challengeId, $pin);

print_r($gojek->updatePIN('[OLD_PIN]', '[NEW_PIN]'));
print_r($gojek->logout());
if ($verifyMFA->success) {
$verifyMFAToken = $gojek->verifyMFAToken($challengeToken, $verifyMFA->data->token);
print_r($verifyMFAToken);
}
}
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ Gimme Buff to Get More Power: https://trakteer.id/decoderid
## Example: Login
```php
<?php
require_once('Gojek.php');
require_once 'vendor/autoload.php';

use Decoderid/GojekApi;

$phone = '[PHONE]';
$pin = '[PIN]';

$gojek = new Gojek();
$gojek = new GojekApi();
$login = $gojek->login($phone, $pin);

/**
Expand Down Expand Up @@ -97,4 +99,4 @@ Telegram: [@decoderid](https://t.me/decoderid)
[license-shield]: https://img.shields.io/github/license/decoderid/gojek-api-php-native.svg?style=for-the-badge
[license-url]: https://github.com/decoderid/gojek-api-php-native/blob/master/LICENSE.txt
[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
[hits-view-url]: https://hits.seeyoufarm.com
[hits-view-url]: https://hits.seeyoufarm.com
Loading

0 comments on commit d9f3dc0

Please sign in to comment.