Skip to content

Commit b5ddf71

Browse files
authored
Merge pull request #245 from andrederoos/develop
added named parameters to tests (only supported from php ^8.0)
2 parents f876e07 + 865c438 commit b5ddf71

46 files changed

Lines changed: 6254 additions & 146 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponseNoteAttachmentPaymentSuspended extends BunqResponse
9+
{
10+
/**
11+
* @return NoteAttachmentPaymentSuspendedApiObject
12+
*/
13+
public function getValue(): NoteAttachmentPaymentSuspendedApiObject
14+
{
15+
return parent::getValue();
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponseNoteAttachmentPaymentSuspendedApiObjectList extends BunqResponse
9+
{
10+
/**
11+
* @return NoteAttachmentPaymentSuspendedApiObject[]ApiObject
12+
*/
13+
public function getValue(): array
14+
{
15+
return parent::getValue();
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponseNoteTextPaymentSuspended extends BunqResponse
9+
{
10+
/**
11+
* @return NoteTextPaymentSuspendedApiObject
12+
*/
13+
public function getValue(): NoteTextPaymentSuspendedApiObject
14+
{
15+
return parent::getValue();
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponseNoteTextPaymentSuspendedApiObjectList extends BunqResponse
9+
{
10+
/**
11+
* @return NoteTextPaymentSuspendedApiObject[]ApiObject
12+
*/
13+
public function getValue(): array
14+
{
15+
return parent::getValue();
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponsePaymentBatchEntry extends BunqResponse
9+
{
10+
/**
11+
* @return PaymentBatchEntryApiObject
12+
*/
13+
public function getValue(): PaymentBatchEntryApiObject
14+
{
15+
return parent::getValue();
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponsePaymentDelayed extends BunqResponse
9+
{
10+
/**
11+
* @return PaymentDelayedApiObject
12+
*/
13+
public function getValue(): PaymentDelayedApiObject
14+
{
15+
return parent::getValue();
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponsePaymentDelayedApiObjectList extends BunqResponse
9+
{
10+
/**
11+
* @return PaymentDelayedApiObject[]ApiObject
12+
*/
13+
public function getValue(): array
14+
{
15+
return parent::getValue();
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace bunq\Model\Generated\Endpoint;
3+
4+
use bunq\Http\BunqResponse;
5+
6+
/**
7+
*/
8+
class BunqResponseRegistryImportSplitwiseCsv extends BunqResponse
9+
{
10+
/**
11+
* @return RegistryImportSplitwiseCsvApiObject
12+
*/
13+
public function getValue(): RegistryImportSplitwiseCsvApiObject
14+
{
15+
return parent::getValue();
16+
}
17+
}

src/Model/Generated/Endpoint/DraftPaymentApiObject.php

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class DraftPaymentApiObject extends BunqModel
3535
const FIELD_PREVIOUS_UPDATED_TIMESTAMP = 'previous_updated_timestamp';
3636
const FIELD_NUMBER_OF_REQUIRED_ACCEPTS = 'number_of_required_accepts';
3737
const FIELD_SCHEDULE = 'schedule';
38+
const FIELD_PAYMENT_BATCH_EXECUTION_TYPE = 'payment_batch_execution_type';
3839

3940
/**
4041
* Object type.
@@ -111,6 +112,13 @@ class DraftPaymentApiObject extends BunqModel
111112
*/
112113
protected $schedule;
113114

115+
/**
116+
* The execution type that will be used when converting this draft payment to a payment batch.
117+
*
118+
* @var string|null
119+
*/
120+
protected $paymentBatchExecutionType;
121+
114122
/**
115123
* The status of the DraftPayment.
116124
*
@@ -147,6 +155,13 @@ class DraftPaymentApiObject extends BunqModel
147155
*/
148156
protected $scheduleFieldForRequest;
149157

158+
/**
159+
* The execution type that will be used when converting this draft payment to a payment batch.
160+
*
161+
* @var string|null
162+
*/
163+
protected $paymentBatchExecutionTypeFieldForRequest;
164+
150165
/**
151166
* @param DraftPaymentEntryObject[] $entries The list of entries in the DraftPayment. Each entry will result in a payment
152167
* when the DraftPayment is accepted.
@@ -156,14 +171,17 @@ class DraftPaymentApiObject extends BunqModel
156171
* @param string|null $previousUpdatedTimestamp The last updated_timestamp that you received for this DraftPayment. This
157172
* needs to be provided to prevent race conditions.
158173
* @param ScheduleApiObject|null $schedule The schedule details when creating or updating a scheduled payment.
174+
* @param string|null $paymentBatchExecutionType The execution type that will be used when converting this draft payment to
175+
* a payment batch.
159176
*/
160-
public function __construct(array $entries, int $numberOfRequiredAccepts, string $status = null, string $previousUpdatedTimestamp = null, ScheduleApiObject $schedule = null)
177+
public function __construct(array $entries, int $numberOfRequiredAccepts, string $status = null, string $previousUpdatedTimestamp = null, ScheduleApiObject $schedule = null, string $paymentBatchExecutionType = null)
161178
{
162179
$this->statusFieldForRequest = $status;
163180
$this->entriesFieldForRequest = $entries;
164181
$this->previousUpdatedTimestampFieldForRequest = $previousUpdatedTimestamp;
165182
$this->numberOfRequiredAcceptsFieldForRequest = $numberOfRequiredAccepts;
166183
$this->scheduleFieldForRequest = $schedule;
184+
$this->paymentBatchExecutionTypeFieldForRequest = $paymentBatchExecutionType;
167185
}
168186

169187
/**
@@ -178,11 +196,13 @@ public function __construct(array $entries, int $numberOfRequiredAccepts, stri
178196
* @param string|null $previousUpdatedTimestamp The last updated_timestamp that you received for this DraftPayment. This
179197
* needs to be provided to prevent race conditions.
180198
* @param ScheduleApiObject|null $schedule The schedule details when creating or updating a scheduled payment.
199+
* @param string|null $paymentBatchExecutionType The execution type that will be used when converting this draft payment to
200+
* a payment batch.
181201
* @param string[] $customHeaders
182202
*
183203
* @return BunqResponseInt
184204
*/
185-
public static function create(array $entries, int $numberOfRequiredAccepts, int $monetaryAccountId = null, string $status = null, string $previousUpdatedTimestamp = null, ScheduleApiObject $schedule = null, array $customHeaders = []): BunqResponseInt
205+
public static function create(array $entries, int $numberOfRequiredAccepts, int $monetaryAccountId = null, string $status = null, string $previousUpdatedTimestamp = null, ScheduleApiObject $schedule = null, string $paymentBatchExecutionType = null, array $customHeaders = []): BunqResponseInt
186206
{
187207
$apiClient = new ApiClient(static::getApiContext());
188208
$responseRaw = $apiClient->post(
@@ -194,7 +214,8 @@ public static function create(array $entries, int $numberOfRequiredAccepts, in
194214
self::FIELD_ENTRIES => $entries,
195215
self::FIELD_PREVIOUS_UPDATED_TIMESTAMP => $previousUpdatedTimestamp,
196216
self::FIELD_NUMBER_OF_REQUIRED_ACCEPTS => $numberOfRequiredAccepts,
197-
self::FIELD_SCHEDULE => $schedule],
217+
self::FIELD_SCHEDULE => $schedule,
218+
self::FIELD_PAYMENT_BATCH_EXECUTION_TYPE => $paymentBatchExecutionType],
198219
$customHeaders
199220
);
200221

@@ -212,11 +233,13 @@ public static function create(array $entries, int $numberOfRequiredAccepts, in
212233
* @param string|null $previousUpdatedTimestamp The last updated_timestamp that you received for this DraftPayment. This
213234
* needs to be provided to prevent race conditions.
214235
* @param ScheduleApiObject|null $schedule The schedule details when creating or updating a scheduled payment.
236+
* @param string|null $paymentBatchExecutionType The execution type that will be used when converting this draft payment to
237+
* a payment batch.
215238
* @param string[] $customHeaders
216239
*
217240
* @return BunqResponseInt
218241
*/
219-
public static function update(int $draftPaymentId, int $monetaryAccountId = null, string $status = null, string $previousUpdatedTimestamp = null, ScheduleApiObject $schedule = null, array $customHeaders = []): BunqResponseInt
242+
public static function update(int $draftPaymentId, int $monetaryAccountId = null, string $status = null, string $previousUpdatedTimestamp = null, ScheduleApiObject $schedule = null, string $paymentBatchExecutionType = null, array $customHeaders = []): BunqResponseInt
220243
{
221244
$apiClient = new ApiClient(static::getApiContext());
222245
$responseRaw = $apiClient->put(
@@ -226,7 +249,8 @@ public static function update(int $draftPaymentId, int $monetaryAccountId = null
226249
),
227250
[self::FIELD_STATUS => $status,
228251
self::FIELD_PREVIOUS_UPDATED_TIMESTAMP => $previousUpdatedTimestamp,
229-
self::FIELD_SCHEDULE => $schedule],
252+
self::FIELD_SCHEDULE => $schedule,
253+
self::FIELD_PAYMENT_BATCH_EXECUTION_TYPE => $paymentBatchExecutionType],
230254
$customHeaders
231255
);
232256

@@ -490,6 +514,26 @@ public function setSchedule($schedule)
490514
$this->schedule = $schedule;
491515
}
492516

517+
/**
518+
* The execution type that will be used when converting this draft payment to a payment batch.
519+
*
520+
* @return string
521+
*/
522+
public function getPaymentBatchExecutionType()
523+
{
524+
return $this->paymentBatchExecutionType;
525+
}
526+
527+
/**
528+
* @deprecated User should not be able to set values via setters, use constructor.
529+
*
530+
* @param string $paymentBatchExecutionType
531+
*/
532+
public function setPaymentBatchExecutionType($paymentBatchExecutionType)
533+
{
534+
$this->paymentBatchExecutionType = $paymentBatchExecutionType;
535+
}
536+
493537
/**
494538
* @return bool
495539
*/
@@ -535,6 +579,10 @@ public function isAllFieldNull()
535579
return false;
536580
}
537581

582+
if (!is_null($this->paymentBatchExecutionType)) {
583+
return false;
584+
}
585+
538586
return true;
539587
}
540588
}

src/Model/Generated/Endpoint/InvoiceApiObject.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class InvoiceApiObject extends BunqModel
2121
/**
2222
* Endpoint constants.
2323
*/
24-
const ENDPOINT_URL_LISTING = 'user/%s/monetary-account/%s/invoice';
2524
const ENDPOINT_URL_READ = 'user/%s/monetary-account/%s/invoice/%s';
25+
const ENDPOINT_URL_LISTING = 'user/%s/monetary-account/%s/invoice';
2626

2727
/**
2828
* Field constants.
@@ -196,53 +196,53 @@ public function __construct(string $status, string $description, string $exte
196196
}
197197

198198
/**
199-
* This method is called "listing" because "list" is a restricted PHP word and cannot be used as constants, class names,
200-
* function or method names.
201-
*
199+
* @param int $invoiceId
202200
* @param int|null $monetaryAccountId
203-
* @param string[] $params
204201
* @param string[] $customHeaders
205202
*
206-
* @return BunqResponseInvoiceApiObjectList
203+
* @return BunqResponseInvoice
207204
*/
208-
public static function listing(int $monetaryAccountId = null, array $params = [], array $customHeaders = []): BunqResponseInvoiceApiObjectList
205+
public static function get(int $invoiceId, int $monetaryAccountId = null, array $customHeaders = []): BunqResponseInvoice
209206
{
210207
$apiClient = new ApiClient(static::getApiContext());
211208
$responseRaw = $apiClient->get(
212209
vsprintf(
213-
self::ENDPOINT_URL_LISTING,
214-
[static::determineUserId(), static::determineMonetaryAccountId($monetaryAccountId)]
210+
self::ENDPOINT_URL_READ,
211+
[static::determineUserId(), static::determineMonetaryAccountId($monetaryAccountId), $invoiceId]
215212
),
216-
$params,
213+
[],
217214
$customHeaders
218215
);
219216

220-
return BunqResponseInvoiceApiObjectList::castFromBunqResponse(
221-
static::fromJsonList($responseRaw, self::OBJECT_TYPE_GET)
217+
return BunqResponseInvoice::castFromBunqResponse(
218+
static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
222219
);
223220
}
224221

225222
/**
226-
* @param int $invoiceId
223+
* This method is called "listing" because "list" is a restricted PHP word and cannot be used as constants, class names,
224+
* function or method names.
225+
*
227226
* @param int|null $monetaryAccountId
227+
* @param string[] $params
228228
* @param string[] $customHeaders
229229
*
230-
* @return BunqResponseInvoice
230+
* @return BunqResponseInvoiceApiObjectList
231231
*/
232-
public static function get(int $invoiceId, int $monetaryAccountId = null, array $customHeaders = []): BunqResponseInvoice
232+
public static function listing(int $monetaryAccountId = null, array $params = [], array $customHeaders = []): BunqResponseInvoiceApiObjectList
233233
{
234234
$apiClient = new ApiClient(static::getApiContext());
235235
$responseRaw = $apiClient->get(
236236
vsprintf(
237-
self::ENDPOINT_URL_READ,
238-
[static::determineUserId(), static::determineMonetaryAccountId($monetaryAccountId), $invoiceId]
237+
self::ENDPOINT_URL_LISTING,
238+
[static::determineUserId(), static::determineMonetaryAccountId($monetaryAccountId)]
239239
),
240-
[],
240+
$params,
241241
$customHeaders
242242
);
243243

244-
return BunqResponseInvoice::castFromBunqResponse(
245-
static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
244+
return BunqResponseInvoiceApiObjectList::castFromBunqResponse(
245+
static::fromJsonList($responseRaw, self::OBJECT_TYPE_GET)
246246
);
247247
}
248248

0 commit comments

Comments
 (0)