allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
114
vendor/mollie/mollie-api-php/src/Resources/Balance.php
vendored
Normal file
114
vendor/mollie/mollie-api-php/src/Resources/Balance.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Balance extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Indicates this is a balance resource. The value will always be "balance" here.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* The mode used to create this balance. Mode determines whether real or test payments can be moved to this balance.
|
||||
* The value is either "live" or "test".
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* The identifier uniquely referring this balance. Mollie assigns this identifier at balance creation.
|
||||
*
|
||||
* @example bal_gVMhHKqSSRYJyPsuoPABC
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* UTC datetime the balance was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2021-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* The balance's ISO 4217 currency code.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $currency;
|
||||
|
||||
/**
|
||||
* The status of the balance: "active" if the balance is operational and ready to be used.
|
||||
* The status is "inactive" if the account is still being validated by Mollie or if the balance has been blocked.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* The total amount directly available on the balance.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $availableAmount;
|
||||
|
||||
/**
|
||||
* The total amount queued to be transferred to your balance.
|
||||
* For example, a credit card payment can take a few days to clear.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $incomingAmount;
|
||||
|
||||
/**
|
||||
* The total amount that is in the process of being transferred from your balance to your verified bank account.
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $outgoingAmount;
|
||||
|
||||
/**
|
||||
* The frequency at which the available amount on the balance will be transferred away to the configured transfer
|
||||
* destination. See "transferDestination". Note that if the transfer is for an external destination, and the
|
||||
* transfer is created in a weekend or during a bank holiday, the actual bank transfer will take place on the next
|
||||
* business day.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $transferFrequency;
|
||||
|
||||
/**
|
||||
* The minimum amount configured for scheduled automatic balance transfers. As soon as the amount on the balance
|
||||
* exceeds this threshold, the complete balance will be paid out to the "transferDestination" according to the
|
||||
* configured "transferFrequency".
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $transferThreshold;
|
||||
|
||||
/**
|
||||
* The reference to be included on all transfers for this balance.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $transferReference;
|
||||
|
||||
/**
|
||||
* The destination where the available amount will be automatically transferred to according to the configured
|
||||
* "transferFrequency".
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $transferDestination;
|
||||
|
||||
/**
|
||||
* Links to help navigate through the Mollie API and related resources.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/BalanceCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/BalanceCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class BalanceCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "balances";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Balance($this->client);
|
||||
}
|
||||
}
|
||||
80
vendor/mollie/mollie-api-php/src/Resources/BalanceReport.php
vendored
Normal file
80
vendor/mollie/mollie-api-php/src/Resources/BalanceReport.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class BalanceReport extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Indicates the response contains a balance report object. Will always contain "balance-report" for this endpoint.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* The ID of the balance this report was generated for.
|
||||
*
|
||||
* @example bal_gVMhHKqSSRYJyPsuoPNFH
|
||||
* @var string
|
||||
*/
|
||||
public $balanceId;
|
||||
|
||||
/**
|
||||
* The time zone used for the "from" and "until" parameters.
|
||||
* Currently only time zone "Europe/Amsterdam" is supported.
|
||||
*
|
||||
*
|
||||
* @example Europe/Amsterdam
|
||||
* @var string
|
||||
*/
|
||||
public $timeZone;
|
||||
|
||||
/**
|
||||
* The start date of the report, in YYYY-MM-DD format. The "from" date is ‘inclusive’, and in Central European Time.
|
||||
* This means a report with for example "from: 2020-01-01" will include movements of "2020-01-01 0:00:00 CET" and
|
||||
* onwards.
|
||||
*
|
||||
*
|
||||
* @example 2020-01-01
|
||||
* @var string
|
||||
*/
|
||||
public $from;
|
||||
|
||||
/**
|
||||
* The end date of the report, in YYYY-MM-DD format. The "until" date is ‘exclusive’, and in Central European Time.
|
||||
* This means a report with for example "until: 2020-02-01" will include movements up
|
||||
* until "2020-01-31 23:59:59 CET".
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $until;
|
||||
|
||||
/**
|
||||
* You can retrieve reports in two different formats: "status-balances" or "transaction-categories".
|
||||
* With the "status-balances" format, transactions are grouped by status (e.g. "pending", "available"), then by
|
||||
* direction of movement (e.g. moved from "pending" to "available"), then by transaction type, and then by other
|
||||
* sub-groupings where available (e.g. payment method).
|
||||
* With the "transaction-categories" format, transactions are grouped by transaction type, then by direction of
|
||||
* movement, and then again by other sub-groupings where available. Both reporting formats will always contain
|
||||
* opening and closing amounts that correspond to the start and end dates of the report.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $grouping;
|
||||
|
||||
/**
|
||||
* The balance report totals, structured according to the defined "grouping".
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $totals;
|
||||
|
||||
/**
|
||||
* Links to help navigate through the API.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
}
|
||||
83
vendor/mollie/mollie-api-php/src/Resources/BalanceTransaction.php
vendored
Normal file
83
vendor/mollie/mollie-api-php/src/Resources/BalanceTransaction.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class BalanceTransaction extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Indicates this is a balance transaction resource. The value will always be "balance_transaction" here.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* The mode used to create this balance transaction. Mode determines whether real or test payments can be moved to
|
||||
* this balance. The value is either "live" or "test".
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* The identifier uniquely referring this balance transaction. Mollie assigns this identifier at creation.
|
||||
*
|
||||
* @example baltr_QM24QwzUWR4ev4Xfgyt29d
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The type of movement, for example "payment" or "refund".
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* UTC datetime the balance transaction was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2021-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* The final amount that was moved to or from the balance. If the transaction moves funds away from the balance,
|
||||
* for example when it concerns a refund, the amount will be negative.
|
||||
*
|
||||
* @example {"currency":"EUR", "value":"100.00"}
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $resultAmount;
|
||||
|
||||
/**
|
||||
* The amount that was to be moved to or from the balance, excluding deductions. If the transaction moves funds
|
||||
* away from the balance, for example when it concerns a refund, the amount will be negative.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $initialAmount;
|
||||
|
||||
/**
|
||||
* The total amount of deductions withheld from the movement. For example, if a €10,00 payment comes in with a
|
||||
* €0,29 fee, the deductions amount will be {"currency":"EUR", "value":"-0.29"}. When moving funds to a balance,
|
||||
* we always round the deduction to a ‘real’ amount. Any differences between these realtime rounded amounts and
|
||||
* the final invoice will be compensated when the invoice is generated.
|
||||
*
|
||||
* @example {"currency":"EUR", "value":"-0.29"}
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $deductions;
|
||||
|
||||
/**
|
||||
* Depending on the type of the balance transaction, we will try to give more context about the specific event that
|
||||
* triggered the movement.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $context;
|
||||
}
|
||||
24
vendor/mollie/mollie-api-php/src/Resources/BalanceTransactionCollection.php
vendored
Normal file
24
vendor/mollie/mollie-api-php/src/Resources/BalanceTransactionCollection.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class BalanceTransactionCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "balance_transactions";
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new BalanceTransaction($this->client);
|
||||
}
|
||||
}
|
||||
34
vendor/mollie/mollie-api-php/src/Resources/BaseCollection.php
vendored
Normal file
34
vendor/mollie/mollie-api-php/src/Resources/BaseCollection.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
abstract class BaseCollection extends \ArrayObject
|
||||
{
|
||||
/**
|
||||
* Total number of retrieved objects.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $count;
|
||||
|
||||
/**
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @param int $count
|
||||
* @param \stdClass|null $_links
|
||||
*/
|
||||
public function __construct($count, $_links)
|
||||
{
|
||||
$this->count = $count;
|
||||
$this->_links = $_links;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
abstract public function getCollectionResourceName();
|
||||
}
|
||||
31
vendor/mollie/mollie-api-php/src/Resources/BaseResource.php
vendored
Normal file
31
vendor/mollie/mollie-api-php/src/Resources/BaseResource.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\MollieApiClient;
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class BaseResource
|
||||
{
|
||||
/**
|
||||
* @var MollieApiClient
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* Indicates the type of resource.
|
||||
*
|
||||
* @example payment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* @param MollieApiClient $client
|
||||
*/
|
||||
public function __construct(MollieApiClient $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
}
|
||||
66
vendor/mollie/mollie-api-php/src/Resources/Capability.php
vendored
Normal file
66
vendor/mollie/mollie-api-php/src/Resources/Capability.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\CapabilityStatus;
|
||||
|
||||
class Capability extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @example payments
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $requirements;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* possible values: disabled, pending, enabled
|
||||
*
|
||||
* @example enabled
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $statusReason;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $organizationId;
|
||||
|
||||
/**
|
||||
* Links to help navigate through the Mollie API and related resources.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
return $this->status === CapabilityStatus::ENABLED;
|
||||
}
|
||||
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === CapabilityStatus::PENDING;
|
||||
}
|
||||
|
||||
public function isDisabled()
|
||||
{
|
||||
return $this->status === CapabilityStatus::DISABLED;
|
||||
}
|
||||
}
|
||||
14
vendor/mollie/mollie-api-php/src/Resources/CapabilityCollection.php
vendored
Normal file
14
vendor/mollie/mollie-api-php/src/Resources/CapabilityCollection.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class CapabilityCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "capabilities";
|
||||
}
|
||||
}
|
||||
87
vendor/mollie/mollie-api-php/src/Resources/Capture.php
vendored
Normal file
87
vendor/mollie/mollie-api-php/src/Resources/Capture.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Capture extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Always 'capture' for this object
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* Id of the capture
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Mode of the capture, either "live" or "test" depending on the API Key that was used.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* Status of the capture.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* Amount object containing the value and currency
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* Amount object containing the settlement value and currency
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $settlementAmount;
|
||||
|
||||
/**
|
||||
* Id of the capture's payment (on the Mollie platform).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $paymentId;
|
||||
|
||||
/**
|
||||
* Id of the capture's shipment (on the Mollie platform).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $shipmentId;
|
||||
|
||||
/**
|
||||
* Id of the capture's settlement (on the Mollie platform).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/CaptureCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/CaptureCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class CaptureCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "captures";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Capture($this->client);
|
||||
}
|
||||
}
|
||||
76
vendor/mollie/mollie-api-php/src/Resources/Chargeback.php
vendored
Normal file
76
vendor/mollie/mollie-api-php/src/Resources/Chargeback.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Chargeback extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Always 'chargeback'.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* Id of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The $amount that was refunded.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* The payment id that was refunded.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $paymentId;
|
||||
|
||||
/**
|
||||
* The settlement amount.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $settlementAmount;
|
||||
|
||||
/**
|
||||
* The identifier referring to the settlement this payment was settled with.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $settlementId;
|
||||
|
||||
/**
|
||||
* The chargeback reason
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $reason;
|
||||
|
||||
/**
|
||||
* UTC datetime the date and time the chargeback was reversed in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $reversedAt;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/ChargebackCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/ChargebackCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class ChargebackCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "chargebacks";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Chargeback($this->client);
|
||||
}
|
||||
}
|
||||
36
vendor/mollie/mollie-api-php/src/Resources/Client.php
vendored
Normal file
36
vendor/mollie/mollie-api-php/src/Resources/Client.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Client extends BaseResource
|
||||
{
|
||||
/**
|
||||
* The unique identifier of the client, which corresponds to the ID of the organization
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* UTC datetime the order was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2018-03-21T13:13:37+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $organizationCreatedAt;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @var \stdClass[]
|
||||
*/
|
||||
public $_embedded;
|
||||
|
||||
/**
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $commission;
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/ClientCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/ClientCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class ClientCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "clients";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Client($this->client);
|
||||
}
|
||||
}
|
||||
49
vendor/mollie/mollie-api-php/src/Resources/ClientLink.php
vendored
Normal file
49
vendor/mollie/mollie-api-php/src/Resources/ClientLink.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\ApprovalPrompt;
|
||||
|
||||
class ClientLink extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* Id of the client link.
|
||||
*
|
||||
* @example csr_vZCnNQsV2UtfXxYifWKWH
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* An object with several URL objects relevant to the client link. Every URL object will contain an href and a type field.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* Get the redirect URL where the customer can complete the payment.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRedirectUrl(string $client_id, string $state, array $scopes = [], string $approval_prompt = ApprovalPrompt::AUTO)
|
||||
{
|
||||
if (! in_array($approval_prompt, [ApprovalPrompt::AUTO, ApprovalPrompt::FORCE])) {
|
||||
throw new \Exception('Invalid approval_prompt. Please use "auto" or "force".');
|
||||
}
|
||||
|
||||
$query = http_build_query([
|
||||
'client_id' => $client_id,
|
||||
'state' => $state,
|
||||
'approval_prompt' => $approval_prompt,
|
||||
'scope' => implode(' ', $scopes),
|
||||
], '', '&', PHP_QUERY_RFC3986);
|
||||
|
||||
return "{$this->_links->clientLink->href}?{$query}";
|
||||
}
|
||||
}
|
||||
34
vendor/mollie/mollie-api-php/src/Resources/CurrentProfile.php
vendored
Normal file
34
vendor/mollie/mollie-api-php/src/Resources/CurrentProfile.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Exceptions\ApiException;
|
||||
|
||||
class CurrentProfile extends Profile
|
||||
{
|
||||
/**
|
||||
* Enable a payment method for this profile.
|
||||
*
|
||||
* @param string $methodId
|
||||
* @param array $data
|
||||
* @return Method
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function enableMethod($methodId, array $data = [])
|
||||
{
|
||||
return $this->client->profileMethods->createForCurrentProfile($methodId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable a payment method for this profile.
|
||||
*
|
||||
* @param string $methodId
|
||||
* @param array $data
|
||||
* @return Method
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function disableMethod($methodId, array $data = [])
|
||||
{
|
||||
return $this->client->profileMethods->deleteForCurrentProfile($methodId, $data);
|
||||
}
|
||||
}
|
||||
125
vendor/mollie/mollie-api-php/src/Resources/CursorCollection.php
vendored
Normal file
125
vendor/mollie/mollie-api-php/src/Resources/CursorCollection.php
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Generator;
|
||||
use Mollie\Api\MollieApiClient;
|
||||
|
||||
abstract class CursorCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @var MollieApiClient
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @param MollieApiClient $client
|
||||
* @param int $count
|
||||
* @param \stdClass|null $_links
|
||||
*/
|
||||
final public function __construct(MollieApiClient $client, $count, $_links)
|
||||
{
|
||||
parent::__construct($count, $_links);
|
||||
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
abstract protected function createResourceObject();
|
||||
|
||||
/**
|
||||
* Return the next set of resources when available
|
||||
*
|
||||
* @return CursorCollection|null
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
final public function next()
|
||||
{
|
||||
if (! $this->hasNext()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->next->href);
|
||||
|
||||
$collection = new static($this->client, $result->count, $result->_links);
|
||||
|
||||
foreach ($result->_embedded->{$collection->getCollectionResourceName()} as $dataResult) {
|
||||
$collection[] = ResourceFactory::createFromApiResult($dataResult, $this->createResourceObject());
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the previous set of resources when available
|
||||
*
|
||||
* @return CursorCollection|null
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
final public function previous()
|
||||
{
|
||||
if (! $this->hasPrevious()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->previous->href);
|
||||
|
||||
$collection = new static($this->client, $result->count, $result->_links);
|
||||
|
||||
foreach ($result->_embedded->{$collection->getCollectionResourceName()} as $dataResult) {
|
||||
$collection[] = ResourceFactory::createFromApiResult($dataResult, $this->createResourceObject());
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the collection has a next page available.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasNext()
|
||||
{
|
||||
return isset($this->_links->next->href);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the collection has a previous page available.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPrevious()
|
||||
{
|
||||
return isset($this->_links->previous->href);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over a CursorCollection and yield its elements.
|
||||
*
|
||||
* @param bool $iterateBackwards
|
||||
*
|
||||
* @return LazyCollection
|
||||
*/
|
||||
public function getAutoIterator(bool $iterateBackwards = false): LazyCollection
|
||||
{
|
||||
$page = $this;
|
||||
|
||||
return new LazyCollection(function () use ($page, $iterateBackwards): Generator {
|
||||
while (true) {
|
||||
foreach ($page as $item) {
|
||||
yield $item;
|
||||
}
|
||||
|
||||
if (($iterateBackwards && ! $page->hasPrevious()) || ! $page->hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
$page = $iterateBackwards
|
||||
? $page->previous()
|
||||
: $page->next();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
226
vendor/mollie/mollie-api-php/src/Resources/Customer.php
vendored
Normal file
226
vendor/mollie/mollie-api-php/src/Resources/Customer.php
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Exceptions\ApiException;
|
||||
|
||||
class Customer extends BaseResource
|
||||
{
|
||||
use HasPresetOptions;
|
||||
|
||||
/**
|
||||
* Id of the customer.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Either "live" or "test". Indicates this being a test or a live (verified) customer.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* @var \stdClass|mixed|null
|
||||
*/
|
||||
public $metadata;
|
||||
|
||||
/**
|
||||
* @var string[]|array
|
||||
*/
|
||||
public $recentlyUsedMethods;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @return \Mollie\Api\Resources\Customer
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = [
|
||||
"name" => $this->name,
|
||||
"email" => $this->email,
|
||||
"locale" => $this->locale,
|
||||
"metadata" => $this->metadata,
|
||||
];
|
||||
|
||||
$result = $this->client->customers->update($this->id, $body);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Customer($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
* @param array $filters
|
||||
*
|
||||
* @return Payment
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function createPayment(array $options = [], array $filters = [])
|
||||
{
|
||||
return $this->client->customerPayments->createFor($this, $this->withPresetOptions($options), $filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all payments for this customer
|
||||
*
|
||||
* @return PaymentCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function payments()
|
||||
{
|
||||
return $this->client->customerPayments->listFor($this, null, null, $this->getPresetOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
* @param array $filters
|
||||
*
|
||||
* @return Subscription
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function createSubscription(array $options = [], array $filters = [])
|
||||
{
|
||||
return $this->client->subscriptions->createFor($this, $this->withPresetOptions($options), $filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $subscriptionId
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Subscription
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function getSubscription($subscriptionId, array $parameters = [])
|
||||
{
|
||||
return $this->client->subscriptions->getFor($this, $subscriptionId, $this->withPresetOptions($parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $subscriptionId
|
||||
*
|
||||
* @return \Mollie\Api\Resources\Subscription
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function cancelSubscription($subscriptionId)
|
||||
{
|
||||
return $this->client->subscriptions->cancelFor($this, $subscriptionId, $this->getPresetOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all subscriptions for this customer
|
||||
*
|
||||
* @return SubscriptionCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function subscriptions()
|
||||
{
|
||||
return $this->client->subscriptions->listFor($this, null, null, $this->getPresetOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
* @param array $filters
|
||||
*
|
||||
* @return Mandate
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function createMandate(array $options = [], array $filters = [])
|
||||
{
|
||||
return $this->client->mandates->createFor($this, $this->withPresetOptions($options), $filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mandateId
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Mandate
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function getMandate($mandateId, array $parameters = [])
|
||||
{
|
||||
return $this->client->mandates->getFor($this, $mandateId, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mandateId
|
||||
*
|
||||
* @return null
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function revokeMandate($mandateId)
|
||||
{
|
||||
return $this->client->mandates->revokeFor($this, $mandateId, $this->getPresetOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all mandates for this customer
|
||||
*
|
||||
* @return MandateCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function mandates()
|
||||
{
|
||||
return $this->client->mandates->listFor($this, null, null, $this->getPresetOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to check for mandate with status valid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasValidMandate()
|
||||
{
|
||||
$mandates = $this->mandates();
|
||||
foreach ($mandates as $mandate) {
|
||||
if ($mandate->isValid()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to check for specific payment method mandate with status valid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasValidMandateForMethod($method)
|
||||
{
|
||||
$mandates = $this->mandates();
|
||||
foreach ($mandates as $mandate) {
|
||||
if ($mandate->method === $method && $mandate->isValid()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/CustomerCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/CustomerCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class CustomerCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "customers";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Customer($this->client);
|
||||
}
|
||||
}
|
||||
38
vendor/mollie/mollie-api-php/src/Resources/HasPresetOptions.php
vendored
Normal file
38
vendor/mollie/mollie-api-php/src/Resources/HasPresetOptions.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\MollieApiClient;
|
||||
|
||||
/**
|
||||
* @property MollieApiClient $client
|
||||
* @property string $mode
|
||||
*/
|
||||
trait HasPresetOptions
|
||||
{
|
||||
/**
|
||||
* When accessed by oAuth we want to pass the testmode by default
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getPresetOptions()
|
||||
{
|
||||
$options = [];
|
||||
if ($this->client->usesOAuth()) {
|
||||
$options["testmode"] = $this->mode === "test" ? true : false;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the preset options.
|
||||
*
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
protected function withPresetOptions(array $options)
|
||||
{
|
||||
return array_merge($this->getPresetOptions(), $options);
|
||||
}
|
||||
}
|
||||
109
vendor/mollie/mollie-api-php/src/Resources/Invoice.php
vendored
Normal file
109
vendor/mollie/mollie-api-php/src/Resources/Invoice.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\InvoiceStatus;
|
||||
|
||||
class Invoice extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $reference;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $vatNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* Date the invoice was issued, e.g. 2018-01-01
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $issuedAt;
|
||||
|
||||
/**
|
||||
* Date the invoice was paid, e.g. 2018-01-01
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $paidAt;
|
||||
|
||||
/**
|
||||
* Date the invoice is due, e.g. 2018-01-01
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $dueAt;
|
||||
|
||||
/**
|
||||
* Amount object containing the total amount of the invoice excluding VAT.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $netAmount;
|
||||
|
||||
/**
|
||||
* Amount object containing the VAT amount of the invoice. Only for merchants registered in the Netherlands.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $vatAmount;
|
||||
|
||||
/**
|
||||
* Total amount of the invoice including VAT.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $grossAmount;
|
||||
|
||||
/**
|
||||
* Array containing the invoice lines.
|
||||
*
|
||||
* @see https://docs.mollie.com/reference/v2/invoices-api/get-invoice
|
||||
* @var array
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
* Contains a PDF to the Invoice
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaid()
|
||||
{
|
||||
return $this->status == InvoiceStatus::STATUS_PAID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isOpen()
|
||||
{
|
||||
return $this->status == InvoiceStatus::STATUS_OPEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isOverdue()
|
||||
{
|
||||
return $this->status == InvoiceStatus::STATUS_OVERDUE;
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/InvoiceCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/InvoiceCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class InvoiceCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "invoices";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Invoice($this->client);
|
||||
}
|
||||
}
|
||||
35
vendor/mollie/mollie-api-php/src/Resources/Issuer.php
vendored
Normal file
35
vendor/mollie/mollie-api-php/src/Resources/Issuer.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Issuer extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Id of the issuer.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Name of the issuer.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The payment method this issuer belongs to.
|
||||
*
|
||||
* @see Mollie_API_Object_Method
|
||||
* @var string
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* Object containing a size1x or size2x image
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $image;
|
||||
}
|
||||
14
vendor/mollie/mollie-api-php/src/Resources/IssuerCollection.php
vendored
Normal file
14
vendor/mollie/mollie-api-php/src/Resources/IssuerCollection.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class IssuerCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
198
vendor/mollie/mollie-api-php/src/Resources/LazyCollection.php
vendored
Normal file
198
vendor/mollie/mollie-api-php/src/Resources/LazyCollection.php
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Iterator;
|
||||
use IteratorAggregate;
|
||||
|
||||
/**
|
||||
* @template TKey of array-key
|
||||
* @template TValue
|
||||
*
|
||||
* @implements IteratorAggregate<TKey, TValue>
|
||||
*/
|
||||
class LazyCollection implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* @param callable $source
|
||||
*/
|
||||
public function __construct($source)
|
||||
{
|
||||
$this->source = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all items in the collection.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
return iterator_to_array($this->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item from the collection by key.
|
||||
*
|
||||
* @param TKey $key
|
||||
* @return TValue|null
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
foreach ($this as $outerKey => $outerValue) {
|
||||
if ($outerKey == $key) {
|
||||
return $outerValue;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a filter over each of the items.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool) $callback
|
||||
* @return self
|
||||
*/
|
||||
public function filter(callable $callback): self
|
||||
{
|
||||
return new self(function () use ($callback) {
|
||||
foreach ($this as $key => $value) {
|
||||
if ($callback($value, $key)) {
|
||||
yield $key => $value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first item from the collection passing the given truth test.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @return TValue|null
|
||||
*/
|
||||
public function first(?callable $callback = null)
|
||||
{
|
||||
$iterator = $this->getIterator();
|
||||
|
||||
if (is_null($callback)) {
|
||||
if (! $iterator->valid()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $iterator->current();
|
||||
}
|
||||
|
||||
foreach ($iterator as $key => $value) {
|
||||
if ($callback($value, $key)) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a map over each of the items.
|
||||
*
|
||||
* @template TMapValue
|
||||
*
|
||||
* @param callable(TValue, TKey): TMapValue $callback
|
||||
* @return static<TKey, TMapValue>
|
||||
*/
|
||||
public function map(callable $callback): self
|
||||
{
|
||||
return new self(function () use ($callback) {
|
||||
foreach ($this as $key => $value) {
|
||||
yield $key => $callback($value, $key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Take the first {$limit} items.
|
||||
*
|
||||
* @param int $limit
|
||||
* @return static
|
||||
*/
|
||||
public function take(int $limit): self
|
||||
{
|
||||
return new self(function () use ($limit) {
|
||||
$iterator = $this->getIterator();
|
||||
|
||||
while ($limit--) {
|
||||
if (! $iterator->valid()) {
|
||||
break;
|
||||
}
|
||||
|
||||
yield $iterator->key() => $iterator->current();
|
||||
|
||||
if ($limit) {
|
||||
$iterator->next();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if all items pass the given truth test.
|
||||
*
|
||||
* @param (callable(TValue, TKey): bool) $callback
|
||||
* @return bool
|
||||
*/
|
||||
public function every(callable $callback): bool
|
||||
{
|
||||
$iterator = $this->getIterator();
|
||||
|
||||
foreach ($iterator as $key => $value) {
|
||||
if (! $callback($value, $key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of items in the collection.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return iterator_count($this->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an iterator for the items.
|
||||
*
|
||||
* @return Iterator<TKey, TValue>
|
||||
*/
|
||||
public function getIterator(): Iterator
|
||||
{
|
||||
return $this->makeIterator($this->source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an iterator for the given value.
|
||||
*
|
||||
* @template TIteratorKey of array-key
|
||||
* @template TIteratorValue
|
||||
*
|
||||
* @param IteratorAggregate<TIteratorValue>|(callable(): \Generator<TIteratorKey, TIteratorValue>) $source
|
||||
* @return Iterator<TIteratorValue>
|
||||
*/
|
||||
protected function makeIterator($source): Iterator
|
||||
{
|
||||
if ($source instanceof IteratorAggregate) {
|
||||
return $source->getIterator();
|
||||
}
|
||||
|
||||
return $source();
|
||||
}
|
||||
}
|
||||
112
vendor/mollie/mollie-api-php/src/Resources/Mandate.php
vendored
Normal file
112
vendor/mollie/mollie-api-php/src/Resources/Mandate.php
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\MollieApiClient;
|
||||
use Mollie\Api\Types\MandateStatus;
|
||||
|
||||
class Mandate extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $details;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $customerId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mandateReference;
|
||||
|
||||
/**
|
||||
* Date of signature, for example: 2018-05-07
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $signatureDate;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid()
|
||||
{
|
||||
return $this->status === MandateStatus::STATUS_VALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === MandateStatus::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isInvalid()
|
||||
{
|
||||
return $this->status === MandateStatus::STATUS_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke the mandate
|
||||
*
|
||||
* @return null|\stdClass|\Mollie\Api\Resources\Mandate
|
||||
*/
|
||||
public function revoke()
|
||||
{
|
||||
if (! isset($this->_links->self->href)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$body = null;
|
||||
if ($this->client->usesOAuth()) {
|
||||
$body = json_encode([
|
||||
"testmode" => $this->mode === "test" ? true : false,
|
||||
]);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(
|
||||
MollieApiClient::HTTP_DELETE,
|
||||
$this->_links->self->href,
|
||||
$body
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
40
vendor/mollie/mollie-api-php/src/Resources/MandateCollection.php
vendored
Normal file
40
vendor/mollie/mollie-api-php/src/Resources/MandateCollection.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class MandateCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "mandates";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Mandate($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $status
|
||||
* @return array|\Mollie\Api\Resources\MandateCollection
|
||||
*/
|
||||
public function whereStatus($status)
|
||||
{
|
||||
$collection = new self($this->client, 0, $this->_links);
|
||||
|
||||
foreach ($this as $item) {
|
||||
if ($item->status === $status) {
|
||||
$collection[] = $item;
|
||||
$collection->count++;
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
100
vendor/mollie/mollie-api-php/src/Resources/Method.php
vendored
Normal file
100
vendor/mollie/mollie-api-php/src/Resources/Method.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Method extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Id of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* More legible description of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* An object containing value and currency. It represents the minimum payment amount required to use this
|
||||
* payment method.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $minimumAmount;
|
||||
|
||||
/**
|
||||
* An object containing value and currency. It represents the maximum payment amount allowed when using this
|
||||
* payment method.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $maximumAmount;
|
||||
|
||||
/**
|
||||
* The $image->size1x and $image->size2x to display the payment method logo.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $image;
|
||||
|
||||
/**
|
||||
* The issuers available for this payment method. Only for the methods iDEAL, KBC/CBC and gift cards.
|
||||
* Will only be filled when explicitly requested using the query string `include` parameter.
|
||||
*
|
||||
* @var array|object[]
|
||||
*/
|
||||
public $issuers;
|
||||
|
||||
/**
|
||||
* The pricing for this payment method. Will only be filled when explicitly requested using the query string
|
||||
* `include` parameter.
|
||||
*
|
||||
* @var array|object[]
|
||||
*/
|
||||
public $pricing;
|
||||
|
||||
/**
|
||||
* The activation status the method is in.
|
||||
* If the method has status "null", this value will be returned as a null value, not as a string.
|
||||
*
|
||||
* @var string | null
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* Get the issuer value objects
|
||||
*
|
||||
* @return IssuerCollection
|
||||
*/
|
||||
public function issuers()
|
||||
{
|
||||
return ResourceFactory::createBaseResourceCollection(
|
||||
$this->client,
|
||||
Issuer::class,
|
||||
$this->issuers
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the method price value objects.
|
||||
*
|
||||
* @return MethodPriceCollection
|
||||
*/
|
||||
public function pricing()
|
||||
{
|
||||
return ResourceFactory::createBaseResourceCollection(
|
||||
$this->client,
|
||||
MethodPrice::class,
|
||||
$this->pricing
|
||||
);
|
||||
}
|
||||
}
|
||||
14
vendor/mollie/mollie-api-php/src/Resources/MethodCollection.php
vendored
Normal file
14
vendor/mollie/mollie-api-php/src/Resources/MethodCollection.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class MethodCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "methods";
|
||||
}
|
||||
}
|
||||
28
vendor/mollie/mollie-api-php/src/Resources/MethodPrice.php
vendored
Normal file
28
vendor/mollie/mollie-api-php/src/Resources/MethodPrice.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class MethodPrice extends BaseResource
|
||||
{
|
||||
/**
|
||||
* The area or product-type where the pricing is applied for, translated in the optional locale passed.
|
||||
*
|
||||
* @example "The Netherlands"
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* The fixed price per transaction. This excludes the variable amount.
|
||||
*
|
||||
* @var \stdClass An amount object consisting of `value` and `currency`
|
||||
*/
|
||||
public $fixed;
|
||||
|
||||
/**
|
||||
* A string containing the percentage being charged over the payment amount besides the fixed price.
|
||||
*
|
||||
* @var string An string representing the percentage as a float (for example: "0.1" for 10%)
|
||||
*/
|
||||
public $variable;
|
||||
}
|
||||
14
vendor/mollie/mollie-api-php/src/Resources/MethodPriceCollection.php
vendored
Normal file
14
vendor/mollie/mollie-api-php/src/Resources/MethodPriceCollection.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class MethodPriceCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
65
vendor/mollie/mollie-api-php/src/Resources/Onboarding.php
vendored
Normal file
65
vendor/mollie/mollie-api-php/src/Resources/Onboarding.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\OnboardingStatus;
|
||||
|
||||
class Onboarding extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $signedUpAt;
|
||||
|
||||
/**
|
||||
* Either "needs-data", "in-review" or "completed".
|
||||
* Indicates this current status of the organization’s onboarding process.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $canReceivePayments;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $canReceiveSettlements;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function needsData()
|
||||
{
|
||||
return $this->status === OnboardingStatus::NEEDS_DATA;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isInReview()
|
||||
{
|
||||
return $this->status === OnboardingStatus::IN_REVIEW;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCompleted()
|
||||
{
|
||||
return $this->status === OnboardingStatus::COMPLETED;
|
||||
}
|
||||
}
|
||||
534
vendor/mollie/mollie-api-php/src/Resources/Order.php
vendored
Normal file
534
vendor/mollie/mollie-api-php/src/Resources/Order.php
vendored
Normal file
@@ -0,0 +1,534 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Exceptions\ApiException;
|
||||
use Mollie\Api\Types\OrderStatus;
|
||||
|
||||
class Order extends BaseResource
|
||||
{
|
||||
use HasPresetOptions;
|
||||
|
||||
/**
|
||||
* Id of the order.
|
||||
*
|
||||
* @example ord_8wmqcHMN4U
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The profile ID this order belongs to.
|
||||
*
|
||||
* @example pfl_xH2kP6Nc6X
|
||||
* @var string
|
||||
*/
|
||||
public $profileId;
|
||||
|
||||
/**
|
||||
* Either "live" or "test". Indicates this being a test or a live (verified) order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* Amount object containing the value and currency
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* The total amount captured, thus far.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amountCaptured;
|
||||
|
||||
/**
|
||||
* The total amount refunded, thus far.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amountRefunded;
|
||||
|
||||
/**
|
||||
* The status of the order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* The person and the address the order is billed to.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $billingAddress;
|
||||
|
||||
/**
|
||||
* The date of birth of your customer, if available.
|
||||
* @example 1976-08-21
|
||||
* @var string|null
|
||||
*/
|
||||
public $consumerDateOfBirth;
|
||||
|
||||
/**
|
||||
* The order number that was used when creating the order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $orderNumber;
|
||||
|
||||
/**
|
||||
* The person and the address the order is shipped to.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $shippingAddress;
|
||||
|
||||
/**
|
||||
* The payment method last used when paying for the order.
|
||||
*
|
||||
* @see Method
|
||||
* @var string
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* The locale used for this order.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* During creation of the order you can set custom metadata that is stored with
|
||||
* the order, and given back whenever you retrieve that order.
|
||||
*
|
||||
* @var \stdClass|mixed|null
|
||||
*/
|
||||
public $metadata;
|
||||
|
||||
/**
|
||||
* Can this order be canceled?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isCancelable;
|
||||
|
||||
/**
|
||||
* Webhook URL set on this payment
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $webhookUrl;
|
||||
|
||||
/**
|
||||
* Redirect URL set on this payment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $redirectUrl;
|
||||
|
||||
/**
|
||||
* Cancel URL set on this payment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $cancelUrl;
|
||||
|
||||
/**
|
||||
* UTC datetime the order was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the order the order will expire in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $expiresAt;
|
||||
|
||||
/**
|
||||
* UTC datetime if the order is expired, the time of expiration will be present in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $expiredAt;
|
||||
|
||||
/**
|
||||
* UTC datetime if the order has been paid, the time of payment will be present in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $paidAt;
|
||||
|
||||
/**
|
||||
* UTC datetime if the order has been authorized, the time of authorization will be present in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $authorizedAt;
|
||||
|
||||
/**
|
||||
* UTC datetime if the order has been canceled, the time of cancellation will be present in ISO 8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $canceledAt;
|
||||
|
||||
/**
|
||||
* UTC datetime if the order is completed, the time of completion will be present in ISO 8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $completedAt;
|
||||
|
||||
/**
|
||||
* The order lines contain the actual things the customer bought.
|
||||
*
|
||||
* @var array|object[]
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
* For digital goods, you must make sure to apply the VAT rate from your customer’s country in most jurisdictions.
|
||||
* Use this parameter to restrict the payment methods available to your customer to methods from the billing country
|
||||
* only.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $shopperCountryMustMatchBillingCountry;
|
||||
|
||||
/**
|
||||
* An object with several URL objects relevant to the customer. Every URL object will contain an href and a type field.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $_embedded;
|
||||
|
||||
/**
|
||||
* Is this order created?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCreated()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_CREATED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order paid for?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaid()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_PAID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order authorized?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuthorized()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_AUTHORIZED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order canceled?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCanceled()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_CANCELED;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Deprecated) Is this order refunded?
|
||||
* @deprecated 2018-11-27
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isRefunded()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_REFUNDED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order shipping?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isShipping()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_SHIPPING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order completed?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCompleted()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order expired?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isExpired()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_EXPIRED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order completed?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === OrderStatus::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels this order.
|
||||
* If the order was partially shipped, the status will be "completed" instead of
|
||||
* "canceled".
|
||||
* Will throw a ApiException if the order id is invalid or the resource cannot
|
||||
* be found.
|
||||
*
|
||||
* @return Order
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
return $this->client->orders->cancel($this->id, $this->getPresetOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel a line for this order.
|
||||
* The data array must contain a lines array.
|
||||
* You can pass an empty lines array if you want to cancel all eligible lines.
|
||||
* Returns null if successful.
|
||||
*
|
||||
* @param array $data
|
||||
* @return null
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function cancelLines(array $data)
|
||||
{
|
||||
return $this->client->orderLines->cancelFor($this, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels all eligible lines for this order.
|
||||
* Returns null if successful.
|
||||
*
|
||||
* @param array|null $data
|
||||
* @return null
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function cancelAllLines($data = [])
|
||||
{
|
||||
$data['lines'] = [];
|
||||
|
||||
return $this->client->orderLines->cancelFor($this, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the line value objects
|
||||
*
|
||||
* @return OrderLineCollection
|
||||
*/
|
||||
public function lines()
|
||||
{
|
||||
return ResourceFactory::createBaseResourceCollection(
|
||||
$this->client,
|
||||
OrderLine::class,
|
||||
$this->lines
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a shipment for some order lines. You can provide an empty array for the
|
||||
* "lines" option to include all unshipped lines for this order.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return Shipment
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function createShipment(array $options = [])
|
||||
{
|
||||
return $this->client->shipments->createFor($this, $this->withPresetOptions($options));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a shipment for all unshipped order lines.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return Shipment
|
||||
*/
|
||||
public function shipAll(array $options = [])
|
||||
{
|
||||
$options['lines'] = [];
|
||||
|
||||
return $this->createShipment($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a specific shipment for this order.
|
||||
*
|
||||
* @param string $shipmentId
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Shipment
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function getShipment($shipmentId, array $parameters = [])
|
||||
{
|
||||
return $this->client->shipments->getFor($this, $shipmentId, $this->withPresetOptions($parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all shipments for this order.
|
||||
*
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return ShipmentCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function shipments(array $parameters = [])
|
||||
{
|
||||
return $this->client->shipments->listFor($this, $this->withPresetOptions($parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the checkout URL where the customer can complete the payment.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCheckoutUrl()
|
||||
{
|
||||
if (empty($this->_links->checkout)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_links->checkout->href;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refund specific order lines.
|
||||
*
|
||||
* @param array $data
|
||||
* @return Refund
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function refund(array $data)
|
||||
{
|
||||
return $this->client->orderRefunds->createFor($this, $this->withPresetOptions($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Refund all eligible order lines.
|
||||
*
|
||||
* @param array $data
|
||||
* @return Refund
|
||||
*/
|
||||
public function refundAll(array $data = [])
|
||||
{
|
||||
$data['lines'] = [];
|
||||
|
||||
return $this->refund($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all refunds associated with this order
|
||||
*
|
||||
* @return RefundCollection
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function refunds()
|
||||
{
|
||||
return $this->client->orderRefunds->pageFor($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the order's updated billingAddress and/or shippingAddress.
|
||||
*
|
||||
* @return \Mollie\Api\Resources\Order
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = [
|
||||
"billingAddress" => $this->billingAddress,
|
||||
"shippingAddress" => $this->shippingAddress,
|
||||
"orderNumber" => $this->orderNumber,
|
||||
"redirectUrl" => $this->redirectUrl,
|
||||
"cancelUrl" => $this->cancelUrl,
|
||||
"webhookUrl" => $this->webhookUrl,
|
||||
];
|
||||
|
||||
$result = $this->client->orders->update($this->id, $body);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Order($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new payment for this Order.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $filters
|
||||
* @return \Mollie\Api\Resources\Payment
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function createPayment($data, $filters = [])
|
||||
{
|
||||
return $this->client->orderPayments->createFor($this, $data, $filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the payments for this order.
|
||||
* Requires the order to be retrieved using the embed payments parameter.
|
||||
*
|
||||
* @return null|\Mollie\Api\Resources\PaymentCollection
|
||||
*/
|
||||
public function payments()
|
||||
{
|
||||
if (! isset($this->_embedded, $this->_embedded->payments)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ResourceFactory::createCursorResourceCollection(
|
||||
$this->client,
|
||||
$this->_embedded->payments,
|
||||
Payment::class
|
||||
);
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/OrderCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/OrderCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class OrderCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "orders";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Order($this->client);
|
||||
}
|
||||
}
|
||||
420
vendor/mollie/mollie-api-php/src/Resources/OrderLine.php
vendored
Normal file
420
vendor/mollie/mollie-api-php/src/Resources/OrderLine.php
vendored
Normal file
@@ -0,0 +1,420 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\OrderLineStatus;
|
||||
use Mollie\Api\Types\OrderLineType;
|
||||
|
||||
class OrderLine extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Always 'orderline'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* Id of the order line.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The ID of the order this line belongs to.
|
||||
*
|
||||
* @example ord_kEn1PlbGa
|
||||
* @var string
|
||||
*/
|
||||
public $orderId;
|
||||
|
||||
/**
|
||||
* The type of product bought.
|
||||
*
|
||||
* @example physical
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* A description of the order line.
|
||||
*
|
||||
* @example LEGO 4440 Forest Police Station
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The status of the order line.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* Can this order line be canceled?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isCancelable;
|
||||
|
||||
/**
|
||||
* The number of items in the order line.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $quantity;
|
||||
|
||||
/**
|
||||
* The number of items that are shipped for this order line.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $quantityShipped;
|
||||
|
||||
/**
|
||||
* The total amount that is shipped for this order line.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amountShipped;
|
||||
|
||||
/**
|
||||
* The number of items that are refunded for this order line.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $quantityRefunded;
|
||||
|
||||
/**
|
||||
* The total amount that is refunded for this order line.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amountRefunded;
|
||||
|
||||
/**
|
||||
* The number of items that are canceled in this order line.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $quantityCanceled;
|
||||
|
||||
/**
|
||||
* The total amount that is canceled in this order line.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amountCanceled;
|
||||
|
||||
/**
|
||||
* The number of items that can still be shipped for this order line.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $shippableQuantity;
|
||||
|
||||
/**
|
||||
* The number of items that can still be refunded for this order line.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $refundableQuantity;
|
||||
|
||||
/**
|
||||
* The number of items that can still be canceled for this order line.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $cancelableQuantity;
|
||||
|
||||
/**
|
||||
* The price of a single item in the order line.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $unitPrice;
|
||||
|
||||
/**
|
||||
* Any discounts applied to the order line.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $discountAmount;
|
||||
|
||||
/**
|
||||
* The total amount of the line, including VAT and discounts.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $totalAmount;
|
||||
|
||||
/**
|
||||
* The VAT rate applied to the order line. It is defined as a string
|
||||
* and not as a float to ensure the correct number of decimals are
|
||||
* passed.
|
||||
*
|
||||
* @example "21.00"
|
||||
* @var string
|
||||
*/
|
||||
public $vatRate;
|
||||
|
||||
/**
|
||||
* The amount of value-added tax on the line.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $vatAmount;
|
||||
|
||||
/**
|
||||
* The SKU, EAN, ISBN or UPC of the product sold.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $sku;
|
||||
|
||||
/**
|
||||
* A link pointing to an image of the product sold.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $imageUrl;
|
||||
|
||||
/**
|
||||
* A link pointing to the product page in your web shop of the product sold.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $productUrl;
|
||||
|
||||
/**
|
||||
* During creation of the order you can set custom metadata on order lines that is stored with
|
||||
* the order, and given back whenever you retrieve that order line.
|
||||
*
|
||||
* @var \stdClass|mixed|null
|
||||
*/
|
||||
public $metadata;
|
||||
|
||||
/**
|
||||
* The order line's date and time of creation, in ISO 8601 format.
|
||||
*
|
||||
* @example 2018-08-02T09:29:56+00:00
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* Get the url pointing to the product page in your web shop of the product sold.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getProductUrl()
|
||||
{
|
||||
if (empty($this->_links->productUrl)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_links->productUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the image URL of the product sold.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getImageUrl()
|
||||
{
|
||||
if (empty($this->_links->imageUrl)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_links->imageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line created?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCreated()
|
||||
{
|
||||
return $this->status === OrderLineStatus::STATUS_CREATED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line paid for?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaid()
|
||||
{
|
||||
return $this->status === OrderLineStatus::STATUS_PAID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line authorized?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuthorized()
|
||||
{
|
||||
return $this->status === OrderLineStatus::STATUS_AUTHORIZED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line canceled?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCanceled()
|
||||
{
|
||||
return $this->status === OrderLineStatus::STATUS_CANCELED;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Deprecated) Is this order line refunded?
|
||||
* @deprecated 2018-11-27
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isRefunded()
|
||||
{
|
||||
return $this->status === OrderLineStatus::STATUS_REFUNDED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line shipping?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isShipping()
|
||||
{
|
||||
return $this->status === OrderLineStatus::STATUS_SHIPPING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line completed?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCompleted()
|
||||
{
|
||||
return $this->status === OrderLineStatus::STATUS_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line for a physical product?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPhysical()
|
||||
{
|
||||
return $this->type === OrderLineType::TYPE_PHYSICAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line for applying a discount?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDiscount()
|
||||
{
|
||||
return $this->type === OrderLineType::TYPE_DISCOUNT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line for a digital product?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDigital()
|
||||
{
|
||||
return $this->type === OrderLineType::TYPE_DIGITAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line for applying a shipping fee?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isShippingFee()
|
||||
{
|
||||
return $this->type === OrderLineType::TYPE_SHIPPING_FEE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line for store credit?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isStoreCredit()
|
||||
{
|
||||
return $this->type === OrderLineType::TYPE_STORE_CREDIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line for a gift card?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isGiftCard()
|
||||
{
|
||||
return $this->type === OrderLineType::TYPE_GIFT_CARD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this order line for a surcharge?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSurcharge()
|
||||
{
|
||||
return $this->type === OrderLineType::TYPE_SURCHARGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an orderline by supplying one or more parameters in the data array
|
||||
*
|
||||
* @return BaseResource
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$result = $this->client->orderLines->update($this->orderId, $this->id, $this->getUpdateData());
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Order($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sanitized array of order line data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUpdateData()
|
||||
{
|
||||
$data = [
|
||||
"name" => $this->name,
|
||||
'imageUrl' => $this->imageUrl,
|
||||
'productUrl' => $this->productUrl,
|
||||
'metadata' => $this->metadata,
|
||||
'sku' => $this->sku,
|
||||
'quantity' => $this->quantity,
|
||||
'unitPrice' => $this->unitPrice,
|
||||
'discountAmount' => $this->discountAmount,
|
||||
'totalAmount' => $this->totalAmount,
|
||||
'vatAmount' => $this->vatAmount,
|
||||
'vatRate' => $this->vatRate,
|
||||
];
|
||||
|
||||
// Explicitly filter only NULL values to keep "vatRate => 0" intact
|
||||
return array_filter($data, function ($value) {
|
||||
return $value !== null;
|
||||
});
|
||||
}
|
||||
}
|
||||
32
vendor/mollie/mollie-api-php/src/Resources/OrderLineCollection.php
vendored
Normal file
32
vendor/mollie/mollie-api-php/src/Resources/OrderLineCollection.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class OrderLineCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific order line.
|
||||
* Returns null if the order line cannot be found.
|
||||
*
|
||||
* @param string $lineId
|
||||
* @return OrderLine|null
|
||||
*/
|
||||
public function get($lineId)
|
||||
{
|
||||
foreach ($this as $line) {
|
||||
if ($line->id === $lineId) {
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
70
vendor/mollie/mollie-api-php/src/Resources/Organization.php
vendored
Normal file
70
vendor/mollie/mollie-api-php/src/Resources/Organization.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Organization extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Id of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The name of the organization.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The email address of the organization.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* The preferred locale of the merchant which has been set in Mollie Dashboard.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* The address of the organization.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* The registration number of the organization at the (local) chamber of
|
||||
* commerce.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $registrationNumber;
|
||||
|
||||
/**
|
||||
* The VAT number of the organization, if based in the European Union. The VAT
|
||||
* number has been checked with the VIES by Mollie.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $vatNumber;
|
||||
|
||||
/**
|
||||
* The organization’s VAT regulation, if based in the European Union. Either "shifted"
|
||||
* (VAT is shifted) or dutch (Dutch VAT rate).
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $vatRegulation;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/OrganizationCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/OrganizationCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class OrganizationCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "organizations";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Organization($this->client);
|
||||
}
|
||||
}
|
||||
57
vendor/mollie/mollie-api-php/src/Resources/Partner.php
vendored
Normal file
57
vendor/mollie/mollie-api-php/src/Resources/Partner.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Partner extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Indicates the type of partner. Will be null if the currently authenticated organization is
|
||||
* not enrolled as a partner. Possible values: "oauth", "signuplink", "useragent".
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $partnerType;
|
||||
|
||||
/**
|
||||
* Will be true if partner is receiving commissions. Will be null otherwise.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $isCommissionPartner;
|
||||
|
||||
/**
|
||||
* Array of user agent token objects. Present if the partner is of type "useragent" or if the partner
|
||||
* has had user agent tokens in the past. Will be null otherwise.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public $userAgentTokens;
|
||||
|
||||
/**
|
||||
* The date and time the contract was signed, in ISO 8601 format. Will be null if the contract has
|
||||
* not yet been signed, or if "partnerType" is null.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $partnerContractSignedAt;
|
||||
|
||||
/**
|
||||
* Will be true if an updated contract is available, requiring the partner’s agreement.
|
||||
* Will be null otherwise.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $partnerContractUpdateAvailable;
|
||||
|
||||
/**
|
||||
* The date and time the contract will expire, in ISO 8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $partnerContractExpiresAt;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
}
|
||||
807
vendor/mollie/mollie-api-php/src/Resources/Payment.php
vendored
Normal file
807
vendor/mollie/mollie-api-php/src/Resources/Payment.php
vendored
Normal file
@@ -0,0 +1,807 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Exceptions\ApiException;
|
||||
use Mollie\Api\MollieApiClient;
|
||||
use Mollie\Api\Types\PaymentStatus;
|
||||
use Mollie\Api\Types\SequenceType;
|
||||
|
||||
class Payment extends BaseResource
|
||||
{
|
||||
use HasPresetOptions;
|
||||
|
||||
/**
|
||||
* Id of the payment (on the Mollie platform).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Mode of the payment, either "live" or "test" depending on the API Key that was
|
||||
* used.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* Amount object containing the value and currency
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* The amount that has been settled containing the value and currency
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $settlementAmount;
|
||||
|
||||
/**
|
||||
* The amount of the payment that has been refunded to the consumer, in EURO with
|
||||
* 2 decimals. This field will be null if the payment can not be refunded.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $amountRefunded;
|
||||
|
||||
/**
|
||||
* The amount of a refunded payment that can still be refunded, in EURO with 2
|
||||
* decimals. This field will be null if the payment can not be refunded.
|
||||
*
|
||||
* For some payment methods this amount can be higher than the payment amount.
|
||||
* This is possible to reimburse the costs for a return shipment to your customer
|
||||
* for example.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $amountRemaining;
|
||||
|
||||
/**
|
||||
* The total amount that was charged back for this payment. Only available when the
|
||||
* total charged back amount is not zero.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $amountChargedBack;
|
||||
|
||||
/**
|
||||
* Description of the payment that is shown to the customer during the payment,
|
||||
* and possibly on the bank or credit card statement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* If method is empty/null, the customer can pick his/her preferred payment
|
||||
* method.
|
||||
*
|
||||
* @see Method
|
||||
* @var string|null
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* The status of the payment.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status = PaymentStatus::STATUS_OPEN;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment was paid in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $paidAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment was canceled in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $canceledAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment expired in ISO-8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $expiresAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment failed in ISO-8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $failedAt;
|
||||
|
||||
/**
|
||||
* $dueDate is used only for banktransfer method
|
||||
* The date the payment should expire. Please note: the minimum date is tomorrow and the maximum date is 100 days after tomorrow.
|
||||
* UTC due date for the banktransfer payment in ISO-8601 format.
|
||||
*
|
||||
* @example "2021-01-19"
|
||||
* @var string|null
|
||||
*/
|
||||
public $dueDate;
|
||||
|
||||
/**
|
||||
* Consumer’s email address, to automatically send the bank transfer details to.
|
||||
* Please note: the payment instructions will be sent immediately when creating the payment.
|
||||
*
|
||||
* @example "user@mollie.com"
|
||||
* @var string|null
|
||||
* @deprecated 2024-06-01 The billingEmail field is deprecated. Use the "billingAddress" field instead.
|
||||
*/
|
||||
public $billingEmail;
|
||||
|
||||
/**
|
||||
* The profile ID this payment belongs to.
|
||||
*
|
||||
* @example pfl_xH2kP6Nc6X
|
||||
* @var string
|
||||
*/
|
||||
public $profileId;
|
||||
|
||||
/**
|
||||
* Either "first", "recurring", or "oneoff" for regular payments.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $sequenceType;
|
||||
|
||||
/**
|
||||
* Redirect URL set on this payment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $redirectUrl;
|
||||
|
||||
/**
|
||||
* Cancel URL set on this payment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $cancelUrl;
|
||||
|
||||
/**
|
||||
* Webhook URL set on this payment
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $webhookUrl;
|
||||
|
||||
/**
|
||||
* The mandate ID this payment is performed with.
|
||||
*
|
||||
* @example mdt_pXm1g3ND
|
||||
* @var string|null
|
||||
*/
|
||||
public $mandateId;
|
||||
|
||||
/**
|
||||
* The subscription ID this payment belongs to.
|
||||
*
|
||||
* @example sub_rVKGtNd6s3
|
||||
* @var string|null
|
||||
*/
|
||||
public $subscriptionId;
|
||||
|
||||
/**
|
||||
* The order ID this payment belongs to.
|
||||
*
|
||||
* @example ord_pbjz8x
|
||||
* @var string|null
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @example stl_jDk30akdN
|
||||
* @var string|null
|
||||
*/
|
||||
public $settlementId;
|
||||
|
||||
/**
|
||||
* The locale used for this payment.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* During creation of the payment you can set custom metadata that is stored with
|
||||
* the payment, and given back whenever you retrieve that payment.
|
||||
*
|
||||
* @var \stdClass|mixed|null
|
||||
*/
|
||||
public $metadata;
|
||||
|
||||
/**
|
||||
* Details of a successfully paid payment are set here. For example, the iDEAL
|
||||
* payment method will set $details->consumerName and $details->consumerAccount.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $details;
|
||||
|
||||
/**
|
||||
* Used to restrict the payment methods available to your customer to those from a single country.
|
||||
*
|
||||
* @var string|null;
|
||||
*/
|
||||
public $restrictPaymentMethodsToCountry;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @var \stdClass[]
|
||||
*/
|
||||
public $_embedded;
|
||||
|
||||
/**
|
||||
* Whether or not this payment can be canceled.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $isCancelable;
|
||||
|
||||
/**
|
||||
* The total amount that is already captured for this payment. Only available
|
||||
* when this payment supports captures.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $amountCaptured;
|
||||
|
||||
/**
|
||||
* Indicates whether the capture will be scheduled automatically or not. Set
|
||||
* to manual to capture the payment manually using the Create capture endpoint.
|
||||
*
|
||||
* Possible values: "automatic", "manual"
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $captureMode;
|
||||
|
||||
/**
|
||||
* Indicates the interval to wait before the payment is
|
||||
* captured, for example `8 hours` or `2 days. The capture delay
|
||||
* will be added to the date and time the payment became authorized.
|
||||
*
|
||||
* Possible values: ... hours ... days
|
||||
* @example 8 hours
|
||||
* @var string|null
|
||||
*/
|
||||
public $captureDelay;
|
||||
|
||||
/**
|
||||
* UTC datetime on which the merchant has to have captured the payment in
|
||||
* ISO-8601 format. This parameter is omitted if the payment is not authorized (yet).
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $captureBefore;
|
||||
|
||||
/**
|
||||
* The application fee, if the payment was created with one. Contains amount
|
||||
* (the value and currency) and description.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $applicationFee;
|
||||
|
||||
/**
|
||||
* An optional routing configuration which enables you to route a successful payment,
|
||||
* or part of the payment, to one or more connected accounts. Additionally, you can
|
||||
* schedule (parts of) the payment to become available on the connected account on a
|
||||
* future date.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public $routing;
|
||||
|
||||
/**
|
||||
* The date and time the payment became authorized, in ISO 8601 format. This
|
||||
* parameter is omitted if the payment is not authorized (yet).
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $authorizedAt;
|
||||
|
||||
/**
|
||||
* The date and time the payment was expired, in ISO 8601 format. This
|
||||
* parameter is omitted if the payment did not expire (yet).
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $expiredAt;
|
||||
|
||||
/**
|
||||
* If a customer was specified upon payment creation, the customer’s token will
|
||||
* be available here as well.
|
||||
*
|
||||
* @example cst_XPn78q9CfT
|
||||
* @var string|null
|
||||
*/
|
||||
public $customerId;
|
||||
|
||||
/**
|
||||
* This optional field contains your customer’s ISO 3166-1 alpha-2 country code,
|
||||
* detected by us during checkout. For example: BE. This field is omitted if the
|
||||
* country code was not detected.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $countryCode;
|
||||
|
||||
/**
|
||||
* Is this payment canceled?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCanceled()
|
||||
{
|
||||
return $this->status === PaymentStatus::STATUS_CANCELED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment expired?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isExpired()
|
||||
{
|
||||
return $this->status === PaymentStatus::STATUS_EXPIRED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment still open / ongoing?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOpen()
|
||||
{
|
||||
return $this->status === PaymentStatus::STATUS_OPEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment pending?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === PaymentStatus::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment authorized?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuthorized()
|
||||
{
|
||||
return $this->status === PaymentStatus::STATUS_AUTHORIZED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment paid for?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaid()
|
||||
{
|
||||
return ! empty($this->paidAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the payment have refunds
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRefunds()
|
||||
{
|
||||
return ! empty($this->_links->refunds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this payment has chargebacks
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasChargebacks()
|
||||
{
|
||||
return ! empty($this->_links->chargebacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this payment failing?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFailed()
|
||||
{
|
||||
return $this->status === PaymentStatus::STATUS_FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether 'sequenceType' is set to 'first'. If a 'first' payment has been
|
||||
* completed successfully, the consumer's account may be charged automatically
|
||||
* using recurring payments.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSequenceTypeFirst()
|
||||
{
|
||||
return $this->sequenceType === SequenceType::SEQUENCETYPE_FIRST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether 'sequenceType' is set to 'recurring'. This type of payment is
|
||||
* processed without involving
|
||||
* the consumer.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSequenceTypeRecurring()
|
||||
{
|
||||
return $this->sequenceType === SequenceType::SEQUENCETYPE_RECURRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the checkout URL where the customer can complete the payment.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCheckoutUrl()
|
||||
{
|
||||
if (empty($this->_links->checkout)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_links->checkout->href;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mobile checkout URL where the customer can complete the payment.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMobileAppCheckoutUrl()
|
||||
{
|
||||
if (empty($this->_links->mobileAppCheckout)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_links->mobileAppCheckout->href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canBeRefunded()
|
||||
{
|
||||
return $this->amountRemaining !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canBePartiallyRefunded()
|
||||
{
|
||||
return $this->canBeRefunded();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount that is already refunded
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountRefunded()
|
||||
{
|
||||
if ($this->amountRefunded) {
|
||||
return (float)$this->amountRefunded->value;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the remaining amount that can be refunded. For some payment methods this
|
||||
* amount can be higher than the payment amount. This is possible to reimburse
|
||||
* the costs for a return shipment to your customer for example.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountRemaining()
|
||||
{
|
||||
if ($this->amountRemaining) {
|
||||
return (float)$this->amountRemaining->value;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total amount that was charged back for this payment. Only available when the
|
||||
* total charged back amount is not zero.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountChargedBack()
|
||||
{
|
||||
if ($this->amountChargedBack) {
|
||||
return (float)$this->amountChargedBack->value;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the payment have split payments
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSplitPayments()
|
||||
{
|
||||
return ! empty($this->routing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all refunds associated with this payment
|
||||
*
|
||||
* @return RefundCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $refundId
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Refund
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function getRefund($refundId, array $parameters = [])
|
||||
{
|
||||
return $this->client->paymentRefunds->getFor($this, $refundId, $this->withPresetOptions($parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Refund
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function listRefunds(array $parameters = [])
|
||||
{
|
||||
return $this->client->paymentRefunds->listFor($this, $this->withPresetOptions($parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all captures associated with this payment
|
||||
*
|
||||
* @return CaptureCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function captures()
|
||||
{
|
||||
if (! isset($this->_links->captures->href)) {
|
||||
return new CaptureCollection($this->client, 0, null);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(
|
||||
MollieApiClient::HTTP_GET,
|
||||
$this->_links->captures->href
|
||||
);
|
||||
|
||||
return ResourceFactory::createCursorResourceCollection(
|
||||
$this->client,
|
||||
$result->_embedded->captures,
|
||||
Capture::class,
|
||||
$result->_links
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $captureId
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Capture
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function getCapture($captureId, array $parameters = [])
|
||||
{
|
||||
return $this->client->paymentCaptures->getFor(
|
||||
$this,
|
||||
$captureId,
|
||||
$this->withPresetOptions($parameters)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all chargebacks associated with this payment
|
||||
*
|
||||
* @return ChargebackCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function chargebacks()
|
||||
{
|
||||
if (! isset($this->_links->chargebacks->href)) {
|
||||
return new ChargebackCollection($this->client, 0, null);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(
|
||||
MollieApiClient::HTTP_GET,
|
||||
$this->_links->chargebacks->href
|
||||
);
|
||||
|
||||
return ResourceFactory::createCursorResourceCollection(
|
||||
$this->client,
|
||||
$result->_embedded->chargebacks,
|
||||
Chargeback::class,
|
||||
$result->_links
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a specific chargeback for this payment.
|
||||
*
|
||||
* @param string $chargebackId
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return Chargeback
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function getChargeback($chargebackId, array $parameters = [])
|
||||
{
|
||||
return $this->client->paymentChargebacks->getFor(
|
||||
$this,
|
||||
$chargebackId,
|
||||
$this->withPresetOptions($parameters)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue a refund for this payment.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Mollie\Api\Resources\Refund
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function refund($data)
|
||||
{
|
||||
return $this->client->paymentRefunds->createFor($this, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Mollie\Api\Resources\Payment
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = [
|
||||
"description" => $this->description,
|
||||
"cancelUrl" => $this->cancelUrl,
|
||||
"redirectUrl" => $this->redirectUrl,
|
||||
"webhookUrl" => $this->webhookUrl,
|
||||
"metadata" => $this->metadata,
|
||||
"restrictPaymentMethodsToCountry" => $this->restrictPaymentMethodsToCountry,
|
||||
"locale" => $this->locale,
|
||||
"dueDate" => $this->dueDate,
|
||||
];
|
||||
|
||||
$result = $this->client->payments->update(
|
||||
$this->id,
|
||||
$this->withPresetOptions($body)
|
||||
);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Payment($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* The total amount that is already captured for this payment. Only available
|
||||
* when this payment supports captures.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountCaptured()
|
||||
{
|
||||
if ($this->amountCaptured) {
|
||||
return (float)$this->amountCaptured->value;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount that has been settled.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getSettlementAmount()
|
||||
{
|
||||
if ($this->settlementAmount) {
|
||||
return (float)$this->settlementAmount->value;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The total amount that is already captured for this payment. Only available
|
||||
* when this payment supports captures.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getApplicationFeeAmount()
|
||||
{
|
||||
if ($this->applicationFee) {
|
||||
return (float)$this->applicationFee->amount->value;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/PaymentCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/PaymentCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class PaymentCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "payments";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Payment($this->client);
|
||||
}
|
||||
}
|
||||
204
vendor/mollie/mollie-api-php/src/Resources/PaymentLink.php
vendored
Normal file
204
vendor/mollie/mollie-api-php/src/Resources/PaymentLink.php
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class PaymentLink extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Id of the payment link (on the Mollie platform).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Mode of the payment link, either "live" or "test" depending on the API Key that was
|
||||
* used.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* The profile ID this payment link belongs to.
|
||||
*
|
||||
* @example pfl_QkEhN94Ba
|
||||
* @var string
|
||||
*/
|
||||
public $profileId;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment link was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment was paid in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $paidAt;
|
||||
|
||||
/**
|
||||
* Whether the payment link is archived. Customers will not be able to complete
|
||||
* payments on archived payment links.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $archived;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment link was updated in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $updatedAt;
|
||||
|
||||
/**
|
||||
* UTC datetime - the expiry date of the payment link in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $expiresAt;
|
||||
|
||||
/**
|
||||
* Amount object containing the value and currency
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* Description of the payment link that is shown to the customer during the payment,
|
||||
* and possibly on the bank or credit card statement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* Redirect URL set on this payment
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $redirectUrl;
|
||||
|
||||
/**
|
||||
* Webhook URL set on this payment link
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $webhookUrl;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* Is this payment paid for?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaid()
|
||||
{
|
||||
return ! empty($this->paidAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the checkout URL where the customer can complete the payment.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCheckoutUrl()
|
||||
{
|
||||
if (empty($this->_links->paymentLink)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_links->paymentLink->href;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist the current local Payment Link state to the Mollie API.
|
||||
*
|
||||
* @return mixed|\Mollie\Api\Resources\BaseResource
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = $this->withPresetOptions([
|
||||
'description' => $this->description,
|
||||
'archived' => $this->archived,
|
||||
]);
|
||||
|
||||
$result = $this->client->paymentLinks->update($this->id, $body);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new PaymentLink($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive this Payment Link.
|
||||
*
|
||||
* @return \Mollie\Api\Resources\PaymentLink
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function archive()
|
||||
{
|
||||
$data = $this->withPresetOptions([
|
||||
'archived' => true,
|
||||
]);
|
||||
|
||||
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
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getPresetOptions()
|
||||
{
|
||||
$options = [];
|
||||
if ($this->client->usesOAuth()) {
|
||||
$options["testmode"] = $this->mode === "test";
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the preset options.
|
||||
*
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
private function withPresetOptions(array $options)
|
||||
{
|
||||
return array_merge($this->getPresetOptions(), $options);
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/PaymentLinkCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/PaymentLinkCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class PaymentLinkCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "payment_links";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new PaymentLink($this->client);
|
||||
}
|
||||
}
|
||||
27
vendor/mollie/mollie-api-php/src/Resources/Permission.php
vendored
Normal file
27
vendor/mollie/mollie-api-php/src/Resources/Permission.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Permission extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @example payments.read
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $granted;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
}
|
||||
14
vendor/mollie/mollie-api-php/src/Resources/PermissionCollection.php
vendored
Normal file
14
vendor/mollie/mollie-api-php/src/Resources/PermissionCollection.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class PermissionCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "permissions";
|
||||
}
|
||||
}
|
||||
239
vendor/mollie/mollie-api-php/src/Resources/Profile.php
vendored
Normal file
239
vendor/mollie/mollie-api-php/src/Resources/Profile.php
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Exceptions\ApiException;
|
||||
use Mollie\Api\MollieApiClient;
|
||||
use Mollie\Api\Types\ProfileStatus;
|
||||
|
||||
class Profile extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Test or live mode
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $website;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $phone;
|
||||
|
||||
/**
|
||||
* See https://docs.mollie.com/reference/v2/profiles-api/get-profile
|
||||
* This parameter is deprecated and will be removed in 2022. Please use the businessCategory parameter instead.
|
||||
*
|
||||
* @deprecated
|
||||
* @var int|null
|
||||
*/
|
||||
public $categoryCode;
|
||||
|
||||
/**
|
||||
* See https://docs.mollie.com/reference/v2/profiles-api/get-profile
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $businessCategory;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $review;
|
||||
|
||||
/**
|
||||
* UTC datetime the profile was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isUnverified()
|
||||
{
|
||||
return $this->status == ProfileStatus::STATUS_UNVERIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isVerified()
|
||||
{
|
||||
return $this->status == ProfileStatus::STATUS_VERIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isBlocked()
|
||||
{
|
||||
return $this->status == ProfileStatus::STATUS_BLOCKED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Mollie\Api\Resources\Profile
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = [
|
||||
"name" => $this->name,
|
||||
"website" => $this->website,
|
||||
"email" => $this->email,
|
||||
"phone" => $this->phone,
|
||||
"businessCategory" => $this->businessCategory,
|
||||
"mode" => $this->mode,
|
||||
];
|
||||
|
||||
$result = $this->client->profiles->update($this->id, $body);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Profile($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all chargebacks associated with this profile
|
||||
*
|
||||
* @return ChargebackCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function chargebacks()
|
||||
{
|
||||
if (! isset($this->_links->chargebacks->href)) {
|
||||
return new ChargebackCollection($this->client, 0, null);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->chargebacks->href);
|
||||
|
||||
return ResourceFactory::createCursorResourceCollection(
|
||||
$this->client,
|
||||
$result->_embedded->chargebacks,
|
||||
Chargeback::class,
|
||||
$result->_links
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all methods activated on this profile
|
||||
*
|
||||
* @return MethodCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function methods()
|
||||
{
|
||||
if (! isset($this->_links->methods->href)) {
|
||||
return new MethodCollection(0, null);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->methods->href);
|
||||
|
||||
return ResourceFactory::createCursorResourceCollection(
|
||||
$this->client,
|
||||
$result->_embedded->methods,
|
||||
Method::class,
|
||||
$result->_links
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable a payment method for this profile.
|
||||
*
|
||||
* @param string $methodId
|
||||
* @param array $data
|
||||
* @return Method
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function enableMethod($methodId, array $data = [])
|
||||
{
|
||||
return $this->client->profileMethods->createFor($this, $methodId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable a payment method for this profile.
|
||||
*
|
||||
* @param string $methodId
|
||||
* @param array $data
|
||||
* @return Method
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function disableMethod($methodId, array $data = [])
|
||||
{
|
||||
return $this->client->profileMethods->deleteFor($this, $methodId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all payments associated with this profile
|
||||
*
|
||||
* @return PaymentCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function payments()
|
||||
{
|
||||
if (! isset($this->_links->payments->href)) {
|
||||
return new PaymentCollection($this->client, 0, null);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->payments->href);
|
||||
|
||||
return ResourceFactory::createCursorResourceCollection(
|
||||
$this->client,
|
||||
$result->_embedded->methods,
|
||||
Method::class,
|
||||
$result->_links
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all refunds associated with this profile
|
||||
*
|
||||
* @return RefundCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/ProfileCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/ProfileCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class ProfileCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "profiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Profile($this->client);
|
||||
}
|
||||
}
|
||||
184
vendor/mollie/mollie-api-php/src/Resources/Refund.php
vendored
Normal file
184
vendor/mollie/mollie-api-php/src/Resources/Refund.php
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\RefundStatus;
|
||||
|
||||
class Refund extends BaseResource
|
||||
{
|
||||
use HasPresetOptions;
|
||||
|
||||
/**
|
||||
* Id of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Mode of the refund, either "live" or "test".
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* The $amount that was refunded.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* The refund's description, if available.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* The payment id that was refunded.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $paymentId;
|
||||
|
||||
/**
|
||||
* The order id that was refunded.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $orderId;
|
||||
|
||||
/**
|
||||
* The order lines contain the actual things the customer ordered.
|
||||
* The lines will show the quantity, discountAmount, vatAmount and totalAmount
|
||||
* refunded.
|
||||
*
|
||||
* @var array|object[]|null
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
* The settlement amount
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $settlementAmount;
|
||||
|
||||
/**
|
||||
* The refund status
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* An object containing information relevant to a refund issued for a split payment.
|
||||
*
|
||||
* @var array|object[]|null
|
||||
*/
|
||||
public $routingReversal;
|
||||
|
||||
/**
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $metadata;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canBeCanceled()
|
||||
{
|
||||
return $this->isQueued() || $this->isPending();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund queued?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isQueued()
|
||||
{
|
||||
return $this->status === RefundStatus::STATUS_QUEUED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund pending?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === RefundStatus::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund processing?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isProcessing()
|
||||
{
|
||||
return $this->status === RefundStatus::STATUS_PROCESSING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund transferred to consumer?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isTransferred()
|
||||
{
|
||||
return $this->status === RefundStatus::STATUS_REFUNDED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund failed?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFailed()
|
||||
{
|
||||
return $this->status === RefundStatus::STATUS_FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this refund canceled?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCanceled()
|
||||
{
|
||||
return $this->status === RefundStatus::STATUS_CANCELED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the refund.
|
||||
* Returns null if successful.
|
||||
*
|
||||
* @return null
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
return $this->client->paymentRefunds->cancelForId(
|
||||
$this->paymentId,
|
||||
$this->id,
|
||||
$this->getPresetOptions()
|
||||
);
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/RefundCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/RefundCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class RefundCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "refunds";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Refund($this->client);
|
||||
}
|
||||
}
|
||||
79
vendor/mollie/mollie-api-php/src/Resources/ResourceFactory.php
vendored
Normal file
79
vendor/mollie/mollie-api-php/src/Resources/ResourceFactory.php
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\MollieApiClient;
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
class ResourceFactory
|
||||
{
|
||||
/**
|
||||
* Create resource object from Api result
|
||||
*
|
||||
* @param object $apiResult
|
||||
* @param BaseResource $resource
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function createFromApiResult($apiResult, BaseResource $resource)
|
||||
{
|
||||
foreach ($apiResult as $property => $value) {
|
||||
$resource->{$property} = $value;
|
||||
}
|
||||
|
||||
return $resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MollieApiClient $client
|
||||
* @param string $resourceClass
|
||||
* @param array $data
|
||||
* @param null $_links
|
||||
* @param string $resourceCollectionClass
|
||||
* @return mixed
|
||||
*/
|
||||
public static function createBaseResourceCollection(
|
||||
MollieApiClient $client,
|
||||
$resourceClass,
|
||||
$data,
|
||||
$_links = null,
|
||||
$resourceCollectionClass = null
|
||||
) {
|
||||
$resourceCollectionClass = $resourceCollectionClass ?: $resourceClass . 'Collection';
|
||||
$data = $data ?: [];
|
||||
|
||||
$result = new $resourceCollectionClass(count($data), $_links);
|
||||
foreach ($data as $item) {
|
||||
$result[] = static::createFromApiResult($item, new $resourceClass($client));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MollieApiClient $client
|
||||
* @param array $input
|
||||
* @param string $resourceClass
|
||||
* @param null $_links
|
||||
* @param null $resourceCollectionClass
|
||||
* @return mixed
|
||||
*/
|
||||
public static function createCursorResourceCollection(
|
||||
$client,
|
||||
array $input,
|
||||
$resourceClass,
|
||||
$_links = null,
|
||||
$resourceCollectionClass = null
|
||||
) {
|
||||
if (null === $resourceCollectionClass) {
|
||||
$resourceCollectionClass = $resourceClass.'Collection';
|
||||
}
|
||||
|
||||
$data = new $resourceCollectionClass($client, count($input), $_links);
|
||||
foreach ($input as $item) {
|
||||
$data[] = static::createFromApiResult($item, new $resourceClass($client));
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
35
vendor/mollie/mollie-api-php/src/Resources/Route.php
vendored
Normal file
35
vendor/mollie/mollie-api-php/src/Resources/Route.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Route extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Id of the payment method.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Amount object containing the value and currency
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* The destination where the routed payment was sent.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $destination;
|
||||
|
||||
/**
|
||||
* A UTC date. The settlement of a routed payment can be delayed on payment level, by specifying a release Date
|
||||
*
|
||||
* @example "2013-12-25"
|
||||
* @var string
|
||||
*/
|
||||
public $releaseDate;
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/RouteCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/RouteCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class RouteCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "route";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Route($this->client);
|
||||
}
|
||||
}
|
||||
167
vendor/mollie/mollie-api-php/src/Resources/SalesInvoice.php
vendored
Normal file
167
vendor/mollie/mollie-api-php/src/Resources/SalesInvoice.php
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\SalesInvoiceStatus;
|
||||
|
||||
class SalesInvoice extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $profileId;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $invoiceNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $currency;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $vatScheme;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $vatMode;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $memo;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $paymentTerm;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $paymentDetails;
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $emailDetails;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $recipientIdentifier;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $recipient;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $webhookUrl;
|
||||
|
||||
/**
|
||||
* @var object|null
|
||||
*/
|
||||
public $discount;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $amountDue;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $subtotalAmount;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $totalAmount;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $totalVatAmount;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $discountedSubtotalAmount;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $issuedAt;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $dueAt;
|
||||
|
||||
/**
|
||||
* @var object
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* Returns whether the sales invoice is in draft status.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDraft()
|
||||
{
|
||||
return $this->status === SalesInvoiceStatus::DRAFT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the sales invoice is issued.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isIssued()
|
||||
{
|
||||
return $this->status === SalesInvoiceStatus::ISSUED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the sales invoice is paid.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaid()
|
||||
{
|
||||
return $this->status === SalesInvoiceStatus::PAID;
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/SalesInvoiceCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/SalesInvoiceCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class SalesInvoiceCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "sales_invoices";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new SalesInvoice($this->client);
|
||||
}
|
||||
}
|
||||
178
vendor/mollie/mollie-api-php/src/Resources/Session.php
vendored
Normal file
178
vendor/mollie/mollie-api-php/src/Resources/Session.php
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\SessionStatus;
|
||||
|
||||
class Session extends BaseResource
|
||||
{
|
||||
use HasPresetOptions;
|
||||
|
||||
/**
|
||||
* The session's unique identifier,
|
||||
*
|
||||
* @example sess_dfsklg13jO
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Status of the session.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* UTC datetime indicating the time at which the Session failed in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $failedAt;
|
||||
|
||||
/**
|
||||
* Unique identifier to record the Userʼs authentication with a method
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $authenticationId;
|
||||
|
||||
/**
|
||||
* Indicates the next action to take in the payment preparation flow.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $nextAction;
|
||||
|
||||
/**
|
||||
* The URL the buyer will be redirected to in case the
|
||||
* payment preparation process requires a 3rd party redirect.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $redirectUrl;
|
||||
|
||||
/**
|
||||
* The URL the buyer will be redirected to if they
|
||||
* cancel their payment during a 3rd party redirect..
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $cancelUrl;
|
||||
|
||||
/**
|
||||
* The amount you intend to charge containing the value and currency.
|
||||
*
|
||||
* Note - this is not necessarily the final amount of the
|
||||
* payment.You will specify the final amount upon Order creation
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* Description of the payment intent.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* Payment method currently selected by the shopper.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* All additional information relating to the selected method.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $methodDetails;
|
||||
|
||||
/**
|
||||
* The person and the address the payment is shipped to.
|
||||
*
|
||||
* @deprecated
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $shippingAddress;
|
||||
|
||||
/**
|
||||
* The person and the address the payment is billed to.
|
||||
*
|
||||
* @deprecated
|
||||
* @var \stdClass
|
||||
*
|
||||
*/
|
||||
public $billingAddress;
|
||||
|
||||
/**
|
||||
* An object with several URL objects relevant to the customer. Every URL object will contain an href and a type field.
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
public function isCreated()
|
||||
{
|
||||
return $this->status === SessionStatus::STATUS_CREATED;
|
||||
}
|
||||
|
||||
public function isReadyForProcessing()
|
||||
{
|
||||
return $this->status === SessionStatus::STATUS_READY_FOR_PROCESSING;
|
||||
}
|
||||
|
||||
public function isCompleted()
|
||||
{
|
||||
return $this->status === SessionStatus::STATUS_COMPLETED;
|
||||
}
|
||||
|
||||
public function hasFailed()
|
||||
{
|
||||
return $this->status === SessionStatus::STATUS_FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the session's updatable properties.
|
||||
*
|
||||
* @return \Mollie\Api\Resources\Session
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = [
|
||||
'billingAddress' => $this->billingAddress,
|
||||
'shippingAddress' => $this->shippingAddress,
|
||||
];
|
||||
|
||||
$result = $this->client->sessions->update($this->id, $this->withPresetOptions($body));
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Session($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels this session.
|
||||
*
|
||||
* @return Session
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
return $this->client->sessions->cancel($this->id, $this->getPresetOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRedirectUrl()
|
||||
{
|
||||
if (empty($this->_links->redirect)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_links->redirect->href;
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/SessionCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/SessionCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class SessionCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "sessions";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Session($this->client);
|
||||
}
|
||||
}
|
||||
184
vendor/mollie/mollie-api-php/src/Resources/Settlement.php
vendored
Normal file
184
vendor/mollie/mollie-api-php/src/Resources/Settlement.php
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Exceptions\ApiException;
|
||||
use Mollie\Api\Types\SettlementStatus;
|
||||
|
||||
class Settlement extends BaseResource
|
||||
{
|
||||
/**
|
||||
* Id of the settlement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The settlement reference. This corresponds to an invoice that's in your Dashboard.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $reference;
|
||||
|
||||
/**
|
||||
* UTC datetime the payment was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* The date on which the settlement was settled, in ISO 8601 format. When requesting the open settlement or next settlement the return value is null.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $settledAt;
|
||||
|
||||
/**
|
||||
* Status of the settlement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* Total settlement amount in euros.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* Revenues and costs nested per year, per month, and per payment method.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $periods;
|
||||
|
||||
/**
|
||||
* The ID of the invoice on which this settlement is invoiced, if it has been invoiced.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $invoiceId;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* Is this settlement still open?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOpen()
|
||||
{
|
||||
return $this->status === SettlementStatus::STATUS_OPEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this settlement pending?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === SettlementStatus::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this settlement paid out?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPaidout()
|
||||
{
|
||||
return $this->status === SettlementStatus::STATUS_PAIDOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has this settlement failed?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFailed()
|
||||
{
|
||||
return $this->status === SettlementStatus::STATUS_FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the first page of payments associated with this settlement.
|
||||
*
|
||||
* @param int|null $limit
|
||||
* @param array $parameters
|
||||
* @return PaymentCollection
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function payments(?int $limit = null, array $parameters = []): PaymentCollection
|
||||
{
|
||||
return $this->client->settlementPayments->pageForId(
|
||||
$this->id,
|
||||
null,
|
||||
$limit,
|
||||
$parameters
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the first page of refunds associated with this settlement.
|
||||
*
|
||||
* @param int|null $limit
|
||||
* @param array $parameters
|
||||
* @return RefundCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function refunds(?int $limit = null, array $parameters = [])
|
||||
{
|
||||
return $this->client->settlementRefunds->pageForId(
|
||||
$this->id,
|
||||
null,
|
||||
$limit,
|
||||
$parameters
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the first page of chargebacks associated with this settlement.
|
||||
*
|
||||
* @param int|null $limit
|
||||
* @param array $parameters
|
||||
* @return ChargebackCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function chargebacks(?int $limit = null, array $parameters = [])
|
||||
{
|
||||
return $this->client->settlementChargebacks->pageForId(
|
||||
$this->id,
|
||||
null,
|
||||
$limit,
|
||||
$parameters
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the first page of cap associated with this settlement.
|
||||
*
|
||||
* @param int|null $limit
|
||||
* @param array $parameters
|
||||
* @return CaptureCollection
|
||||
* @throws ApiException
|
||||
*/
|
||||
public function captures(?int $limit = null, array $parameters = [])
|
||||
{
|
||||
return $this->client->settlementCaptures->pageForId(
|
||||
$this->id,
|
||||
null,
|
||||
$limit,
|
||||
$parameters
|
||||
);
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/SettlementCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/SettlementCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class SettlementCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "settlements";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Settlement($this->client);
|
||||
}
|
||||
}
|
||||
124
vendor/mollie/mollie-api-php/src/Resources/Shipment.php
vendored
Normal file
124
vendor/mollie/mollie-api-php/src/Resources/Shipment.php
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class Shipment extends BaseResource
|
||||
{
|
||||
/**
|
||||
* The shipment’s unique identifier,
|
||||
*
|
||||
* @example shp_3wmsgCJN4U
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Id of the order.
|
||||
*
|
||||
* @example ord_8wmqcHMN4U
|
||||
* @var string
|
||||
*/
|
||||
public $orderId;
|
||||
|
||||
/**
|
||||
* UTC datetime the shipment was created in ISO-8601 format.
|
||||
*
|
||||
* @example "2013-12-25T10:30:54+00:00"
|
||||
* @var string|null
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* The order object lines contain the actual things the customer bought.
|
||||
* @var array|object[]
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
* An object containing tracking details for the shipment, if available.
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $tracking;
|
||||
|
||||
/**
|
||||
* An object with several URL objects relevant to the customer. Every URL object will contain an href and a type field.
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* Does this shipment offer track and trace?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTracking()
|
||||
{
|
||||
return $this->tracking !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this shipment offer a track and trace code?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTrackingUrl()
|
||||
{
|
||||
return $this->hasTracking() && ! empty($this->tracking->url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the track and trace url. Returns null if there is no url available.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTrackingUrl()
|
||||
{
|
||||
if (! $this->hasTrackingUrl()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->tracking->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the line value objects
|
||||
*
|
||||
* @return OrderLineCollection
|
||||
*/
|
||||
public function lines()
|
||||
{
|
||||
return ResourceFactory::createBaseResourceCollection(
|
||||
$this->client,
|
||||
OrderLine::class,
|
||||
$this->lines
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Order object for this shipment
|
||||
*
|
||||
* @return Order
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function order()
|
||||
{
|
||||
return $this->client->orders->get($this->orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save changes made to this shipment.
|
||||
*
|
||||
* @return BaseResource|Shipment
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = [
|
||||
"tracking" => $this->tracking,
|
||||
];
|
||||
|
||||
$result = $this->client->shipments->update($this->orderId, $this->id, $body);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Shipment($this->client));
|
||||
}
|
||||
}
|
||||
14
vendor/mollie/mollie-api-php/src/Resources/ShipmentCollection.php
vendored
Normal file
14
vendor/mollie/mollie-api-php/src/Resources/ShipmentCollection.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class ShipmentCollection extends BaseCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return 'shipments';
|
||||
}
|
||||
}
|
||||
236
vendor/mollie/mollie-api-php/src/Resources/Subscription.php
vendored
Normal file
236
vendor/mollie/mollie-api-php/src/Resources/Subscription.php
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\MollieApiClient;
|
||||
use Mollie\Api\Types\SubscriptionStatus;
|
||||
|
||||
class Subscription extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $customerId;
|
||||
|
||||
/**
|
||||
* Either "live" or "test" depending on the customer's mode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mode;
|
||||
|
||||
/**
|
||||
* UTC datetime the subscription created in ISO-8601 format.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
public $times;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
public $timesRemaining;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $interval;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $mandateId;
|
||||
|
||||
/**
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $metadata;
|
||||
|
||||
/**
|
||||
* UTC datetime the subscription canceled in ISO-8601 format.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $canceledAt;
|
||||
|
||||
/**
|
||||
* Date the subscription started. For example: 2018-04-24
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $startDate;
|
||||
|
||||
/**
|
||||
* Contains an optional 'webhookUrl'.
|
||||
*
|
||||
* @var \stdClass|null
|
||||
*/
|
||||
public $webhookUrl;
|
||||
|
||||
/**
|
||||
* Date the next subscription payment will take place. For example: 2018-04-24
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $nextPaymentDate;
|
||||
|
||||
/**
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @return Subscription
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
$body = [
|
||||
"amount" => $this->amount,
|
||||
"times" => $this->times,
|
||||
"startDate" => $this->startDate,
|
||||
"webhookUrl" => $this->webhookUrl,
|
||||
"description" => $this->description,
|
||||
"mandateId" => $this->mandateId,
|
||||
"metadata" => $this->metadata,
|
||||
"interval" => $this->interval,
|
||||
];
|
||||
|
||||
$result = $this->client->subscriptions->update($this->customerId, $this->id, $body);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Subscription($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the Subscription is active or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
return $this->status === SubscriptionStatus::STATUS_ACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the Subscription is pending or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === SubscriptionStatus::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the Subscription is canceled or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCanceled()
|
||||
{
|
||||
return $this->status === SubscriptionStatus::STATUS_CANCELED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the Subscription is suspended or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuspended()
|
||||
{
|
||||
return $this->status === SubscriptionStatus::STATUS_SUSPENDED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the Subscription is completed or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCompleted()
|
||||
{
|
||||
return $this->status === SubscriptionStatus::STATUS_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels this subscription
|
||||
*
|
||||
* @return Subscription
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function cancel()
|
||||
{
|
||||
if (! isset($this->_links->self->href)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$body = null;
|
||||
if ($this->client->usesOAuth()) {
|
||||
$body = json_encode([
|
||||
"testmode" => $this->mode === "test" ? true : false,
|
||||
]);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(
|
||||
MollieApiClient::HTTP_DELETE,
|
||||
$this->_links->self->href,
|
||||
$body
|
||||
);
|
||||
|
||||
return ResourceFactory::createFromApiResult($result, new Subscription($this->client));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subscription payments
|
||||
*
|
||||
* @return \Mollie\Api\Resources\PaymentCollection
|
||||
* @throws \Mollie\Api\Exceptions\ApiException
|
||||
*/
|
||||
public function payments()
|
||||
{
|
||||
if (! isset($this->_links->payments->href)) {
|
||||
return new PaymentCollection($this->client, 0, null);
|
||||
}
|
||||
|
||||
$result = $this->client->performHttpCallToFullUrl(
|
||||
MollieApiClient::HTTP_GET,
|
||||
$this->_links->payments->href
|
||||
);
|
||||
|
||||
return ResourceFactory::createCursorResourceCollection(
|
||||
$this->client,
|
||||
$result->_embedded->payments,
|
||||
Payment::class,
|
||||
$result->_links
|
||||
);
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/SubscriptionCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/SubscriptionCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class SubscriptionCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "subscriptions";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Subscription($this->client);
|
||||
}
|
||||
}
|
||||
157
vendor/mollie/mollie-api-php/src/Resources/Terminal.php
vendored
Normal file
157
vendor/mollie/mollie-api-php/src/Resources/Terminal.php
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
use Mollie\Api\Types\TerminalStatus;
|
||||
|
||||
class Terminal extends BaseResource
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* Id of the terminal (on the Mollie platform).
|
||||
*
|
||||
* @example term_7MgL4wea46qkRcoTZjWEH
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The profile ID this terminal belongs to.
|
||||
*
|
||||
* @example pfl_QkEhN94Ba
|
||||
* @var string
|
||||
*/
|
||||
public $profileId;
|
||||
|
||||
/**
|
||||
* Mollie determines the read-only status of a terminal as pending,
|
||||
* active, or inactive based on its actions. Pending means not activated,
|
||||
* active means payments are accepted, and inactive means it is deactivated.
|
||||
*
|
||||
* @example active
|
||||
* @var string
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* The brand of the terminal.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $brand;
|
||||
|
||||
/**
|
||||
* The model of the terminal.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* The serial number of the terminal. The serial number is provided at terminal creation time.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $serialNumber;
|
||||
|
||||
/**
|
||||
* The currency which is set for the terminal, in ISO 4217 format.
|
||||
*
|
||||
* @example EUR
|
||||
* @var string
|
||||
*/
|
||||
public $currency;
|
||||
|
||||
/**
|
||||
* A short description of the terminal. The description will be visible
|
||||
* in the Dashboard, but also on the device itself for identification purposes.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* The timezone of the terminal.
|
||||
*
|
||||
* @example Europe/Brussels
|
||||
* @var string
|
||||
*/
|
||||
public $timezone;
|
||||
|
||||
/**
|
||||
* This will be a full locale provided by the user.
|
||||
*
|
||||
* @example nl_NL
|
||||
* @var string
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* UTC datetime the terminal was created, in ISO 8601 format.
|
||||
*
|
||||
* @example "2021-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $createdAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the terminal was last updated, in ISO 8601 format.
|
||||
*
|
||||
* @example "2021-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $updatedAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the terminal was disabled, in ISO 8601 format.
|
||||
* This parameter is omitted if the terminal is not disabled yet.
|
||||
*
|
||||
* @example "2021-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $disabledAt;
|
||||
|
||||
/**
|
||||
* UTC datetime the terminal was activated, in ISO 8601 format.
|
||||
* This parameter is omitted if the terminal is not active yet.
|
||||
*
|
||||
* @example "2021-12-25T10:30:54+00:00"
|
||||
* @var string
|
||||
*/
|
||||
public $activatedAt;
|
||||
|
||||
/**
|
||||
* Links to help navigate through the Mollie API and related resources.
|
||||
*
|
||||
* @var \stdClass
|
||||
*/
|
||||
public $_links;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPending()
|
||||
{
|
||||
return $this->status === TerminalStatus::STATUS_PENDING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
return $this->status === TerminalStatus::STATUS_ACTIVE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isInactive()
|
||||
{
|
||||
return $this->status === TerminalStatus::STATUS_INACTIVE;
|
||||
}
|
||||
}
|
||||
22
vendor/mollie/mollie-api-php/src/Resources/TerminalCollection.php
vendored
Normal file
22
vendor/mollie/mollie-api-php/src/Resources/TerminalCollection.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Mollie\Api\Resources;
|
||||
|
||||
class TerminalCollection extends CursorCollection
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionResourceName()
|
||||
{
|
||||
return "terminals";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResource
|
||||
*/
|
||||
protected function createResourceObject()
|
||||
{
|
||||
return new Terminal($this->client);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user