Skip to content

Commit 1de1819

Browse files
committed
Add saloon request
1 parent 5429586 commit 1de1819

30 files changed

+672
-38
lines changed

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
],
1818
"require": {
1919
"php": "^8.1",
20+
"saloonphp/laravel-http-sender": "^2.0",
21+
"saloonphp/pagination-plugin": "^2.0",
2022
"saloonphp/saloon": "^3.6",
2123
"spatie/laravel-data": "^3.11",
2224
"spatie/laravel-package-tools": "^1.15.0"

data/bank-account.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"corporate_id": null,
3+
"username": "testing username",
4+
"atas_nama": "moota",
5+
"balance": "8704362.00",
6+
"account_number": "123123123123",
7+
"bank_type": "bri",
8+
"pkg": null,
9+
"login_retry": 0,
10+
"date_from": "2019-11-10 14:33:01",
11+
"date_to": "2019-11-10 14:33:01",
12+
"meta": [],
13+
"interval_refresh": 15,
14+
"next_queue": "2019-11-10 14:33:01",
15+
"is_active": false,
16+
"in_queue": 0,
17+
"in_progress": 0,
18+
"is_crawling": 1,
19+
"recurred_at": "2019-11-10 14:33:01",
20+
"status": null,
21+
"ip_address": null,
22+
"ip_address_expired_at": null,
23+
"created_at": "2019-11-10 14:33:01",
24+
"token": "Aslx120mlw",
25+
"bank_id": "Aslx120mlw",
26+
"label": "BRI",
27+
"last_update": "",
28+
"icon": ""
29+
}

data/bank.json

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,8 @@
11
{
2-
"corporate_id": null,
3-
"username": "testing username",
4-
"atas_nama": "moota",
5-
"balance": "8704362.00",
6-
"account_number": "123123123123",
7-
"bank_type": "bri",
8-
"pkg": null,
9-
"login_retry": 0,
10-
"date_from": "2019-11-10 14:33:01",
11-
"date_to": "2019-11-10 14:33:01",
12-
"meta": [],
13-
"interval_refresh": 15,
14-
"next_queue": "2019-11-10 14:33:01",
15-
"is_active": false,
16-
"in_queue": 0,
17-
"in_progress": 0,
18-
"is_crawling": 1,
19-
"recurred_at": "2019-11-10 14:33:01",
20-
"status": null,
21-
"ip_address": null,
22-
"ip_address_expired_at": null,
23-
"created_at": "2019-11-10 14:33:01",
24-
"token": "Aslx120mlw",
25-
"bank_id": "Aslx120mlw",
26-
"label": "BRI",
27-
"last_update": "",
28-
"icon": ""
2+
"id": "bca",
3+
"price": 1500,
4+
"label": "Bank Central Asia",
5+
"link": "https://ibank.klikbca.com/",
6+
"type": "defaultForm",
7+
"icon": "http://moota.test/images/[email protected]"
298
}

data/webhook-url.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"id": 1,
3+
"user_id": 1,
4+
"bank_account_id": "VLagzqBj42D",
5+
"type": "single",
6+
"url": "http://moota.test/integrations/webhook",
7+
"secret_token": "ldpJKYQc",
8+
"start_unique_code": "1",
9+
"end_unique_code": "999",
10+
"kinds": "credit",
11+
"created_at": "2022-02-24T10:00:31.000000Z",
12+
"updated_at": "2022-02-24T10:00:31.000000Z",
13+
"token": "VLagzqBj42D",
14+
"webhook_id": "VLagzqBj42D"
15+
}

src/DataTransfers/BankAccountData.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace FromHome\Moota\DataTransfers;
6+
7+
use Spatie\LaravelData\Data;
8+
use Spatie\LaravelData\Attributes\MapName;
9+
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
10+
11+
#[MapName(SnakeCaseMapper::class)]
12+
final class BankAccountData extends Data
13+
{
14+
public function __construct(
15+
public readonly string $bankId,
16+
public readonly string $label,
17+
public readonly string $accountNumber
18+
) {
19+
}
20+
}

src/DataTransfers/BankData.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
namespace FromHome\Moota\DataTransfers;
66

77
use Spatie\LaravelData\Data;
8-
use Spatie\LaravelData\Attributes\MapName;
9-
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
108

11-
#[MapName(SnakeCaseMapper::class)]
129
final class BankData extends Data
1310
{
1411
public function __construct(
15-
public readonly string $bankId,
16-
public readonly string $label,
17-
public readonly string $accountNumber
12+
public readonly string $id,
13+
public readonly float|int $price,
14+
public readonly string $label
1815
) {
1916
}
2017
}

src/DataTransfers/MutationData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(
2222
public readonly string $type,
2323
public readonly float|int $amount,
2424
public readonly string $description,
25-
public readonly ?BankData $bank = null,
25+
public readonly ?BankAccountData $bank = null,
2626
) {
2727
}
2828
}

src/DataTransfers/WebhookUrlData.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace FromHome\Moota\DataTransfers;
6+
7+
use Spatie\LaravelData\Data;
8+
use Spatie\LaravelData\Attributes\MapName;
9+
use Spatie\LaravelData\Attributes\MapInputName;
10+
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
11+
12+
#[MapName(SnakeCaseMapper::class)]
13+
final class WebhookUrlData extends Data
14+
{
15+
public function __construct(
16+
public readonly string $webhookId,
17+
public readonly string $url,
18+
public readonly string $secretToken,
19+
public readonly ?string $kinds,
20+
#[MapInputName('bank_account_id')]
21+
public readonly ?string $bankId,
22+
) {
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace FromHome\Moota\Http\Integrations\Inputs;
6+
7+
use Spatie\LaravelData\Data;
8+
use Spatie\LaravelData\Attributes\MapName;
9+
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
10+
11+
#[MapName(SnakeCaseMapper::class)]
12+
final class BankAccountInput extends Data
13+
{
14+
public function __construct(
15+
public readonly string $corporateId,
16+
public readonly string $bankType,
17+
public readonly string $username,
18+
public readonly string $password,
19+
public readonly string $nameHolder,
20+
public readonly string $accountNumber,
21+
public readonly bool $isActive = true,
22+
) {
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace FromHome\Moota\Http\Integrations\Inputs;
6+
7+
use DateTime;
8+
use Spatie\LaravelData\Data;
9+
use Spatie\LaravelData\Attributes\MapName;
10+
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
11+
use Spatie\LaravelData\Attributes\Validation\In;
12+
13+
#[MapName(SnakeCaseMapper::class)]
14+
final class FilterMutationInput extends Data
15+
{
16+
public function __construct(
17+
#[In(['CR', 'DB'])]
18+
public readonly ?string $type = null,
19+
public readonly null|string|int $bankId = null,
20+
public readonly ?DateTime $startDate = null,
21+
public readonly ?DateTime $endDate = null,
22+
) {
23+
}
24+
}

0 commit comments

Comments
 (0)