Skip to content

Commit

Permalink
Merge branch 'add_missing_endpoints' of github.com:sandervanhooft/mol…
Browse files Browse the repository at this point in the history
…lie-api-php into add_missing_endpoints
  • Loading branch information
sandervanhooft committed Jul 17, 2024
2 parents 468f376 + 3b362dd commit e839d85
Show file tree
Hide file tree
Showing 9 changed files with 274 additions and 53 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The easiest way to install the Mollie API client is by using [Composer](http://g
composer require mollie/mollie-api-php
```

To work with the most recent API version, ensure that you are using a version of this API client that is equal to or greater than 2.0.0. If you prefer to continue using the v1 API, make sure your client version is below 2.0.0. For guidance on transitioning from v1 to v2, please refer to the [migration notes](https://docs.mollie.com/migrating-v1-to-v2).
To work with the most recent API version, ensure that you are using a version of this API client that is equal to or greater than 2.0.0. If you prefer to continue using the v1 API, make sure your client version is below 2.0.0. For guidance on transitioning from v1 to v2, please refer to the [migration notes](https://docs.mollie.com/docs/migrating-from-v1-to-v2).

### Manual Installation ###
If you're not familiar with using composer we've added a ZIP file to the releases containing the API client and all the packages normally installed by composer.
Expand Down
4 changes: 2 additions & 2 deletions src/Endpoints/MandateEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function iteratorFor(Customer $customer, ?string $from = null, ?int $limi

/**
* @param string $customerId
* @param null $from
* @param null $limit
* @param string|null $from
* @param int|null $limit
* @param array $parameters
*
* @return \Mollie\Api\Resources\MandateCollection
Expand Down
4 changes: 2 additions & 2 deletions src/Endpoints/OnboardingEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public function get()
}

/**
* @deprecated 2023-05-01 For an alternative, see https://docs.mollie.com/reference/create-client-link .
* Submit data that will be prefilled in the merchant’s onboarding.
* Please note that the data you submit will only be processed when the onboarding status is needs-data.
*
* Information that the merchant has entered in their dashboard will not be overwritten.
*
* Will throw a ApiException if the resource cannot be found.
*
* Will throw an ApiException if the resource cannot be found.
* @throws ApiException
*/
public function submit(array $parameters = [])
Expand Down
93 changes: 93 additions & 0 deletions src/Endpoints/PaymentLinkPaymentEndpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

declare(strict_types=1);

namespace Mollie\Api\Endpoints;

use Mollie\Api\Resources\LazyCollection;
use Mollie\Api\Resources\Payment;
use Mollie\Api\Resources\PaymentCollection;
use Mollie\Api\Resources\PaymentLink;

class PaymentLinkPaymentEndpoint extends CollectionEndpointAbstract
{
protected $resourcePath = 'payment-links_payments';

/**
* @inheritDoc
*/
protected function getResourceCollectionObject($count, $_links)
{
return new PaymentCollection($this->client, $count, $_links);
}

/**
* @inheritDoc
*/
protected function getResourceObject()
{
return new Payment($this->client);
}

public function pageForId(string $paymentLinkId, string $from = null, int $limit = null, array $filters = [])
{
$this->parentId = $paymentLinkId;

return $this->rest_list($from, $limit, $filters);
}

public function pageFor(PaymentLink $paymentLink, string $from = null, int $limit = null, array $filters = [])
{
return $this->pageForId($paymentLink->id, $from, $limit, $filters);
}

/**
* Create an iterator for iterating over payments associated with the provided Payment Link id, retrieved from Mollie.
*
* @param string $paymentLinkId
* @param string|null $from The first resource ID you want to include in your list.
* @param int|null $limit
* @param array $parameters
* @param bool $iterateBackwards Set to true for reverse order iteration (default is false).
*
* @return LazyCollection
*/
public function iteratorForId(
string $paymentLinkId,
?string $from = null,
?int $limit = null,
array $parameters = [],
bool $iterateBackwards = false
): LazyCollection {
$this->parentId = $paymentLinkId;

return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards);
}

/**
* Create an iterator for iterating over payments associated with the provided Payment Link object, retrieved from Mollie.
*
* @param PaymentLink $paymentLink
* @param string|null $from The first resource ID you want to include in your list.
* @param int|null $limit
* @param array $parameters
* @param bool $iterateBackwards Set to true for reverse order iteration (default is false).
*
* @return LazyCollection
*/
public function iteratorFor(
PaymentLink $paymentLink,
?string $from = null,
?int $limit = null,
array $parameters = [],
bool $iterateBackwards = false
): LazyCollection {
return $this->iteratorForId(
$paymentLink->id,
$from,
$limit,
$parameters,
$iterateBackwards
);
}
}
8 changes: 4 additions & 4 deletions src/Endpoints/PaymentRefundEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public function listFor(Payment $payment, array $parameters = [])
* Create an iterator for iterating over refunds for the given payment, retrieved from Mollie.
*
* @param Payment $payment
* @param string $from The first resource ID you want to include in your list.
* @param int $limit
* @param string|null $from The first resource ID you want to include in your list.
* @param int|null $limit
* @param array $parameters
* @param bool $iterateBackwards Set to true for reverse order iteration (default is false).
*
Expand Down Expand Up @@ -108,8 +108,8 @@ public function listForId($paymentId, array $parameters = [])
* Create an iterator for iterating over refunds for the given payment id, retrieved from Mollie.
*
* @param string $paymentId
* @param string $from The first resource ID you want to include in your list.
* @param int $limit
* @param string|null $from The first resource ID you want to include in your list.
* @param int|null $limit
* @param array $parameters
* @param bool $iterateBackwards Set to true for reverse order iteration (default is false).
*
Expand Down
97 changes: 53 additions & 44 deletions src/MollieApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Mollie\Api\Endpoints\PaymentChargebackEndpoint;
use Mollie\Api\Endpoints\PaymentEndpoint;
use Mollie\Api\Endpoints\PaymentLinkEndpoint;
use Mollie\Api\Endpoints\PaymentLinkPaymentEndpoint;
use Mollie\Api\Endpoints\PaymentRefundEndpoint;
use Mollie\Api\Endpoints\PaymentRouteEndpoint;
use Mollie\Api\Endpoints\PermissionEndpoint;
Expand Down Expand Up @@ -52,7 +53,7 @@ class MollieApiClient
/**
* Version of our client.
*/
public const CLIENT_VERSION = "2.69.0";
public const CLIENT_VERSION = "2.70.0";

/**
* Endpoint of the remote API.
Expand Down Expand Up @@ -305,6 +306,13 @@ class MollieApiClient
*/
public $orderRefunds;

/**
* RESTful Payment Link Payment resource.
*
* @var PaymentLinkPaymentEndpoint
*/
public $paymentLinkPayments;

/**
* Manages Payment Links requests
*
Expand Down Expand Up @@ -333,6 +341,20 @@ class MollieApiClient
*/
public $wallets;

/**
* RESTful Client resource.
*
* @var ClientEndpoint
*/
public $clients;

/**
* RESTful Client resource.
*
* @var ClientLinkEndpoint
*/
public $clientLinks;

/**
* @var string
*/
Expand Down Expand Up @@ -363,20 +385,6 @@ class MollieApiClient
*/
protected $versionStrings = [];

/**
* RESTful Client resource.
*
* @var ClientEndpoint
*/
public $clients;

/**
* RESTful Client resource.
*
* @var ClientLinkEndpoint
*/
public $clientLinks;

/**
* @param \GuzzleHttp\ClientInterface|\Mollie\Api\HttpAdapter\MollieHttpAdapterInterface|null $httpClient
* @param \Mollie\Api\HttpAdapter\MollieHttpAdapterPickerInterface|null $httpAdapterPicker,
Expand All @@ -398,45 +406,46 @@ public function __construct($httpClient = null, $httpAdapterPicker = null, $idem

public function initializeEndpoints()
{
$this->payments = new PaymentEndpoint($this);
$this->methods = new MethodEndpoint($this);
$this->profileMethods = new ProfileMethodEndpoint($this);
$this->methodIssuers = new MethodIssuerEndpoint($this);
$this->customers = new CustomerEndpoint($this);
$this->settlements = new SettlementsEndpoint($this);
$this->settlementCaptures = new SettlementCaptureEndpoint($this);
$this->settlementChargebacks = new SettlementChargebackEndpoint($this);
$this->settlementPayments = new SettlementPaymentEndpoint($this);
$this->settlementRefunds = new SettlementRefundEndpoint($this);
$this->subscriptions = new SubscriptionEndpoint($this);
$this->subscriptionPayments = new SubscriptionPaymentEndpoint($this);
$this->customerPayments = new CustomerPaymentsEndpoint($this);
$this->mandates = new MandateEndpoint($this);
$this->balances = new BalanceEndpoint($this);
$this->balanceTransactions = new BalanceTransactionEndpoint($this);
$this->balanceReports = new BalanceReportEndpoint($this);
$this->balanceTransactions = new BalanceTransactionEndpoint($this);
$this->balances = new BalanceEndpoint($this);
$this->chargebacks = new ChargebackEndpoint($this);
$this->clientLinks = new ClientLinkEndpoint($this);
$this->clients = new ClientEndpoint($this);
$this->customerPayments = new CustomerPaymentsEndpoint($this);
$this->customers = new CustomerEndpoint($this);
$this->invoices = new InvoiceEndpoint($this);
$this->permissions = new PermissionEndpoint($this);
$this->profiles = new ProfileEndpoint($this);
$this->mandates = new MandateEndpoint($this);
$this->methods = new MethodEndpoint($this);
$this->methodIssuers = new MethodIssuerEndpoint($this);
$this->onboarding = new OnboardingEndpoint($this);
$this->organizations = new OrganizationEndpoint($this);
$this->orders = new OrderEndpoint($this);
$this->orderLines = new OrderLineEndpoint($this);
$this->orderPayments = new OrderPaymentEndpoint($this);
$this->orderRefunds = new OrderRefundEndpoint($this);
$this->shipments = new ShipmentEndpoint($this);
$this->refunds = new RefundEndpoint($this);
$this->paymentRefunds = new PaymentRefundEndpoint($this);
$this->orders = new OrderEndpoint($this);
$this->organizationPartners = new OrganizationPartnerEndpoint($this);
$this->organizations = new OrganizationEndpoint($this);
$this->paymentCaptures = new PaymentCaptureEndpoint($this);
$this->paymentRoutes = new PaymentRouteEndpoint($this);
$this->chargebacks = new ChargebackEndpoint($this);
$this->paymentChargebacks = new PaymentChargebackEndpoint($this);
$this->wallets = new WalletEndpoint($this);
$this->paymentLinkPayments = new PaymentLinkPaymentEndpoint($this);
$this->paymentLinks = new PaymentLinkEndpoint($this);
$this->paymentRefunds = new PaymentRefundEndpoint($this);
$this->paymentRoutes = new PaymentRouteEndpoint($this);
$this->payments = new PaymentEndpoint($this);
$this->permissions = new PermissionEndpoint($this);
$this->profileMethods = new ProfileMethodEndpoint($this);
$this->profiles = new ProfileEndpoint($this);
$this->refunds = new RefundEndpoint($this);
$this->settlementCaptures = new SettlementCaptureEndpoint($this);
$this->settlementChargebacks = new SettlementChargebackEndpoint($this);
$this->settlementPayments = new SettlementPaymentEndpoint($this);
$this->settlementRefunds = new SettlementRefundEndpoint($this);
$this->settlements = new SettlementsEndpoint($this);
$this->shipments = new ShipmentEndpoint($this);
$this->subscriptionPayments = new SubscriptionPaymentEndpoint($this);
$this->subscriptions = new SubscriptionEndpoint($this);
$this->terminals = new TerminalEndpoint($this);
$this->organizationPartners = new OrganizationPartnerEndpoint($this);
$this->clients = new ClientEndpoint($this);
$this->clientLinks = new ClientLinkEndpoint($this);
$this->wallets = new WalletEndpoint($this);
}

protected function initializeVersionStrings()
Expand Down
18 changes: 18 additions & 0 deletions src/Resources/PaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,24 @@ public function archive()
return $this->client->paymentLinks->update($this->id, $data);
}

/**
* Retrieve a paginated list of payments associated with this payment link.
*
* @param string|null $from
* @param int|null $limit
* @param array $filters
* @return mixed|\Mollie\Api\Resources\BaseCollection
*/
public function payments(string $from = null, int $limit = null, array $filters = [])
{
return $this->client->paymentLinkPayments->pageFor(
$this,
$from,
$limit,
$this->withPresetOptions($filters)
);
}

/**
* When accessed by oAuth we want to pass the testmode by default
*
Expand Down
11 changes: 11 additions & 0 deletions src/Types/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class PaymentMethod
public const GIFTCARD = "giftcard";

/**
* @deprecated
* @link https://www.mollie.com/en/payments/giropay
*/
public const GIROPAY = "giropay";
Expand Down Expand Up @@ -121,6 +122,11 @@ class PaymentMethod
*/
public const MYBANK = "mybank";

/**
* @link https://www.mollie.com/en/payments/payconiq
*/
public const PAYCONIQ = "payconiq";

/**
* @link https://www.mollie.com/en/payments/paypal
*/
Expand Down Expand Up @@ -157,6 +163,11 @@ class PaymentMethod
*/
public const RIVERTY = "riverty";

/**
* @link https://www.mollie.com/en/payments/trustly
*/
public const TRUSTLY = "trustly";

/**
* @link https://www.mollie.com/en/payments/twint
*/
Expand Down
Loading

0 comments on commit e839d85

Please sign in to comment.