Skip to content

Commit

Permalink
merge in changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Jun 24, 2024
2 parents f66f9c0 + 5c29df8 commit c5bdbd2
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To use the Mollie API client, the following things are required:
+ Get yourself a free [Mollie account](https://www.mollie.com/signup). No sign up costs.
+ Now you're ready to use the Mollie API client in test mode.
+ Follow [a few steps](https://www.mollie.com/dashboard/?modal=onboarding) to enable payment methods in live mode, and let us handle the rest.
+ PHP >= 7.0
+ PHP >= 7.2
+ Up-to-date OpenSSL (or other SSL/TLS toolkit)

For leveraging [Mollie Connect](https://docs.mollie.com/oauth/overview) (advanced use cases only), we recommend also installing our [OAuth2 client](https://github.com/mollie/oauth2-mollie-php).
Expand Down
24 changes: 24 additions & 0 deletions src/Endpoints/OrderRefundEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,28 @@ public function createForId(string $orderId, array $data, array $filters = []):

return parent::rest_create($data, $filters);
}

/**
* @param $orderId
* @param array $parameters
* @return RefundCollection
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function pageForId($orderId, array $parameters = [])
{
$this->parentId = $orderId;

return parent::rest_list(null, null, $parameters);
}

/**
* @param \Mollie\Api\Resources\Order $order
* @param array $parameters
* @return \Mollie\Api\Resources\RefundCollection
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function pageFor(Order $order, array $parameters = [])
{
return $this->pageForId($order->id, $parameters);
}
}
4 changes: 2 additions & 2 deletions src/Endpoints/RestEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function rest_update(string $id, array $body = []): ?BaseResource
*/
protected function rest_read(string $id, array $filters): BaseResource
{
if (! $this instanceof SingleResourceEndpoint && empty($id)) {
if (!$this instanceof SingleResourceEndpoint && empty($id)) {
throw new ApiException("Invalid resource id.");
}

Expand All @@ -79,7 +79,7 @@ protected function rest_read(string $id, array $filters): BaseResource
}

/**
* Sends a DELETE request to a single Molle API object.
* Sends a DELETE request to a single Mollie API object.
*
* @param string $id
* @param array $body
Expand Down
2 changes: 1 addition & 1 deletion src/MollieApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MollieApiClient
/**
* Version of our client.
*/
public const CLIENT_VERSION = "2.64.0";
public const CLIENT_VERSION = "2.68.0";

/**
* Endpoint of the remote API.
Expand Down
16 changes: 16 additions & 0 deletions src/Resources/Capture.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class Capture extends BaseResource
*/
public $mode;

/**
* Status of the capture.
*
* @var string
*/
public $status;

/**
* Amount object containing the value and currency
*
Expand Down Expand Up @@ -59,6 +66,15 @@ class Capture extends BaseResource
*/
public $settlementId;

/**
* Provide any data you like, for example a string or a JSON object. The data will be saved alongside the capture.
* Whenever you fetch the capture, the metadata will be included.
* You can use up to approximately 1kB on this field.
*
* @var \stdClass|mixed|null
*/
public $metadata;

/**
* @var string
*/
Expand Down
16 changes: 2 additions & 14 deletions src/Resources/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Mollie\Api\Resources;

use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\MollieApiClient;
use Mollie\Api\Types\OrderStatus;

class Order extends BaseResource
Expand Down Expand Up @@ -81,7 +80,7 @@ class Order extends BaseResource
public $orderNumber;

/**
* The person and the address the order is billed to.
* The person and the address the order is shipped to.
*
* @var \stdClass
*/
Expand Down Expand Up @@ -474,18 +473,7 @@ public function refundAll(array $data = [])
*/
public function refunds()
{
if (! isset($this->_links->refunds->href)) {
return new RefundCollection($this->client, 0, null);
}

$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->refunds->href);

return ResourceFactory::createCursorResourceCollection(
$this->client,
$result->_embedded->refunds,
Refund::class,
$result->_links
);
return $this->client->orderRefunds->pageFor($this);
}

/**
Expand Down
27 changes: 26 additions & 1 deletion src/Resources/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class Payment extends BaseResource
*
* @example "[email protected]"
* @var string|null
* @deprecated 2024-06-01 The billingEmail field is deprecated. Use the "billingAddress" field instead.
*/
public $billingEmail;

Expand Down Expand Up @@ -207,6 +208,27 @@ class Payment extends BaseResource
*/
public $orderId;

/**
* The lines contain the actual items the customer bought.
*
* @var array|object[]|null
*/
public $lines;

/**
* The person and the address the order is billed to.
*
* @var \stdClass|null
*/
public $billingAddress;

/**
* The person and the address the order is shipped to.
*
* @var \stdClass|null
*/
public $shippingAddress;

/**
* The settlement ID this payment belongs to.
*
Expand Down Expand Up @@ -729,7 +751,10 @@ public function update()
"dueDate" => $this->dueDate,
];

$result = $this->client->payments->update($this->id, $body);
$result = $this->client->payments->update(
$this->id,
$this->withPresetOptions($body)
);

return ResourceFactory::createFromApiResult($result, new Payment($this->client));
}
Expand Down
42 changes: 31 additions & 11 deletions src/Types/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@

class PaymentMethod
{
/**
* @link https://www.mollie.com/en/payments/alma
*/
public const ALMA = "alma";

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

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

/**
* @link https://www.mollie.com/en/payments/bancontact
*/
Expand All @@ -34,6 +44,11 @@ class PaymentMethod
*/
public const BITCOIN = "bitcoin";

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

/**
* @link https://www.mollie.com/en/payments/credit-card
*/
Expand All @@ -59,6 +74,11 @@ class PaymentMethod
*/
public const GIROPAY = "giropay";

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

/**
* @link https://www.mollie.com/en/payments/ideal
*/
Expand Down Expand Up @@ -111,31 +131,31 @@ class PaymentMethod
*/
public const PAYSAFECARD = "paysafecard";

/**
* @link https://www.mollie.com/en/payments/przelewy24
*/
public const PRZELEWY24 = 'przelewy24';

/**
* @deprecated
* @link https://www.mollie.com/en/payments/gift-cards
*/
public const PODIUMCADEAUKAART = "podiumcadeaukaart";

/**
* @link https://www.mollie.com/en/payments/sofort
* @link https://docs.mollie.com/point-of-sale/overview
*/
public const SOFORT = "sofort";
public const POINT_OF_SALE = "pointofsale";

/**
* @link https://www.mollie.com/en/payments/in3
* @link https://www.mollie.com/en/payments/przelewy24
*/
public const IN3 = "in3";
public const PRZELEWY24 = 'przelewy24';

/**
* @link https://docs.mollie.com/point-of-sale/overview
* @link https://www.mollie.com/en/payments/sofort
*/
public const POINT_OF_SALE = "pointofsale";
public const SOFORT = "sofort";

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

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

0 comments on commit c5bdbd2

Please sign in to comment.