Skip to content

Commit 35c7cd6

Browse files
committed
feat: ✨ partnerReferenceNo change to uuidv4 and merge with headers and body
1 parent 1563a01 commit 35c7cd6

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"require": {
2727
"php": ">=7.4",
2828
"ext-curl": "*",
29-
"nesbot/carbon": "^2.69"
29+
"nesbot/carbon": "^2.69",
30+
"ramsey/uuid": "^4.7"
3031
},
3132
"require-dev": {
3233
"psy/psysh": "^0.11.20",
@@ -50,4 +51,4 @@
5051
]
5152
}
5253
}
53-
}
54+
}

src/Services/BCA/Traits/HasTransaction.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Otnansirk\SnapBI\Services\BCA\BcaConfig;
77
use Otnansirk\SnapBI\Support\Signature;
88
use Otnansirk\SnapBI\Support\Http;
9+
use Ramsey\Uuid\Uuid;
910

1011

1112
trait HasTransaction
@@ -26,20 +27,21 @@ public static function bankStatement(string $startDate, string $endDate): HttpRe
2627
$timestamp = currentTimestamp()->toIso8601String();
2728
$accessToken = self::$token;
2829

29-
$body = [
30-
"partnerReferenceNo" => int_rand(8),
30+
$body = array_merge([
31+
"partnerReferenceNo" => Uuid::uuid4(),
3132
"accountNo" => BcaConfig::get('account_id'),
3233
"fromDateTime" => $startDate,
3334
"toDateTime" => $endDate,
3435
"bankCardToken" => BcaConfig::get('bank_card_token')
35-
];
36-
$headers = [
36+
], self::$body);
37+
38+
$headers = array_merge([
3739
'X-TIMESTAMP' => $timestamp,
3840
'X-SIGNATURE' => Signature::symmetric(BcaConfig::class, 'POST', $path, $body, $timestamp, $accessToken),
3941
'CHANNEL-ID' => BcaConfig::get('channel_id'),
4042
'X-PARTNER-ID' => BcaConfig::get('partner_id'),
41-
'X-EXTERNAL-ID' => int_rand(8),
42-
];
43+
'X-EXTERNAL-ID' => int_rand(16),
44+
], self::$headers);
4345

4446
$url = BcaConfig::get('base_url') . $path;
4547
return Http::withToken($accessToken)

src/Services/Mandiri/Traits/HasTransaction.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Otnansirk\SnapBI\Services\Mandiri\MandiriConfig;
77
use Otnansirk\SnapBI\Support\Signature;
88
use Otnansirk\SnapBI\Support\Http;
9+
use Ramsey\Uuid\Uuid;
910

1011

1112
trait HasTransaction
@@ -26,20 +27,21 @@ public static function bankStatement(string $startDate, string $endDate): HttpRe
2627
$timestamp = currentTimestamp()->toIso8601String();
2728
$accessToken = self::$token;
2829

29-
$body = [
30-
"partnerReferenceNo" => int_rand(8),
30+
$body = array_merge([
31+
"partnerReferenceNo" => Uuid::uuid4(),
3132
"accountNo" => MandiriConfig::get('account_id'),
3233
"fromDateTime" => $startDate,
3334
"toDateTime" => $endDate,
3435
"bankCardToken" => MandiriConfig::get('bank_card_token')
35-
];
36-
$headers = [
36+
], self::$body);
37+
38+
$headers = array_merge([
3739
'X-TIMESTAMP' => $timestamp,
3840
'X-SIGNATURE' => Signature::symmetric(MandiriConfig::class, 'POST', $path, $body, $timestamp, $accessToken),
3941
'CHANNEL-ID' => MandiriConfig::get('channel_id'),
4042
'X-PARTNER-ID' => MandiriConfig::get('partner_id'),
41-
'X-EXTERNAL-ID' => int_rand(8),
42-
];
43+
'X-EXTERNAL-ID' => int_rand(16),
44+
], self::$headers);
4345

4446
$url = MandiriConfig::get('base_url') . $path;
4547
return Http::withToken($accessToken)

0 commit comments

Comments
 (0)