├── CHANGELOG.md ├── LICENSE ├── README.md ├── UPGRADING.md ├── bin └── release ├── composer.json ├── docs ├── debugging.md ├── endpoint-collections.md ├── exceptions.md ├── http-adapters.md ├── idempotency.md ├── payments.md ├── recipes │ ├── README.md │ ├── capabilities │ │ └── list-capabilities.md │ ├── customers │ │ ├── customer-payments.md │ │ └── manage-customers.md │ ├── invoices │ │ └── list-invoices.md │ ├── mandates │ │ └── manage-mandates.md │ ├── onboarding │ │ └── create-client-link.md │ ├── payment-links │ │ └── manage-payment-links.md │ ├── payments │ │ ├── create-capturable-payment.md │ │ ├── create-capture.md │ │ ├── create-ideal-payment.md │ │ ├── create-payment-oauth.md │ │ ├── create-payment.md │ │ ├── create-routed-payment.md │ │ ├── handle-webhook.md │ │ ├── list-methods.md │ │ ├── list-payments.md │ │ ├── refund-payment.md │ │ ├── retrieve-captures.md │ │ └── update-payment.md │ ├── profiles │ │ └── manage-profiles.md │ ├── sales-invoices │ │ └── manage-sales-invoices.md │ ├── sessions │ │ └── manage-sessions.md │ ├── settlements │ │ └── list-settlements.md │ └── subscriptions │ │ └── manage-subscriptions.md ├── requests.md ├── responses.md └── testing.md └── src ├── CompatibilityChecker.php ├── Contracts ├── Arrayable.php ├── Authenticatable.php ├── Authenticator.php ├── Connector.php ├── EmbeddedResourcesContract.php ├── HasPayload.php ├── HttpAdapterContract.php ├── IdempotencyContract.php ├── IdempotencyKeyGeneratorContract.php ├── IsIteratable.php ├── IsResponseAware.php ├── IsWrapper.php ├── MollieHttpAdapterPickerContract.php ├── PayloadRepository.php ├── Repository.php ├── RequestMiddleware.php ├── Resolvable.php ├── ResponseMiddleware.php ├── Stringable.php ├── SupportsDebuggingContract.php ├── SupportsTestmode.php ├── SupportsTestmodeInPayload.php ├── SupportsTestmodeInQuery.php ├── Testable.php └── ViableResponse.php ├── EndpointCollection ├── BalanceEndpointCollection.php ├── BalanceReportEndpointCollection.php ├── BalanceTransactionEndpointCollection.php ├── CapabilityEndpointCollection.php ├── ChargebackEndpointCollection.php ├── ClientEndpointCollection.php ├── ClientLinkEndpointCollection.php ├── CustomerEndpointCollection.php ├── CustomerPaymentsEndpointCollection.php ├── EndpointCollection.php ├── InvoiceEndpointCollection.php ├── MandateEndpointCollection.php ├── MethodEndpointCollection.php ├── MethodIssuerEndpointCollection.php ├── OnboardingEndpointCollection.php ├── OrganizationEndpointCollection.php ├── OrganizationPartnerEndpointCollection.php ├── PaymentCaptureEndpointCollection.php ├── PaymentChargebackEndpointCollection.php ├── PaymentEndpointCollection.php ├── PaymentLinkEndpointCollection.php ├── PaymentLinkPaymentEndpointCollection.php ├── PaymentRefundEndpointCollection.php ├── PaymentRouteEndpointCollection.php ├── PermissionEndpointCollection.php ├── ProfileEndpointCollection.php ├── ProfileMethodEndpointCollection.php ├── RefundEndpointCollection.php ├── SalesInvoiceEndpointCollection.php ├── SessionEndpointCollection.php ├── SettlementCaptureEndpointCollection.php ├── SettlementChargebackEndpointCollection.php ├── SettlementEndpointCollection.php ├── SettlementPaymentEndpointCollection.php ├── SettlementRefundEndpointCollection.php ├── SubscriptionEndpointCollection.php ├── SubscriptionPaymentEndpointCollection.php ├── TerminalEndpointCollection.php └── WalletEndpointCollection.php ├── Exceptions ├── ApiException.php ├── ClientException.php ├── EmbeddedResourcesNotParseableException.php ├── ForbiddenException.php ├── IncompatiblePlatformException.php ├── InvalidAuthenticationException.php ├── JsonParseException.php ├── LogicException.php ├── MethodNotAllowedException.php ├── MissingAuthenticationException.php ├── MollieException.php ├── NetworkRequestException.php ├── NotFoundException.php ├── RequestException.php ├── RequestTimeoutException.php ├── RetryableNetworkRequestException.php ├── ServerException.php ├── ServiceUnavailableException.php ├── TooManyRequestsException.php ├── UnauthorizedException.php ├── UnrecognizedClientException.php └── ValidationException.php ├── Factories ├── ApplePayPaymentSessionRequestFactory.php ├── ApplicationFeeFactory.php ├── CreateClientLinkRequestFactory.php ├── CreateCustomerPaymentRequestFactory.php ├── CreateCustomerRequestFactory.php ├── CreateMandateRequestFactory.php ├── CreatePaymentCaptureRequestFactory.php ├── CreatePaymentLinkRequestFactory.php ├── CreatePaymentRefundRequestFactory.php ├── CreatePaymentRequestFactory.php ├── CreateProfileRequestFactory.php ├── CreateSalesInvoiceRequestFactory.php ├── CreateSessionRequestFactory.php ├── CreateSubscriptionRequestFactory.php ├── Factory.php ├── GetAllPaginatedSubscriptionsRequestFactory.php ├── GetAllPaymentMethodsRequestFactory.php ├── GetBalanceReportRequestFactory.php ├── GetClientRequestFactory.php ├── GetEnabledMethodsRequestFactory.php ├── GetMethodRequestFactory.php ├── GetPaginatedChargebacksRequestFactory.php ├── GetPaginatedClientRequestFactory.php ├── GetPaginatedCustomerPaymentsRequestFactory.php ├── GetPaginatedInvoiceRequestFactory.php ├── GetPaginatedPaymentCapturesRequestFactory.php ├── GetPaginatedPaymentChargebacksRequestFactory.php ├── GetPaginatedPaymentRefundsRequestFactory.php ├── GetPaginatedRefundsRequestFactory.php ├── GetPaginatedSettlementCapturesRequestFactory.php ├── GetPaginatedSettlementChargebacksRequestFactory.php ├── GetPaginatedSettlementRefundsQueryFactory.php ├── GetPaginatedSettlementsRequestFactory.php ├── GetPaymentCaptureRequestFactory.php ├── GetPaymentChargebackRequestFactory.php ├── GetPaymentRefundRequestFactory.php ├── GetPaymentRequestFactory.php ├── InvoiceLineCollectionFactory.php ├── InvoiceLineFactory.php ├── MoneyFactory.php ├── OrderLineCollectionFactory.php ├── OrderLineFactory.php ├── PaginatedQueryFactory.php ├── PaymentRouteCollectionFactory.php ├── RecipientFactory.php ├── RecurringBillingCycleFactory.php ├── RefundRouteCollectionFactory.php ├── RequestFactory.php ├── SortablePaginatedQueryFactory.php ├── UpdateCustomerRequestFactory.php ├── UpdatePaymentLinkRequestFactory.php ├── UpdatePaymentRequestFactory.php ├── UpdatePaymentRouteRequestFactory.php ├── UpdateProfileRequestFactory.php ├── UpdateSalesInvoiceRequestFactory.php └── UpdateSubscriptionRequestFactory.php ├── Fake ├── ErrorResponseBuilder.php ├── FakeResponseLoader.php ├── ListResponseBuilder.php ├── MockMollieClient.php ├── MockMollieHttpAdapter.php ├── MockResponse.php ├── ResourceResponseBuilder.php ├── Responses │ ├── apple-pay-session.json │ ├── balance-list.json │ ├── balance-report.json │ ├── balance-transactions.json │ ├── balance.json │ ├── capability-list.json │ ├── capability.json │ ├── capture-list.json │ ├── capture.json │ ├── chargeback-list.json │ ├── chargeback.json │ ├── client-link.json │ ├── client-list.json │ ├── client.json │ ├── current-profile.json │ ├── cursor-collection-next.json │ ├── cursor-collection.json │ ├── customer-list.json │ ├── customer.json │ ├── empty-list.json │ ├── error.json │ ├── invoice-list.json │ ├── invoice.json │ ├── issuer.json │ ├── mandate-list.json │ ├── mandate.json │ ├── method-list.json │ ├── method.json │ ├── onboarding.json │ ├── organization.json │ ├── partner-status.json │ ├── payment-link-list.json │ ├── payment-link.json │ ├── payment-list.json │ ├── payment-route.json │ ├── payment.json │ ├── permission-list.json │ ├── permission.json │ ├── profile-list.json │ ├── profile.json │ ├── refund-list.json │ ├── refund.json │ ├── route.json │ ├── sales-invoice-list.json │ ├── sales-invoice.json │ ├── session-list.json │ ├── session.json │ ├── settlement-list.json │ ├── settlement.json │ ├── subscription-list.json │ ├── subscription.json │ ├── terminal-list.json │ ├── terminal.json │ └── unprocessable-entity.json └── SequenceMockResponse.php ├── Http ├── Adapter │ ├── CurlErrorMapper.php │ ├── CurlFactory.php │ ├── CurlInitializationException.php │ ├── CurlMollieHttpAdapter.php │ ├── GuzzleMollieHttpAdapter.php │ ├── GuzzleRetryMiddlewareFactory.php │ ├── MollieHttpAdapterPicker.php │ └── PSR18MollieHttpAdapter.php ├── Auth │ ├── AccessTokenAuthenticator.php │ ├── ApiKeyAuthenticator.php │ └── BearerTokenAuthenticator.php ├── Data │ ├── Address.php │ ├── ApplicationFee.php │ ├── DataCollection.php │ ├── Discount.php │ ├── EmailDetails.php │ ├── InvoiceLine.php │ ├── Money.php │ ├── OrderLine.php │ ├── Owner.php │ ├── OwnerAddress.php │ ├── PaginatedQuery.php │ ├── PaymentDetails.php │ ├── PaymentRoute.php │ ├── Recipient.php │ ├── RecurringBillingCycle.php │ ├── RefundRoute.php │ └── SortablePaginatedQuery.php ├── Middleware.php ├── Middleware │ ├── ApplyIdempotencyKey.php │ ├── ConvertResponseToException.php │ ├── Handler.php │ ├── Handlers.php │ ├── Hydrate.php │ ├── MiddlewarePriority.php │ └── ResetIdempotencyKey.php ├── PendingRequest.php ├── PendingRequest │ ├── AuthenticateRequest.php │ ├── HandleTestmode.php │ ├── MergeBody.php │ ├── MergeRequestProperties.php │ └── SetUserAgent.php ├── Request.php ├── RequestSanitizer.php ├── Requests │ ├── ApplePayPaymentSessionRequest.php │ ├── CancelPaymentRefundRequest.php │ ├── CancelPaymentRequest.php │ ├── CancelSessionRequest.php │ ├── CancelSubscriptionRequest.php │ ├── CreateClientLinkRequest.php │ ├── CreateCustomerPaymentRequest.php │ ├── CreateCustomerRequest.php │ ├── CreateMandateRequest.php │ ├── CreatePaymentCaptureRequest.php │ ├── CreatePaymentLinkRequest.php │ ├── CreatePaymentRefundRequest.php │ ├── CreatePaymentRequest.php │ ├── CreateProfileRequest.php │ ├── CreateSalesInvoiceRequest.php │ ├── CreateSessionRequest.php │ ├── CreateSubscriptionRequest.php │ ├── DeleteCustomerRequest.php │ ├── DeletePaymentLinkRequest.php │ ├── DeleteProfileRequest.php │ ├── DeleteSalesInvoiceRequest.php │ ├── DisableMethodIssuerRequest.php │ ├── DisableMethodRequest.php │ ├── DynamicDeleteRequest.php │ ├── DynamicGetRequest.php │ ├── DynamicPaginatedRequest.php │ ├── DynamicPostRequest.php │ ├── DynamicPutRequest.php │ ├── DynamicRequest.php │ ├── EnableMethodIssuerRequest.php │ ├── EnableMethodRequest.php │ ├── GetAllMethodsRequest.php │ ├── GetAllPaginatedSubscriptionsRequest.php │ ├── GetBalanceReportRequest.php │ ├── GetBalanceRequest.php │ ├── GetCapabilityRequest.php │ ├── GetClientRequest.php │ ├── GetCurrentProfileRequest.php │ ├── GetCustomerRequest.php │ ├── GetEnabledMethodsRequest.php │ ├── GetInvoiceRequest.php │ ├── GetMandateRequest.php │ ├── GetMethodRequest.php │ ├── GetOnboardingStatusRequest.php │ ├── GetOrganizationPartnerStatusRequest.php │ ├── GetOrganizationRequest.php │ ├── GetPaginatedBalanceRequest.php │ ├── GetPaginatedBalanceTransactionRequest.php │ ├── GetPaginatedChargebacksRequest.php │ ├── GetPaginatedClientRequest.php │ ├── GetPaginatedCustomerPaymentsRequest.php │ ├── GetPaginatedCustomerRequest.php │ ├── GetPaginatedInvoiceRequest.php │ ├── GetPaginatedMandateRequest.php │ ├── GetPaginatedPaymentCapturesRequest.php │ ├── GetPaginatedPaymentChargebacksRequest.php │ ├── GetPaginatedPaymentLinkPaymentsRequest.php │ ├── GetPaginatedPaymentLinksRequest.php │ ├── GetPaginatedPaymentRefundsRequest.php │ ├── GetPaginatedPaymentsRequest.php │ ├── GetPaginatedProfilesRequest.php │ ├── GetPaginatedRefundsRequest.php │ ├── GetPaginatedSalesInvoicesRequest.php │ ├── GetPaginatedSettlementCapturesRequest.php │ ├── GetPaginatedSettlementChargebacksRequest.php │ ├── GetPaginatedSettlementPaymentsRequest.php │ ├── GetPaginatedSettlementRefundsRequest.php │ ├── GetPaginatedSettlementsRequest.php │ ├── GetPaginatedSubscriptionPaymentsRequest.php │ ├── GetPaginatedSubscriptionsRequest.php │ ├── GetPaginatedTerminalsRequest.php │ ├── GetPaymentCaptureRequest.php │ ├── GetPaymentChargebackRequest.php │ ├── GetPaymentLinkRequest.php │ ├── GetPaymentRefundRequest.php │ ├── GetPaymentRequest.php │ ├── GetPermissionRequest.php │ ├── GetProfileRequest.php │ ├── GetSalesInvoiceRequest.php │ ├── GetSessionRequest.php │ ├── GetSettlementRequest.php │ ├── GetSubscriptionRequest.php │ ├── GetTerminalRequest.php │ ├── ListCapabilitiesRequest.php │ ├── ListPermissionsRequest.php │ ├── PaginatedRequest.php │ ├── ReleasePaymentAuthorizationRequest.php │ ├── ResourceHydratableRequest.php │ ├── RevokeMandateRequest.php │ ├── SortablePaginatedRequest.php │ ├── UpdateCustomerRequest.php │ ├── UpdatePaymentLinkRequest.php │ ├── UpdatePaymentRequest.php │ ├── UpdatePaymentRouteRequest.php │ ├── UpdateProfileRequest.php │ ├── UpdateSalesInvoiceRequest.php │ └── UpdateSubscriptionRequest.php ├── Response.php └── ResponseStatusCode.php ├── Idempotency ├── DefaultIdempotencyKeyGenerator.php └── FakeIdempotencyKeyGenerator.php ├── MollieApiClient.php ├── Repositories ├── ArrayStore.php └── JsonPayloadRepository.php ├── Resources ├── AnyResource.php ├── Balance.php ├── BalanceCollection.php ├── BalanceReport.php ├── BalanceTransaction.php ├── BalanceTransactionCollection.php ├── BaseCollection.php ├── BaseResource.php ├── Capability.php ├── CapabilityCollection.php ├── Capture.php ├── CaptureCollection.php ├── Chargeback.php ├── ChargebackCollection.php ├── Client.php ├── ClientCollection.php ├── ClientLink.php ├── CurrentProfile.php ├── CursorCollection.php ├── Customer.php ├── CustomerCollection.php ├── Invoice.php ├── InvoiceCollection.php ├── Issuer.php ├── IssuerCollection.php ├── LazyCollection.php ├── Mandate.php ├── MandateCollection.php ├── Method.php ├── MethodCollection.php ├── MethodPrice.php ├── MethodPriceCollection.php ├── Onboarding.php ├── Organization.php ├── Partner.php ├── Payment.php ├── PaymentCollection.php ├── PaymentLink.php ├── PaymentLinkCollection.php ├── Permission.php ├── PermissionCollection.php ├── Profile.php ├── ProfileCollection.php ├── Refund.php ├── RefundCollection.php ├── ResourceCollection.php ├── ResourceFactory.php ├── ResourceHydrator.php ├── ResourceWrapper.php ├── Route.php ├── SalesInvoice.php ├── SalesInvoiceCollection.php ├── Session.php ├── SessionCollection.php ├── Settlement.php ├── SettlementCollection.php ├── Subscription.php ├── SubscriptionCollection.php ├── Terminal.php ├── TerminalCollection.php └── WrapperResource.php ├── Traits ├── ComposableFromArray.php ├── ForwardsCalls.php ├── GetAllConstants.php ├── HandlesAuthentication.php ├── HandlesDebugging.php ├── HandlesIdempotency.php ├── HandlesTestmode.php ├── HandlesVersions.php ├── HasDefaultFactories.php ├── HasEndpoints.php ├── HasHeaders.php ├── HasJsonPayload.php ├── HasMiddleware.php ├── HasMode.php ├── HasQuery.php ├── HasRequestProperties.php ├── HasResponse.php ├── Initializable.php ├── IsIteratableRequest.php ├── ManagesPsrRequests.php └── SendsRequests.php ├── Types ├── ApprovalPrompt.php ├── BalanceTransferFrequency.php ├── BusinessCategory.php ├── CapabilityStatus.php ├── CaptureMode.php ├── CheckoutFlow.php ├── ClientQuery.php ├── InvoiceStatus.php ├── MandateMethod.php ├── MandateStatus.php ├── Method.php ├── MethodQuery.php ├── OnboardingStatus.php ├── OrderLineCategory.php ├── OrderLineStatus.php ├── OrderLineType.php ├── OrderLineUpdateOperationType.php ├── PaymentIncludesQuery.php ├── PaymentMethod.php ├── PaymentMethodStatus.php ├── PaymentQuery.php ├── PaymentStatus.php ├── PaymentTerm.php ├── ProfileStatus.php ├── RecipientType.php ├── RefundStatus.php ├── SalesInvoiceStatus.php ├── SequenceType.php ├── SessionStatus.php ├── SettlementStatus.php ├── SubscriptionStatus.php ├── TerminalStatus.php ├── VatMode.php └── VatScheme.php └── Utils ├── Arr.php ├── DataTransformer.php ├── Debugger.php ├── Factories.php ├── Url.php └── Utility.php /docs/recipes/README.md: -------------------------------------------------------------------------------- 1 | # Mollie API PHP Recipes 2 | 3 | This directory contains recipes for common use cases with the Mollie API PHP client. Each recipe provides a practical example of how to use the API client for a specific task. 4 | 5 | ## Structure 6 | 7 | The recipes are organized by resource type: 8 | - `payments/` - Payment-related operations (create, update, refund, etc.) 9 | - `customers/` - Customer management 10 | - `mandates/` - Mandate operations 11 | - `subscriptions/` - Subscription handling 12 | - `captures/` - Payment capture operations 13 | - `chargebacks/` - Chargeback handling 14 | - `refunds/` - Refund operations 15 | 16 | Each recipe includes: 17 | - Complete code example 18 | - Example response fields 19 | - Additional notes and considerations 20 | 21 | ## Getting Started 22 | 23 | Before using any recipe, make sure you have properly initialized the API client: 24 | 25 | ```php 26 | use Mollie\Api\MollieApiClient; 27 | 28 | $mollie = new MollieApiClient; 29 | $mollie->setApiKey('test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'); 30 | ``` 31 | -------------------------------------------------------------------------------- /src/Contracts/Arrayable.php: -------------------------------------------------------------------------------- 1 | send((new GetCapabilityRequest($name))); 24 | } 25 | 26 | /** 27 | * Retrieve all capabilities from Mollie. 28 | * 29 | * @throws RequestException 30 | */ 31 | public function list(): CapabilityCollection 32 | { 33 | /** @var CapabilityCollection */ 34 | return $this->send(new ListCapabilitiesRequest); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/EndpointCollection/ClientLinkEndpointCollection.php: -------------------------------------------------------------------------------- 1 | withPayload($payload) 22 | ->create(); 23 | 24 | /** @var ClientLink */ 25 | return $this->send($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/EndpointCollection/EndpointCollection.php: -------------------------------------------------------------------------------- 1 | connector = $connector; 15 | } 16 | 17 | /** 18 | * @return mixed 19 | */ 20 | protected function send(Request $request) 21 | { 22 | return $this->connector->send($request); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/EndpointCollection/MethodIssuerEndpointCollection.php: -------------------------------------------------------------------------------- 1 | send(new EnableMethodIssuerRequest($profileId, $methodId, $issuerId, $contractId)); 20 | } 21 | 22 | /** 23 | * Disable an issuer for a specific payment method. 24 | * 25 | * @throws RequestException 26 | */ 27 | public function disable(string $profileId, string $methodId, string $issuerId): void 28 | { 29 | $this->send(new DisableMethodIssuerRequest($profileId, $methodId, $issuerId)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/EndpointCollection/OnboardingEndpointCollection.php: -------------------------------------------------------------------------------- 1 | send(new GetOnboardingStatusRequest); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/EndpointCollection/OrganizationPartnerEndpointCollection.php: -------------------------------------------------------------------------------- 1 | send(new GetOrganizationPartnerStatusRequest); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/EndpointCollection/WalletEndpointCollection.php: -------------------------------------------------------------------------------- 1 | withPayload(array_merge([ 23 | 'domain' => $domain, 24 | 'validationUrl' => $validationUrl, 25 | ], $parameters)) 26 | ->create(); 27 | 28 | return $this->send($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Exceptions/ClientException.php: -------------------------------------------------------------------------------- 1 | json(); 13 | 14 | return new self( 15 | $response, 16 | 'Your request was understood but not allowed. '. 17 | sprintf('Error executing API call (%d: %s): %s', ResponseStatusCode::HTTP_FORBIDDEN, $body->title, $body->detail), 18 | ResponseStatusCode::HTTP_FORBIDDEN 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Exceptions/IncompatiblePlatformException.php: -------------------------------------------------------------------------------- 1 | token = $token; 12 | parent::__construct($message ?: "Invalid authentication token: '{$token}'"); 13 | } 14 | 15 | public function getToken(): string 16 | { 17 | return $this->token; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Exceptions/JsonParseException.php: -------------------------------------------------------------------------------- 1 | rawResponse = $rawResponse; 14 | } 15 | 16 | public function getRawResponse(): string 17 | { 18 | return $this->rawResponse; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Exceptions/LogicException.php: -------------------------------------------------------------------------------- 1 | json(); 13 | 14 | return new self( 15 | $response, 16 | 'The HTTP method is not supported. '. 17 | sprintf('Error executing API call (%d: %s): %s', ResponseStatusCode::HTTP_METHOD_NOT_ALLOWED, $body->title, $body->detail), 18 | ResponseStatusCode::HTTP_METHOD_NOT_ALLOWED 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Exceptions/MissingAuthenticationException.php: -------------------------------------------------------------------------------- 1 | json(); 13 | 14 | return new self( 15 | $response, 16 | 'The object referenced by your API request does not exist. '. 17 | sprintf('Error executing API call (%d: %s): %s', ResponseStatusCode::HTTP_NOT_FOUND, $body->title, $body->detail), 18 | ResponseStatusCode::HTTP_NOT_FOUND 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Exceptions/RequestTimeoutException.php: -------------------------------------------------------------------------------- 1 | json(); 15 | 16 | return new self( 17 | $response->getPendingRequest(), 18 | null, 19 | 'The request took too long to complete. '. 20 | sprintf('Error executing API call (%d: %s): %s', 408, $body->title, $body->detail) 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Exceptions/RetryableNetworkRequestException.php: -------------------------------------------------------------------------------- 1 | body(); 14 | 15 | if (! $response->isEmpty()) { 16 | $message .= sprintf(' Server response: %s', $body); 17 | } 18 | 19 | return new self( 20 | $response, 21 | $message, 22 | ResponseStatusCode::HTTP_SERVICE_UNAVAILABLE 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exceptions/TooManyRequestsException.php: -------------------------------------------------------------------------------- 1 | json(); 13 | 14 | return new self( 15 | $response, 16 | 'Your request exceeded the rate limit. '. 17 | sprintf('Error executing API call (%d: %s): %s', ResponseStatusCode::HTTP_TOO_MANY_REQUESTS, $body->title, $body->detail), 18 | ResponseStatusCode::HTTP_TOO_MANY_REQUESTS 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Exceptions/UnauthorizedException.php: -------------------------------------------------------------------------------- 1 | json(); 13 | 14 | return new self( 15 | $response, 16 | 'Your request wasn\'t executed due to failed authentication. Check your API key. '. 17 | sprintf('Error executing API call (%d: %s): %s', ResponseStatusCode::HTTP_UNAUTHORIZED, $body->title, $body->detail), 18 | ResponseStatusCode::HTTP_UNAUTHORIZED 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Exceptions/UnrecognizedClientException.php: -------------------------------------------------------------------------------- 1 | payload('domain'), 13 | $this->payload('validationUrl'), 14 | $this->payload('profileId'), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Factories/ApplicationFeeFactory.php: -------------------------------------------------------------------------------- 1 | get('amount'))->create(), 13 | $this->get('description'), 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Factories/CreateClientLinkRequestFactory.php: -------------------------------------------------------------------------------- 1 | payload('owner')), 15 | $this->payload('name'), 16 | OwnerAddress::fromArray($this->payload('address')), 17 | $this->payload('registrationNumber'), 18 | $this->payload('vatNumber') 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Factories/CreateCustomerRequestFactory.php: -------------------------------------------------------------------------------- 1 | payload('name'), 13 | $this->payload('email'), 14 | $this->payload('locale'), 15 | $this->payload('metadata'), 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Factories/CreatePaymentCaptureRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 14 | } 15 | 16 | public function create(): CreatePaymentCaptureRequest 17 | { 18 | return new CreatePaymentCaptureRequest( 19 | $this->paymentId, 20 | $this->payload('description'), 21 | $this->transformFromPayload('amount', fn ($item) => MoneyFactory::new($item)->create()), 22 | $this->payload('metadata') 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Factories/CreatePaymentLinkRequestFactory.php: -------------------------------------------------------------------------------- 1 | payload('description'), 14 | $this->transformFromPayload('amount', fn ($amount) => MoneyFactory::new($amount)->create()), 15 | $this->payload('redirectUrl'), 16 | $this->payload('webhookUrl'), 17 | $this->payload('profileId'), 18 | $this->payload('reusable'), 19 | $this->transformFromPayload('expiresAt', fn (string $date) => DateTimeImmutable::createFromFormat('Y-m-d', $date), DateTimeImmutable::class), 20 | $this->payload('allowedMethods'), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Factories/CreatePaymentRefundRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 14 | } 15 | 16 | public function create(): CreatePaymentRefundRequest 17 | { 18 | return new CreatePaymentRefundRequest( 19 | $this->paymentId, 20 | $this->payload('description'), 21 | MoneyFactory::new($this->payload('amount'))->create(), 22 | $this->payload('metadata'), 23 | $this->payload('reverseRouting'), 24 | $this 25 | ->transformFromPayload( 26 | 'routingReversals', 27 | fn ($items) => RefundRouteCollectionFactory::new($items)->create() 28 | ), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Factories/CreateProfileRequestFactory.php: -------------------------------------------------------------------------------- 1 | payload('name'), 13 | $this->payload('website'), 14 | $this->payload('email'), 15 | $this->payload('phone'), 16 | $this->payload('description'), 17 | $this->payload('countriesOfActivity'), 18 | $this->payload('businessCategory') 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Factories/CreateSessionRequestFactory.php: -------------------------------------------------------------------------------- 1 | payload('redirectUrl'), 13 | $this->payload('cancelUrl'), 14 | MoneyFactory::new($this->payload('amount'))->create(), 15 | $this->payload('description'), 16 | $this->payload('method'), 17 | $this->payload('checkoutFlow') 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Factories/GetAllPaginatedSubscriptionsRequestFactory.php: -------------------------------------------------------------------------------- 1 | query('limit'), 13 | $this->query('from'), 14 | $this->query('profileId') 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Factories/GetAllPaymentMethodsRequestFactory.php: -------------------------------------------------------------------------------- 1 | queryIncludes('include', MethodQuery::INCLUDE_ISSUERS); 13 | $includePricing = $this->queryIncludes('include', MethodQuery::INCLUDE_PRICING); 14 | 15 | return new GetAllMethodsRequest( 16 | $this->query('includeIssuers', $includeIssuers), 17 | $this->query('includePricing', $includePricing), 18 | $this->query('locale'), 19 | $this->transformFromQuery('amount', fn ($item) => MoneyFactory::new($item)->create()) 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Factories/GetBalanceReportRequestFactory.php: -------------------------------------------------------------------------------- 1 | balanceId = $balanceId; 15 | } 16 | 17 | public function create(): GetBalanceReportRequest 18 | { 19 | if (! $this->queryHas(['from', 'until'])) { 20 | throw new \LogicException('The "from" and "until" fields are required.'); 21 | } 22 | 23 | /** @var DateTimeImmutable $from */ 24 | $from = DateTimeImmutable::createFromFormat('Y-m-d', $this->query('from')); 25 | 26 | /** @var DateTimeImmutable $until */ 27 | $until = DateTimeImmutable::createFromFormat('Y-m-d', $this->query('until')); 28 | 29 | return new GetBalanceReportRequest( 30 | $this->balanceId, 31 | $from, 32 | $until, 33 | $this->query('grouping'), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Factories/GetClientRequestFactory.php: -------------------------------------------------------------------------------- 1 | id = $id; 15 | } 16 | 17 | public function create(): GetClientRequest 18 | { 19 | $embedOrganization = $this->queryIncludes('embed', ClientQuery::EMBED_ORGANIZATION); 20 | $embedOnboarding = $this->queryIncludes('embed', ClientQuery::EMBED_ONBOARDING); 21 | 22 | return new GetClientRequest( 23 | $this->id, 24 | $this->query('embedOrganization', $embedOrganization), 25 | $this->query('embedOnboarding', $embedOnboarding), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Factories/GetMethodRequestFactory.php: -------------------------------------------------------------------------------- 1 | id = $id; 15 | } 16 | 17 | public function create(): GetMethodRequest 18 | { 19 | $includeIssuers = $this->queryIncludes('include', MethodQuery::INCLUDE_ISSUERS); 20 | $includePricing = $this->queryIncludes('include', MethodQuery::INCLUDE_PRICING); 21 | 22 | return new GetMethodRequest( 23 | $this->id, 24 | $this->query('locale'), 25 | $this->query('currency'), 26 | $this->query('profileId'), 27 | $this->query('includeIssuers', $includeIssuers), 28 | $this->query('includePricing', $includePricing), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedChargebacksRequestFactory.php: -------------------------------------------------------------------------------- 1 | queryIncludes('include', PaymentIncludesQuery::PAYMENT); 13 | 14 | return new GetPaginatedChargebacksRequest( 15 | $this->query('from'), 16 | $this->query('limit'), 17 | $this->query('includePayment', $includePayment), 18 | $this->query('profileId') 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedClientRequestFactory.php: -------------------------------------------------------------------------------- 1 | queryIncludes('embed', ClientQuery::EMBED_ORGANIZATION); 13 | $embedOnboarding = $this->queryIncludes('embed', ClientQuery::EMBED_ONBOARDING); 14 | 15 | return new GetPaginatedClientRequest( 16 | $this->query('from'), 17 | $this->query('limit'), 18 | $this->query('embedOrganization', $embedOrganization), 19 | $this->query('embedOnboarding', $embedOnboarding), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedCustomerPaymentsRequestFactory.php: -------------------------------------------------------------------------------- 1 | customerId = $customerId; 14 | } 15 | 16 | public function create(): GetPaginatedCustomerPaymentsRequest 17 | { 18 | return new GetPaginatedCustomerPaymentsRequest( 19 | $this->customerId, 20 | $this->query('from'), 21 | $this->query('limit'), 22 | $this->query('sort'), 23 | $this->query('profileId') 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedInvoiceRequestFactory.php: -------------------------------------------------------------------------------- 1 | query('from'), 13 | $this->query('limit'), 14 | $this->query('reference'), 15 | $this->query('year') 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedPaymentCapturesRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 15 | } 16 | 17 | public function create(): GetPaginatedPaymentCapturesRequest 18 | { 19 | $includePayments = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 20 | 21 | return new GetPaginatedPaymentCapturesRequest( 22 | $this->paymentId, 23 | $this->query('from'), 24 | $this->query('limit'), 25 | $this->query('includePayments', $includePayments) 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedPaymentChargebacksRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 15 | } 16 | 17 | public function create(): GetPaginatedPaymentChargebacksRequest 18 | { 19 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 20 | 21 | return new GetPaginatedPaymentChargebacksRequest( 22 | $this->paymentId, 23 | $this->query('from'), 24 | $this->query('limit'), 25 | $this->query('includePayment', $includePayment), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedPaymentRefundsRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 15 | } 16 | 17 | public function create(): GetPaginatedPaymentRefundsRequest 18 | { 19 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 20 | 21 | return new GetPaginatedPaymentRefundsRequest( 22 | $this->paymentId, 23 | $this->query('from'), 24 | $this->query('limit'), 25 | $this->query('includePayment', $includePayment), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedRefundsRequestFactory.php: -------------------------------------------------------------------------------- 1 | queryIncludes('embed', PaymentIncludesQuery::PAYMENT); 13 | 14 | return new GetPaginatedRefundsRequest( 15 | $this->query('from'), 16 | $this->query('limit'), 17 | $this->query('embedPayment', $embedPayment), 18 | $this->query('profileId') 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedSettlementCapturesRequestFactory.php: -------------------------------------------------------------------------------- 1 | settlementId = $settlementId; 15 | } 16 | 17 | public function create(): GetPaginatedSettlementCapturesRequest 18 | { 19 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 20 | 21 | return new GetPaginatedSettlementCapturesRequest( 22 | $this->settlementId, 23 | $this->query('from'), 24 | $this->query('limit'), 25 | $this->query('includePayment', $includePayment) 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedSettlementChargebacksRequestFactory.php: -------------------------------------------------------------------------------- 1 | settlementId = $settlementId; 15 | } 16 | 17 | public function create(): GetPaginatedSettlementChargebacksRequest 18 | { 19 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 20 | 21 | return new GetPaginatedSettlementChargebacksRequest( 22 | $this->settlementId, 23 | $this->query('from'), 24 | $this->query('limit'), 25 | $this->query('includePayment', $includePayment), 26 | $this->query('profileId') 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedSettlementRefundsQueryFactory.php: -------------------------------------------------------------------------------- 1 | settlementId = $settlementId; 15 | } 16 | 17 | public function create(): GetPaginatedSettlementRefundsRequest 18 | { 19 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 20 | 21 | return new GetPaginatedSettlementRefundsRequest( 22 | $this->settlementId, 23 | $this->query('from'), 24 | $this->query('limit'), 25 | $this->query('includePayment', $includePayment) 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Factories/GetPaginatedSettlementsRequestFactory.php: -------------------------------------------------------------------------------- 1 | query('from'), 13 | $this->query('limit'), 14 | $this->query('balanceId'), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Factories/GetPaymentCaptureRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 17 | $this->captureId = $captureId; 18 | } 19 | 20 | public function create(): GetPaymentCaptureRequest 21 | { 22 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 23 | 24 | return new GetPaymentCaptureRequest( 25 | $this->paymentId, 26 | $this->captureId, 27 | $this->query('includePayment', $includePayment), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Factories/GetPaymentChargebackRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 17 | $this->chargebackId = $chargebackId; 18 | } 19 | 20 | public function create(): GetPaymentChargebackRequest 21 | { 22 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 23 | 24 | return new GetPaymentChargebackRequest( 25 | $this->paymentId, 26 | $this->chargebackId, 27 | $this->query('includePayment', $includePayment), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Factories/GetPaymentRefundRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 17 | $this->refundId = $refundId; 18 | } 19 | 20 | public function create(): GetPaymentRefundRequest 21 | { 22 | $includePayment = $this->queryIncludes('include', PaymentIncludesQuery::PAYMENT); 23 | 24 | return new GetPaymentRefundRequest( 25 | $this->paymentId, 26 | $this->refundId, 27 | $this->query('includePayment', $includePayment), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Factories/InvoiceLineCollectionFactory.php: -------------------------------------------------------------------------------- 1 | InvoiceLineFactory::new($item)->create(), 13 | $this->get() 14 | )); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Factories/InvoiceLineFactory.php: -------------------------------------------------------------------------------- 1 | get('description'), 14 | $this->get('quantity'), 15 | $this->get('vatRate'), 16 | MoneyFactory::new($this->get('unitPrice'))->create(), 17 | $this->transformIfNotNull('discount', fn (array $data) => Discount::fromArray($data)) 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Factories/MoneyFactory.php: -------------------------------------------------------------------------------- 1 | has(['currency', 'value'])) { 12 | throw new \InvalidArgumentException('Invalid Money data provided'); 13 | } 14 | 15 | return new Money( 16 | $this->get('currency'), 17 | $this->get('value') 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Factories/OrderLineCollectionFactory.php: -------------------------------------------------------------------------------- 1 | OrderLineFactory::new($item)->create(), 13 | $this->get() 14 | )); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Factories/OrderLineFactory.php: -------------------------------------------------------------------------------- 1 | get('description'), 13 | $this->get('quantity'), 14 | MoneyFactory::new($this->get('unitPrice'))->create(), 15 | MoneyFactory::new($this->get('totalAmount'))->create(), 16 | $this->get('type'), 17 | $this->get('quantityUnit'), 18 | $this->transformIfNotNull('discountAmount', fn (array $item) => MoneyFactory::new($item)->create()), 19 | $this->transformIfNotNull('recurring', fn (array $item) => RecurringBillingCycleFactory::new($item)->create()), 20 | $this->get('vatRate'), 21 | $this->transformIfNotNull('vatAmount', fn (array $item) => MoneyFactory::new($item)->create()), 22 | $this->get('sku'), 23 | $this->get('imageUrl'), 24 | $this->get('productUrl'), 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Factories/PaginatedQueryFactory.php: -------------------------------------------------------------------------------- 1 | query('from'), 13 | $this->query('limit'), 14 | ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Factories/RecipientFactory.php: -------------------------------------------------------------------------------- 1 | get('type'), 13 | $this->get('email'), 14 | $this->get('streetAndNumber'), 15 | $this->get('postalCode'), 16 | $this->get('city'), 17 | $this->get('country'), 18 | $this->get('locale'), 19 | $this->get('title'), 20 | $this->get('givenName'), 21 | $this->get('familyName'), 22 | $this->get('organizationName'), 23 | $this->get('organizationNumber'), 24 | $this->get('vatNumber'), 25 | $this->get('phone'), 26 | $this->get('streetAdditional'), 27 | $this->get('region'), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Factories/RecurringBillingCycleFactory.php: -------------------------------------------------------------------------------- 1 | get('interval'), 14 | $this->get('descriptipn'), 15 | $this->transformIfNotNull('amount', fn (array $item) => MoneyFactory::new($item)->create()), 16 | $this->get('times'), 17 | $this->transformIfNotNull('startDate', fn (string $item) => DateTimeImmutable::createFromFormat('Y-m-d', $item)), 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Factories/RefundRouteCollectionFactory.php: -------------------------------------------------------------------------------- 1 | has(['amount', 'source.organizationId'], $item)) { 20 | throw new LogicException('Invalid RefundRoute data provided'); 21 | } 22 | 23 | return new RefundRoute( 24 | MoneyFactory::new(Arr::get($item, 'amount'))->create(), 25 | Arr::get($item, 'source.organizationId') 26 | ); 27 | }, $this->get()); 28 | 29 | return new DataCollection($refundRoutes); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Factories/SortablePaginatedQueryFactory.php: -------------------------------------------------------------------------------- 1 | query('from'), 13 | $this->query('limit'), 14 | $this->query('sort'), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Factories/UpdateCustomerRequestFactory.php: -------------------------------------------------------------------------------- 1 | id = $id; 14 | } 15 | 16 | public function create(): UpdateCustomerRequest 17 | { 18 | return new UpdateCustomerRequest( 19 | $this->id, 20 | $this->payload('name'), 21 | $this->payload('email'), 22 | $this->payload('locale'), 23 | $this->payload('metadata'), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Factories/UpdatePaymentLinkRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentLinkId = $paymentLinkId; 14 | } 15 | 16 | public function create(): UpdatePaymentLinkRequest 17 | { 18 | return new UpdatePaymentLinkRequest( 19 | $this->paymentLinkId, 20 | $this->payload('description'), 21 | $this->payload('archived', false), 22 | $this->payload('allowedMethods'), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Factories/UpdatePaymentRequestFactory.php: -------------------------------------------------------------------------------- 1 | id = $id; 15 | } 16 | 17 | public function create(): UpdatePaymentRequest 18 | { 19 | return new UpdatePaymentRequest( 20 | $this->id, 21 | $this->payload('description'), 22 | $this->payload('redirectUrl'), 23 | $this->payload('cancelUrl'), 24 | $this->payload('webhookUrl'), 25 | $this->payload('metadata'), 26 | $this->payload('method'), 27 | $this->payload('locale'), 28 | $this->payload('restrictPaymentMethodsToCountry'), 29 | $this->payload('additional') ?? Utility::filterByProperties(UpdatePaymentRequest::class, $this->payload()), 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Factories/UpdatePaymentRouteRequestFactory.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 18 | $this->routeId = $routeId; 19 | } 20 | 21 | public function create(): UpdatePaymentRouteRequest 22 | { 23 | if (! $releaseDate = $this->payload('releaseDate')) { 24 | throw new LogicException('Release date is required'); 25 | } 26 | 27 | return new UpdatePaymentRouteRequest( 28 | $this->paymentId, 29 | $this->routeId, 30 | DateTimeImmutable::createFromFormat('Y-m-d', $releaseDate), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Factories/UpdateProfileRequestFactory.php: -------------------------------------------------------------------------------- 1 | id = $id; 14 | } 15 | 16 | public function create(): UpdateProfileRequest 17 | { 18 | return new UpdateProfileRequest( 19 | $this->id, 20 | $this->payload('name'), 21 | $this->payload('website'), 22 | $this->payload('email'), 23 | $this->payload('phone'), 24 | $this->payload('description'), 25 | $this->payload('countriesOfActivity'), 26 | $this->payload('businessCategory'), 27 | $this->payload('mode') 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Fake/FakeResponseLoader.php: -------------------------------------------------------------------------------- 1 | httpClient = new MockMollieHttpAdapter($expectedResponses); 17 | 18 | $this->setAccessToken('access_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); 19 | } 20 | 21 | /** 22 | * @param string|callable $callback 23 | */ 24 | public function assertSent($callback): void 25 | { 26 | $this->httpClient->assertSent($callback); 27 | } 28 | 29 | public function assertSentCount(int $count): void 30 | { 31 | $this->httpClient->assertSentCount($count); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Fake/Responses/apple-pay-session.json: -------------------------------------------------------------------------------- 1 | { 2 | "epochTimestamp": 1555507053169, 3 | "expiresAt": 1555510653169, 4 | "merchantSessionIdentifier": "SSH2EAF8AFAEAA94DEEA898162A5DAFD36E_916523AAED1343F5BC5815E12BEE9250AFFDC1A17C46B0DE5A9", 5 | "nonce": "0206b8db", 6 | "merchantIdentifier": "BD62FEB196874511C22DB28A9E14A89E3534C93194F73EA417EC566368D391EB", 7 | "domainName": "pay.example.org", 8 | "displayName": "Chuck Norris's Store", 9 | "signature": "308006092a864886f7...8cc030ad3000000000000" 10 | } 11 | -------------------------------------------------------------------------------- /src/Fake/Responses/balance.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "balance", 3 | "id": "bal_gVMhHKqSSRYJyPsuoPNFH", 4 | "mode": "live", 5 | "createdAt": "2019-01-10T10:23:41+00:00", 6 | "currency": "EUR", 7 | "status": "active", 8 | "availableAmount": { 9 | "value": "0.00", 10 | "currency": "EUR" 11 | }, 12 | "incomingAmount": { 13 | "value": "0.00", 14 | "currency": "EUR" 15 | }, 16 | "outgoingAmount": { 17 | "value": "0.00", 18 | "currency": "EUR" 19 | }, 20 | "transferFrequency": "twice-a-month", 21 | "transferThreshold": { 22 | "value": "5.00", 23 | "currency": "EUR" 24 | }, 25 | "transferReference": "Mollie payout", 26 | "transferDestination": { 27 | "type": "bank-account", 28 | "beneficiaryName": "Jack Bauer", 29 | "bankAccount": "NL53INGB0654422370", 30 | "bankAccountId": "bnk_jrty3f" 31 | }, 32 | "_links": { 33 | "self": { 34 | "href": "...", 35 | "type": "application/hal+json" 36 | }, 37 | "documentation": { 38 | "href": "...", 39 | "type": "text/html" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Fake/Responses/capability.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "capability", 3 | "name": "{{ RESOURCE_ID }}", 4 | "requirements": [ 5 | { 6 | "name": "legal-representatives", 7 | "dueDate": null, 8 | "status": "requested" 9 | } 10 | ], 11 | "status": "pending", 12 | "statusReason": "onboarding-information-needed", 13 | "organizationId": "org_12345678", 14 | "_links": { 15 | "self": { 16 | "href": "...", 17 | "type": "application/hal+json" 18 | }, 19 | "dashboard": { 20 | "href": "https://my.mollie.com/dashboard/...", 21 | "type": "text/html" 22 | }, 23 | "documentation": { 24 | "href": "...", 25 | "type": "text/html" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Fake/Responses/capture.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "capture", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "description": "Capture for cart #12345", 6 | "amount": { 7 | "currency": "EUR", 8 | "value": "35.95" 9 | }, 10 | "metadata": "{\"bookkeeping_id\":12345}", 11 | "paymentId": "tr_7UhSN1zuXS", 12 | "createdAt": "2023-08-02T09:29:56.0Z", 13 | "_links": { 14 | "self": { 15 | "href": "...", 16 | "type": "application/hal+json" 17 | }, 18 | "payment": { 19 | "href": "https://api.mollie.com/v2/payments/tr_7UhSN1zuXS", 20 | "type": "application/hal+json" 21 | }, 22 | "documentation": { 23 | "href": "...", 24 | "type": "text/html" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Fake/Responses/chargeback.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "chargeback", 3 | "id": "{{ RESOURCE_ID }}", 4 | "amount": { 5 | "currency": "USD", 6 | "value": "43.38" 7 | }, 8 | "settlementAmount": { 9 | "currency": "EUR", 10 | "value": "-35.07" 11 | }, 12 | "reason": { 13 | "code": "AC01", 14 | "description": "Account identifier incorrect (i.e. invalid IBAN)" 15 | }, 16 | "paymentId": "tr_7UhSN1zuXS", 17 | "createdAt": "2023-03-14T17:09:02.0Z", 18 | "reversedAt": null, 19 | "_links": { 20 | "self": { 21 | "href": "...", 22 | "type": "application/hal+json" 23 | }, 24 | "payment": { 25 | "href": "https://api.mollie.com/v2/payments/tr_7UhSN1zuXS", 26 | "type": "application/hal+json" 27 | }, 28 | "documentation": { 29 | "href": "...", 30 | "type": "text/html" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Fake/Responses/client-link.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "csr_ayCz46QLwCbxpTaSYQQZH", 3 | "resource": "client-link", 4 | "_links": { 5 | "clientLink": { 6 | "href": "https://my.mollie.com/dashboard/client-link/csr_ayCz46QLwCbxpTaSYQQZH", 7 | "type": "text/html" 8 | }, 9 | "documentation": { 10 | "href": "...", 11 | "type": "text/html" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Fake/Responses/client-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 2, 3 | "_embedded": { 4 | "clients": [ 5 | { 6 | "resource": "client", 7 | "id": "org_12345678", 8 | "organizationCreatedAt": "2023-04-06 13:10:19+00:00", 9 | "_links": { 10 | "self": { 11 | "href": "...", 12 | "type": "application/hal+json" 13 | } 14 | } 15 | } 16 | ] 17 | }, 18 | "_links": { 19 | "self": { 20 | "href": "...", 21 | "type": "application/hal+json" 22 | }, 23 | "previous": null, 24 | "next": { 25 | "href": "https://api.mollie.com/v2/clients?from=org_63916732&limit=5", 26 | "type": "application/hal+json" 27 | }, 28 | "documentation": { 29 | "href": "...", 30 | "type": "text/html" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Fake/Responses/cursor-collection-next.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 1, 3 | "_links": { 4 | "self": { 5 | "href": "https:\/\/api.mollie.com\/v2\/payments?from={{ RESOURCE_ID }}" 6 | }, 7 | "next": { 8 | "href": "https:\/\/api.mollie.com\/v2\/payments?from={{ RESOURCE_ID }}" 9 | } 10 | }, 11 | "_embedded": { 12 | "payments": [ 13 | { 14 | "id": "{{ RESOURCE_ID }}" 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Fake/Responses/cursor-collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 1, 3 | "_links": { 4 | "self": { 5 | "href": "https:\/\/api.mollie.com\/v2\/payments?from={{ RESOURCE_ID }}" 6 | } 7 | }, 8 | "_embedded": { 9 | "payments": [ 10 | { 11 | "id": "{{ RESOURCE_ID }}" 12 | } 13 | ] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Fake/Responses/customer-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 5, 3 | "_embedded": { 4 | "customers": [ 5 | { 6 | "resource": "customer", 7 | "id": "cst_8wmqcHMN4U", 8 | "mode": "live", 9 | "name": "John Doe", 10 | "email": "customer@example.org", 11 | "createdAt": "2023-04-06T13:10:19.0Z", 12 | "_links": { 13 | "self": { 14 | "href": "...", 15 | "type": "application/hal+json" 16 | } 17 | } 18 | } 19 | ] 20 | }, 21 | "_links": { 22 | "self": { 23 | "href": "...", 24 | "type": "application/hal+json" 25 | }, 26 | "previous": null, 27 | "next": { 28 | "href": "https://api.mollie.com/v2/customers?from=cst_stTC2WHAuS&limit=5", 29 | "type": "application/hal+json" 30 | }, 31 | "documentation": { 32 | "href": "...", 33 | "type": "text/html" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Fake/Responses/customer.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "customer", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "test", 5 | "name": "Jane Doe", 6 | "email": "test@mollie.com", 7 | "locale": "en_US", 8 | "metadata": { 9 | "someProperty": "someValue", 10 | "anotherProperty": "anotherValue" 11 | }, 12 | "createdAt": "2022-01-03T13:42:04+00:00", 13 | "_links": { 14 | "self": { 15 | "href": "...", 16 | "type": "application/hal+json" 17 | }, 18 | "dashboard": { 19 | "href": "https://www.mollie.com/dashboard/org_13514547/customers/cst_tKt44u85MM", 20 | "type": "text/html" 21 | }, 22 | "documentation": { 23 | "href": "...", 24 | "type": "text/html" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Fake/Responses/empty-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 0, 3 | "_embedded": { 4 | "{{ RESOURCE_ID }}": [] 5 | }, 6 | "_links": { 7 | "documentation": { 8 | "href": "...", 9 | "type": "text/html" 10 | }, 11 | "self": { 12 | "href": "...", 13 | "type": "application/hal+json" 14 | }, 15 | "previous": null, 16 | "next": null 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Fake/Responses/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": "{{ CODE }}", 3 | "title": "{{ TITLE }}", 4 | "detail": "{{ DETAIL }}", 5 | "field": "{{ FIELD }}", 6 | "_links": { 7 | "documentation": { 8 | "href": "https://docs.mollie.com/overview/handling-errors", 9 | "type": "text/html" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Fake/Responses/invoice.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "invoice", 3 | "id": "{{ RESOURCE_ID }}", 4 | "reference": "2023.10000", 5 | "vatNumber": "NL001234567B01", 6 | "status": "open", 7 | "netAmount": { 8 | "currency": "EUR", 9 | "value": "45.00" 10 | }, 11 | "vatAmount": { 12 | "currency": "EUR", 13 | "value": "9.45" 14 | }, 15 | "grossAmount": { 16 | "currency": "EUR", 17 | "value": "54.45" 18 | }, 19 | "lines": [ 20 | { 21 | "period": "2023-09", 22 | "description": "iDEAL payment fees", 23 | "count": 100, 24 | "vatPercentage": 21, 25 | "amount": { 26 | "currency": "EUR", 27 | "value": "45.00" 28 | } 29 | } 30 | ], 31 | "issuedAt": "2023-09-01", 32 | "dueAt": "2023-09-14", 33 | "_links": { 34 | "self": { 35 | "href": "...", 36 | "type": "application/hal+json" 37 | }, 38 | "pdf": { 39 | "href": "https://www.mollie.com/merchant/download/invoice/xBEbP9rvAq/2ab44d60b35b1d06090bba955fa2c602", 40 | "type": "application/pdf" 41 | }, 42 | "documentation": { 43 | "href": "...", 44 | "type": "text/html" 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Fake/Responses/issuer.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "issuer", 3 | "id": "festivalcadeau", 4 | "description": "FestivalCadeau Giftcard", 5 | "status": "pending-issuer", 6 | "_links": { 7 | "self": { 8 | "href": "...", 9 | "type": "application/hal+json" 10 | }, 11 | "documentation": { 12 | "href": "...", 13 | "type": "text/html" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Fake/Responses/mandate.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "mandate", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "status": "valid", 6 | "method": "directdebit", 7 | "details": { 8 | "consumerName": "John Doe", 9 | "consumerAccount": "NL55INGB0000000000", 10 | "consumerBic": "INGBNL2A" 11 | }, 12 | "mandateReference": "EXAMPLE-CORP-MD13804", 13 | "signatureDate": "2023-05-07", 14 | "customerId": "cst_4qqhO89gsT", 15 | "createdAt": "2023-05-07T10:49:08.0Z", 16 | "_links": { 17 | "self": { 18 | "href": "...", 19 | "type": "application/hal+json" 20 | }, 21 | "customer": { 22 | "href": "https://api.mollie.com/v2/customers/cst_4qqhO89gsT", 23 | "type": "application/hal+json" 24 | }, 25 | "documentation": { 26 | "href": "...", 27 | "type": "text/html" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Fake/Responses/method.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "method", 3 | "id": "{{ RESOURCE_ID }}", 4 | "description": "iDEAL", 5 | "minimumAmount": { 6 | "value": "0.01", 7 | "currency": "EUR" 8 | }, 9 | "maximumAmount": { 10 | "value": "50000.00", 11 | "currency": "EUR" 12 | }, 13 | "image": { 14 | "size1x": "https://mollie.com/external/icons/payment-methods/ideal.png", 15 | "size2x": "https://mollie.com/external/icons/payment-methods/ideal%402x.png", 16 | "svg": "https://mollie.com/external/icons/payment-methods/ideal.svg" 17 | }, 18 | "status": "activated", 19 | "_links": { 20 | "self": { 21 | "href": "...", 22 | "type": "application/hal+json" 23 | }, 24 | "documentation": { 25 | "href": "...", 26 | "type": "text/html" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Fake/Responses/onboarding.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "onboarding", 3 | "name": "Mollie B.V.", 4 | "status": "completed", 5 | "canReceivePayments": true, 6 | "canReceiveSettlements": true, 7 | "signedUpAt": "2023-12-20T10:49:08.0Z", 8 | "_links": { 9 | "self": { 10 | "href": "...", 11 | "type": "application/hal+json" 12 | }, 13 | "dashboard": { 14 | "href": "https://www.mollie.com/dashboard/onboarding", 15 | "type": "text/html" 16 | }, 17 | "organization": { 18 | "href": "https://api.mollie.com/v2/organizations/org_12345678", 19 | "type": "application/hal+json" 20 | }, 21 | "documentation": { 22 | "href": "...", 23 | "type": "text/html" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Fake/Responses/organization.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "organization", 3 | "id": "{{ RESOURCE_ID }}", 4 | "name": "Mollie B.V.", 5 | "email": "info@mollie.com", 6 | "locale": "nl_NL", 7 | "address": { 8 | "streetAndNumber": "Keizersgracht 126", 9 | "postalCode": "1015 CW", 10 | "city": "Amsterdam", 11 | "country": "NL" 12 | }, 13 | "registrationNumber": "30204462", 14 | "vatNumber": "NL815839091B01", 15 | "_links": { 16 | "self": { 17 | "href": "...", 18 | "type": "application/hal+json" 19 | }, 20 | "dashboard": { 21 | "href": "https://mollie.com/dashboard/{{ RESOURCE_ID }}", 22 | "type": "text/html" 23 | }, 24 | "documentation": { 25 | "href": "...", 26 | "type": "text/html" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Fake/Responses/partner-status.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "partner", 3 | "partnerType": "signuplink", 4 | "partnerContractSignedAt": "2023-03-20T13:59:02.0Z", 5 | "_links": { 6 | "self": { 7 | "href": "...", 8 | "type": "application/hal+json" 9 | }, 10 | "signuplink": { 11 | "href": "https://www.mollie.com/dashboard/signup/exampleCode", 12 | "type": "text/html" 13 | }, 14 | "documentation": { 15 | "href": "...", 16 | "type": "text/html" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Fake/Responses/payment-link.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "payment-link", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "description": "Bicycle tires", 6 | "amount": { 7 | "currency": "EUR", 8 | "value": "24.95" 9 | }, 10 | "archived": false, 11 | "redirectUrl": "https://webshop.example.org/thanks", 12 | "webhookUrl": "https://webshop.example.org/payment-links/webhook", 13 | "profileId": "pfl_QkEhN94Ba", 14 | "createdAt": "2021-03-20T09:29:56.0Z", 15 | "expiresAt": "2023-06-06T11:00:00.0Z", 16 | "reusable": false, 17 | "_links": { 18 | "self": { 19 | "href": "...", 20 | "type": "application/hal+json" 21 | }, 22 | "paymentLink": { 23 | "href": "https://payment-links.mollie.com/payment/4Y0eZitmBnQ6IDoMqZQKh", 24 | "type": "text/html" 25 | }, 26 | "documentation": { 27 | "href": "...", 28 | "type": "text/html" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Fake/Responses/payment-route.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "route", 3 | "id": "rt_9dk4al1n", 4 | "amount": { 5 | "value": "7.50", 6 | "currency": "EUR" 7 | }, 8 | "destination": { 9 | "type": "organization", 10 | "organizationId": "org_23456" 11 | }, 12 | "releaseDate": "2026-01-01" 13 | } 14 | -------------------------------------------------------------------------------- /src/Fake/Responses/payment.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "payment", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "test", 5 | "createdAt": "2018-03-13T14:02:29+00:00", 6 | "amount": { 7 | "value": "20.00", 8 | "currency": "EUR" 9 | }, 10 | "description": "My first API payment", 11 | "method": "ideal", 12 | "metadata": { 13 | "order_id": "1234" 14 | }, 15 | "status": "open", 16 | "isCancelable": false, 17 | "expiresAt": "2018-03-13T14:17:29+00:00", 18 | "details": null, 19 | "profileId": "pfl_2A1gacu42V", 20 | "sequenceType": "oneoff", 21 | "redirectUrl": "https://example.org/redirect", 22 | "webhookUrl": "https://example.org/webhook", 23 | "_links": { 24 | "self": { 25 | "href": "...", 26 | "type": "application/hal+json" 27 | }, 28 | "checkout": { 29 | "href": "...", 30 | "type": "text/html" 31 | }, 32 | "documentation": { 33 | "href": "...", 34 | "type": "text/html" 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Fake/Responses/permission-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 2, 3 | "_embedded": { 4 | "permissions": [ 5 | { 6 | "resource": "permission", 7 | "id": "payments.read", 8 | "description": "View your payments", 9 | "granted": true, 10 | "_links": { 11 | "self": { 12 | "href": "...", 13 | "type": "application/hal+json" 14 | } 15 | } 16 | }, 17 | { 18 | "resource": "permission", 19 | "id": "payments.write", 20 | "description": "Create new payments", 21 | "granted": false, 22 | "_links": { 23 | "self": { 24 | "href": "...", 25 | "type": "application/hal+json" 26 | } 27 | } 28 | } 29 | ] 30 | }, 31 | "_links": { 32 | "self": { 33 | "href": "...", 34 | "type": "application/hal+json" 35 | }, 36 | "documentation": { 37 | "href": "...", 38 | "type": "text/html" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Fake/Responses/permission.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "permission", 3 | "id": "{{ RESOURCE_ID }}", 4 | "description": "View your payments", 5 | "granted": true, 6 | "_links": { 7 | "self": { 8 | "href": "...", 9 | "type": "application/hal+json" 10 | }, 11 | "documentation": { 12 | "href": "...", 13 | "type": "text/html" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Fake/Responses/profile-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 1, 3 | "_embedded": { 4 | "profiles": [ 5 | { 6 | "resource": "profile", 7 | "id": "pfl_QkEhN94Ba", 8 | "mode": "live", 9 | "name": "My website name", 10 | "website": "https://shop.example.org", 11 | "email": "info@example.org", 12 | "phone": "+31208202070", 13 | "businessCategory": "OTHER_MERCHANDISE", 14 | "status": "verified", 15 | "review": { 16 | "status": "pending" 17 | }, 18 | "createdAt": "2023-03-20T09:28:37.0Z", 19 | "_links": { 20 | "self": { 21 | "href": "...", 22 | "type": "application/hal+json" 23 | } 24 | } 25 | } 26 | ] 27 | }, 28 | "_links": { 29 | "self": { 30 | "href": "...", 31 | "type": "application/hal+json" 32 | }, 33 | "previous": null, 34 | "next": { 35 | "href": "https://api.mollie.com/v2/profiles?from=pfl_v9hTwCvYqw&limit=5", 36 | "type": "application/hal+json" 37 | }, 38 | "documentation": { 39 | "href": "...", 40 | "type": "text/html" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Fake/Responses/profile.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "profile", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "name": "My website name", 6 | "website": "https://shop.example.org", 7 | "email": "info@example.org", 8 | "phone": "+31208202070", 9 | "businessCategory": "OTHER_MERCHANDISE", 10 | "status": "verified", 11 | "review": { 12 | "status": "pending" 13 | }, 14 | "createdAt": "2023-03-20T09:28:37.0Z", 15 | "_links": { 16 | "self": { 17 | "href": "...", 18 | "type": "application/hal+json" 19 | }, 20 | "dashboard": { 21 | "href": "https://www.mollie.com/dashboard/org_123456789/settings/profiles/pfl_QkEhN94Ba", 22 | "type": "text/html" 23 | }, 24 | "documentation": { 25 | "href": "...", 26 | "type": "text/html" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Fake/Responses/refund.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "refund", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "description": "Order", 6 | "amount": { 7 | "currency": "EUR", 8 | "value": "5.95" 9 | }, 10 | "status": "pending", 11 | "metadata": "{\"bookkeeping_id\":12345}", 12 | "paymentId": "tr_7UhSN1zuXS", 13 | "createdAt": "2023-03-14T17:09:02.0Z", 14 | "_links": { 15 | "self": { 16 | "href": "...", 17 | "type": "application/hal+json" 18 | }, 19 | "payment": { 20 | "href": "https://api.mollie.com/v2/payments/tr_7UhSN1zuXS", 21 | "type": "application/hal+json" 22 | }, 23 | "documentation": { 24 | "href": "...", 25 | "type": "text/html" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Fake/Responses/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "route", 3 | "id": "{{ RESOURCE_ID }}", 4 | "amount": { 5 | "value": "7.50", 6 | "currency": "EUR" 7 | }, 8 | "destination": { 9 | "type": "organization", 10 | "organizationId": "org_23456" 11 | }, 12 | "releaseDate": "2026-01-01" 13 | } 14 | -------------------------------------------------------------------------------- /src/Fake/Responses/session.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "session", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "status": "created", 6 | "amount": { 7 | "value": "10.00", 8 | "currency": "EUR" 9 | }, 10 | "description": "Order #12345", 11 | "method": "paypal", 12 | "methodDetails": { 13 | "checkoutFlow": "express" 14 | }, 15 | "nextAction": "redirect", 16 | "createdAt": "2024-01-10T12:06:28+00:00", 17 | "_links": { 18 | "self": { 19 | "href": "https://api.mollie.com/v2/sessions/{{ RESOURCE_ID }}", 20 | "type": "application/hal+json" 21 | }, 22 | "redirect": { 23 | "href": "https://paypalc.com/order/dghjfidf;gj", 24 | "type": "application/hal+json" 25 | }, 26 | "documentation": { 27 | "href": "...", 28 | "type": "text/html" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Fake/Responses/settlement-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 1, 3 | "_embedded": { 4 | "settlements": [ 5 | { 6 | "resource": "settlement", 7 | "id": "stl_jDk30akdN", 8 | "reference": "1234567.2404.03", 9 | "status": "paidout", 10 | "amount": { 11 | "currency": "EUR", 12 | "value": "39.75" 13 | }, 14 | "balanceId": "bal_3kUf4yU2nT", 15 | "periods": {}, 16 | "settledAt": "2024-04-06T09:41:44.0Z", 17 | "_links": { 18 | "self": { 19 | "href": "...", 20 | "type": "application/hal+json" 21 | } 22 | } 23 | } 24 | ] 25 | }, 26 | "_links": { 27 | "self": { 28 | "href": "...", 29 | "type": "application/hal+json" 30 | }, 31 | "previous": null, 32 | "next": { 33 | "href": "https://api.mollie.com/v2/settlements?from=cst_stTC2WHAuS&limit=5", 34 | "type": "application/hal+json" 35 | }, 36 | "documentation": { 37 | "href": "...", 38 | "type": "text/html" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Fake/Responses/subscription.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "subscription", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "amount": { 6 | "currency": "EUR", 7 | "value": "25.00" 8 | }, 9 | "times": 4, 10 | "timesRemaining": 4, 11 | "interval": "3 months", 12 | "startDate": "2023-06-01", 13 | "nextPaymentDate": "2023-09-01", 14 | "description": "Quarterly payment", 15 | "method": null, 16 | "status": "active", 17 | "webhookUrl": "https://webshop.example.org/payments/webhook", 18 | "customerId": "cst_stTC2WHAuS", 19 | "mandateId": "mdt_38HS4fsS", 20 | "createdAt": "2023-04-06T13:10:19.0Z", 21 | "_links": { 22 | "self": { 23 | "href": "...", 24 | "type": "application/hal+json" 25 | }, 26 | "customer": { 27 | "href": "https://api.mollie.com/v2/customers/cst_stTC2WHAuS", 28 | "type": "application/hal+json" 29 | }, 30 | "documentation": { 31 | "href": "...", 32 | "type": "text/html" 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Fake/Responses/terminal-list.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 1, 3 | "_embedded": { 4 | "terminals": [ 5 | { 6 | "resource": "terminal", 7 | "id": "term_7MgL4wea46qkRcoTZjWEH", 8 | "mode": "live", 9 | "status": "active", 10 | "brand": "PAX", 11 | "model": "A920", 12 | "serialNumber": "1234567890", 13 | "currency": "EUR", 14 | "description": "Terminal #12345", 15 | "profileId": "pfl_QkEhN94Ba", 16 | "createdAt": "2022-02-12T11:58:35.0Z", 17 | "_links": { 18 | "self": { 19 | "href": "...", 20 | "type": "application/hal+json" 21 | } 22 | } 23 | } 24 | ] 25 | }, 26 | "_links": { 27 | "self": { 28 | "href": "...", 29 | "type": "application/hal+json" 30 | }, 31 | "previous": null, 32 | "next": { 33 | "href": "...", 34 | "type": "application/hal+json" 35 | }, 36 | "documentation": { 37 | "href": "...", 38 | "type": "text/html" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Fake/Responses/terminal.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "terminal", 3 | "id": "{{ RESOURCE_ID }}", 4 | "mode": "live", 5 | "status": "active", 6 | "brand": "PAX", 7 | "model": "A920", 8 | "serialNumber": "1234567890", 9 | "currency": "EUR", 10 | "description": "Terminal #12345", 11 | "profileId": "pfl_QkEhN94Ba", 12 | "createdAt": "2022-02-12T11:58:35.0Z", 13 | "_links": { 14 | "self": { 15 | "href": "...", 16 | "type": "application/hal+json" 17 | }, 18 | "documentation": { 19 | "href": "...", 20 | "type": "text/html" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Fake/Responses/unprocessable-entity.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": 422, 3 | "title": "Unprocessable Entity", 4 | "detail": "Non-existent parameter \"recurringType\" for this API call. Did you mean: \"sequenceType\"?" 5 | } 6 | -------------------------------------------------------------------------------- /src/Fake/SequenceMockResponse.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | private array $responses; 11 | 12 | private int $index = 0; 13 | 14 | public function __construct(...$responses) 15 | { 16 | $this->responses = $responses; 17 | } 18 | 19 | public function pop(): MockResponse 20 | { 21 | if (! isset($this->responses[$this->index])) { 22 | throw new \RuntimeException('No more responses available.'); 23 | } 24 | 25 | $response = $this->responses[$this->index]; 26 | 27 | unset($this->responses[$this->index]); 28 | 29 | $this->index++; 30 | 31 | return $response; 32 | } 33 | 34 | public function isEmpty(): bool 35 | { 36 | return count($this->responses) === 0; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Http/Adapter/CurlInitializationException.php: -------------------------------------------------------------------------------- 1 | pendingRequest = $pendingRequest; 25 | $this->plainMessage = $message; 26 | 27 | parent::__construct($message, 0, $previous); 28 | } 29 | 30 | public function getPendingRequest(): PendingRequest 31 | { 32 | return $this->pendingRequest; 33 | } 34 | 35 | public function getPlainMessage(): string 36 | { 37 | return $this->plainMessage; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Http/Auth/AccessTokenAuthenticator.php: -------------------------------------------------------------------------------- 1 | isTestToken = strpos($token, 'test_') === 0; 19 | 20 | parent::__construct($token); 21 | } 22 | 23 | public function isTestToken(): bool 24 | { 25 | return $this->isTestToken; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Http/Auth/BearerTokenAuthenticator.php: -------------------------------------------------------------------------------- 1 | token = trim($token); 16 | } 17 | 18 | public function authenticate(PendingRequest $pendingRequest): void 19 | { 20 | $pendingRequest->headers()->add('Authorization', "Bearer {$this->token}"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Http/Data/ApplicationFee.php: -------------------------------------------------------------------------------- 1 | amount = $amount; 18 | $this->description = $description; 19 | } 20 | 21 | public function toArray(): array 22 | { 23 | return [ 24 | 'amount' => $this->amount, 25 | 'description' => $this->description, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Http/Data/Discount.php: -------------------------------------------------------------------------------- 1 | type = $type; 21 | $this->value = $value; 22 | } 23 | 24 | public function toArray(): array 25 | { 26 | return [ 27 | 'type' => $this->type, 28 | 'value' => $this->value, 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Http/Data/EmailDetails.php: -------------------------------------------------------------------------------- 1 | subject = $subject; 21 | $this->body = $body; 22 | } 23 | 24 | public function toArray(): array 25 | { 26 | return [ 27 | 'subject' => $this->subject, 28 | 'body' => $this->body, 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Http/Data/InvoiceLine.php: -------------------------------------------------------------------------------- 1 | description = $description; 27 | $this->quantity = $quantity; 28 | $this->vatRate = $vatRate; 29 | $this->unitPrice = $unitPrice; 30 | $this->discount = $discount; 31 | } 32 | 33 | public function toArray(): array 34 | { 35 | return [ 36 | 'description' => $this->description, 37 | 'quantity' => $this->quantity, 38 | 'vatRate' => $this->vatRate, 39 | 'unitPrice' => $this->unitPrice, 40 | 'discount' => $this->discount, 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Http/Data/Money.php: -------------------------------------------------------------------------------- 1 | currency = $currency; 18 | $this->value = $value; 19 | } 20 | 21 | public function toArray(): array 22 | { 23 | return [ 24 | 'currency' => $this->currency, 25 | 'value' => $this->value, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Http/Data/Owner.php: -------------------------------------------------------------------------------- 1 | email = $email; 27 | $this->givenName = $givenName; 28 | $this->familyName = $familyName; 29 | $this->locale = $locale; 30 | } 31 | 32 | public function toArray(): array 33 | { 34 | return [ 35 | 'email' => $this->email, 36 | 'givenName' => $this->givenName, 37 | 'familyName' => $this->familyName, 38 | 'locale' => $this->locale, 39 | ]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Http/Data/PaginatedQuery.php: -------------------------------------------------------------------------------- 1 | from = $from; 18 | $this->limit = $limit; 19 | } 20 | 21 | public function toArray(): array 22 | { 23 | return [ 24 | 'from' => $this->from, 25 | 'limit' => $this->limit, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Http/Data/PaymentDetails.php: -------------------------------------------------------------------------------- 1 | source = $source; 21 | $this->sourceDescription = $sourceDescription; 22 | } 23 | 24 | public function toArray(): array 25 | { 26 | return [ 27 | 'source' => $this->source, 28 | 'sourceDescription' => $this->sourceDescription, 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Http/Data/PaymentRoute.php: -------------------------------------------------------------------------------- 1 | amount = $amount; 22 | $this->organizationId = $organizationId; 23 | $this->delayUntil = $delayUntil; 24 | } 25 | 26 | public function toArray(): array 27 | { 28 | return [ 29 | 'amount' => $this->amount, 30 | 'destination' => [ 31 | 'type' => 'organization', 32 | 'organizationId' => $this->organizationId, 33 | ], 34 | 'delayUntil' => $this->delayUntil, 35 | ]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Http/Data/RefundRoute.php: -------------------------------------------------------------------------------- 1 | amount = $amount; 18 | $this->organizationId = $organizationId; 19 | } 20 | 21 | public function toArray(): array 22 | { 23 | return [ 24 | 'amount' => $this->amount, 25 | 'source' => [ 26 | 'type' => 'organization', 27 | 'organizationId' => $this->organizationId, 28 | ], 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Http/Data/SortablePaginatedQuery.php: -------------------------------------------------------------------------------- 1 | sort = $sort; 17 | } 18 | 19 | public function toArray(): array 20 | { 21 | return array_merge( 22 | parent::toArray(), 23 | [ 24 | 'sort' => $this->sort, 25 | ] 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Http/Middleware/Handler.php: -------------------------------------------------------------------------------- 1 | callback = $callback; 18 | $this->name = $name; 19 | $this->priority = $priority; 20 | } 21 | 22 | public function callback(): callable 23 | { 24 | return $this->callback; 25 | } 26 | 27 | public function name(): ?string 28 | { 29 | return $this->name; 30 | } 31 | 32 | public function priority(): string 33 | { 34 | return $this->priority; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Http/Middleware/Hydrate.php: -------------------------------------------------------------------------------- 1 | getRequest(); 15 | 16 | if (! $response->isEmpty() && $request instanceof ResourceHydratableRequest && $request->isHydratable()) { 17 | return (new ResourceHydrator)->hydrate($request, $response); 18 | } 19 | 20 | return $response; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Http/Middleware/MiddlewarePriority.php: -------------------------------------------------------------------------------- 1 | getConnector()->resetIdempotencyKey(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Http/PendingRequest/AuthenticateRequest.php: -------------------------------------------------------------------------------- 1 | getConnector()->getAuthenticator(); 13 | 14 | if (! $authenticator) { 15 | throw new MissingAuthenticationException; 16 | } 17 | 18 | $authenticator->authenticate($pendingRequest); 19 | 20 | return $pendingRequest; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Http/PendingRequest/MergeBody.php: -------------------------------------------------------------------------------- 1 | getRequest(); 13 | 14 | if (! $request instanceof HasPayload) { 15 | return $pendingRequest; 16 | } 17 | 18 | $body = $request->payload(); 19 | 20 | $pendingRequest->setPayload($body); 21 | 22 | if (! $pendingRequest->headers()->get('Content-Type')) { 23 | $pendingRequest->headers()->add('Content-Type', 'application/json'); 24 | } 25 | 26 | return $pendingRequest; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Http/PendingRequest/MergeRequestProperties.php: -------------------------------------------------------------------------------- 1 | getConnector(); 12 | $request = $pendingRequest->getRequest(); 13 | 14 | $pendingRequest 15 | ->headers() 16 | ->merge( 17 | $client->headers()->all(), 18 | $request->headers()->all() 19 | ); 20 | 21 | $pendingRequest 22 | ->query() 23 | ->merge( 24 | $client->query()->all(), 25 | $request->query()->all() 26 | ); 27 | 28 | return $pendingRequest; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Http/PendingRequest/SetUserAgent.php: -------------------------------------------------------------------------------- 1 | getConnector()->getVersionStrings(), ' '); 14 | 15 | $authenticator = $pendingRequest->getConnector()->getAuthenticator(); 16 | 17 | if ($authenticator instanceof AccessTokenAuthenticator) { 18 | $userAgent .= ' Auth/Token'; 19 | } 20 | 21 | $pendingRequest->headers()->add('User-Agent', $userAgent); 22 | 23 | return $pendingRequest; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Http/Request.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 23 | $this->id = $id; 24 | } 25 | 26 | public function resolveResourcePath(): string 27 | { 28 | return "payments/{$this->paymentId}/refunds/{$this->id}"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Http/Requests/CancelPaymentRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 23 | } 24 | 25 | public function resolveResourcePath(): string 26 | { 27 | return "payments/{$this->id}"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/CancelSessionRequest.php: -------------------------------------------------------------------------------- 1 | sessionId = $sessionId; 19 | } 20 | 21 | public function resolveResourcePath(): string 22 | { 23 | return "sessions/{$this->sessionId}"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Http/Requests/DeleteCustomerRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 21 | } 22 | 23 | public function resolveResourcePath(): string 24 | { 25 | return "customers/{$this->id}"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Http/Requests/DeletePaymentLinkRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 21 | } 22 | 23 | public function resolveResourcePath(): string 24 | { 25 | return "payment-links/{$this->id}"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Http/Requests/DeleteProfileRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 20 | } 21 | 22 | public function resolveResourcePath(): string 23 | { 24 | return "profiles/{$this->id}"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Http/Requests/DeleteSalesInvoiceRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 17 | } 18 | 19 | public function resolveResourcePath(): string 20 | { 21 | return "sales-invoices/{$this->id}"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Http/Requests/DisableMethodIssuerRequest.php: -------------------------------------------------------------------------------- 1 | profileId = $profileId; 24 | $this->methodId = $methodId; 25 | $this->issuerId = $issuerId; 26 | } 27 | 28 | public function resolveResourcePath(): string 29 | { 30 | return "profiles/{$this->profileId}/methods/{$this->methodId}/issuers/{$this->issuerId}"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Http/Requests/DisableMethodRequest.php: -------------------------------------------------------------------------------- 1 | profileId = $profileId; 22 | $this->methodId = $methodId; 23 | } 24 | 25 | public function resolveResourcePath(): string 26 | { 27 | return "profiles/{$this->profileId}/methods/{$this->methodId}"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/DynamicDeleteRequest.php: -------------------------------------------------------------------------------- 1 | query()->merge($query); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Http/Requests/DynamicGetRequest.php: -------------------------------------------------------------------------------- 1 | query()->merge($query); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Http/Requests/DynamicPaginatedRequest.php: -------------------------------------------------------------------------------- 1 | payload()->merge($payload); 27 | $this->query()->merge($query); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/DynamicPutRequest.php: -------------------------------------------------------------------------------- 1 | payload()->merge($payload); 27 | $this->query()->merge($query); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/DynamicRequest.php: -------------------------------------------------------------------------------- 1 | url = $url; 16 | } 17 | 18 | public function resolveResourcePath(): string 19 | { 20 | return $this->url; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Http/Requests/EnableMethodRequest.php: -------------------------------------------------------------------------------- 1 | profileId = $profileId; 27 | $this->methodId = $methodId; 28 | } 29 | 30 | public function resolveResourcePath(): string 31 | { 32 | return "profiles/{$this->profileId}/methods/{$this->methodId}"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Http/Requests/GetBalanceRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 20 | } 21 | 22 | /** 23 | * Resolve the resource path. 24 | */ 25 | public function resolveResourcePath(): string 26 | { 27 | return "balances/{$this->id}"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/GetCapabilityRequest.php: -------------------------------------------------------------------------------- 1 | name = $name; 22 | } 23 | 24 | public function resolveResourcePath(): string 25 | { 26 | return "capabilities/{$this->name}"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Http/Requests/GetCurrentProfileRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 20 | } 21 | 22 | /** 23 | * Resolve the resource path. 24 | */ 25 | public function resolveResourcePath(): string 26 | { 27 | return "customers/{$this->id}"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/GetInvoiceRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 19 | } 20 | 21 | /** 22 | * Resolve the resource path. 23 | */ 24 | public function resolveResourcePath(): string 25 | { 26 | return "invoices/{$this->id}"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Http/Requests/GetMandateRequest.php: -------------------------------------------------------------------------------- 1 | customerId = $customerId; 28 | $this->mandateId = $mandateId; 29 | } 30 | 31 | public function resolveResourcePath(): string 32 | { 33 | return "customers/{$this->customerId}/mandates/{$this->mandateId}"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Requests/GetOnboardingStatusRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 20 | } 21 | 22 | public function resolveResourcePath(): string 23 | { 24 | return "organizations/{$this->id}"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedBalanceRequest.php: -------------------------------------------------------------------------------- 1 | balanceId = $balanceId; 26 | 27 | parent::__construct($from, $limit); 28 | } 29 | 30 | public function resolveResourcePath(): string 31 | { 32 | return "balances/{$this->balanceId}/transactions"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedCustomerRequest.php: -------------------------------------------------------------------------------- 1 | query() 27 | ->add('reference', $reference) 28 | ->add('year', $year); 29 | } 30 | 31 | public function resolveResourcePath(): string 32 | { 33 | return 'invoices'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedMandateRequest.php: -------------------------------------------------------------------------------- 1 | customerId = $customerId; 24 | 25 | parent::__construct($from, $limit); 26 | } 27 | 28 | public function resolveResourcePath(): string 29 | { 30 | return "customers/{$this->customerId}/mandates"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedPaymentLinkPaymentsRequest.php: -------------------------------------------------------------------------------- 1 | paymentLinkId = $paymentLinkId; 24 | 25 | parent::__construct($from, $limit, $sort); 26 | } 27 | 28 | /** 29 | * Resolve the resource path. 30 | */ 31 | public function resolveResourcePath(): string 32 | { 33 | return "payment-links/{$this->paymentLinkId}/payments"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedPaymentLinksRequest.php: -------------------------------------------------------------------------------- 1 | query() 29 | ->add('embed', $embedPayment ? PaymentIncludesQuery::PAYMENT : null) 30 | ->add('profileId', $profileId); 31 | } 32 | 33 | public function resolveResourcePath(): string 34 | { 35 | return 'refunds'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedSalesInvoicesRequest.php: -------------------------------------------------------------------------------- 1 | settlementId = $settlementId; 20 | 21 | parent::__construct($from, $limit, $includePayment, $profileId); 22 | } 23 | 24 | /** 25 | * Resolve the resource path. 26 | */ 27 | public function resolveResourcePath(): string 28 | { 29 | return "settlements/{$this->settlementId}/chargebacks"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedSettlementPaymentsRequest.php: -------------------------------------------------------------------------------- 1 | settlementId = $settlementId; 24 | 25 | parent::__construct($from, $limit, $sort); 26 | } 27 | 28 | /** 29 | * Resolve the resource path. 30 | */ 31 | public function resolveResourcePath(): string 32 | { 33 | return "settlements/{$this->settlementId}/payments"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedSettlementsRequest.php: -------------------------------------------------------------------------------- 1 | query() 26 | ->add('balanceId', $balanceId); 27 | } 28 | 29 | /** 30 | * Resolve the resource path. 31 | */ 32 | public function resolveResourcePath(): string 33 | { 34 | return 'settlements'; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedSubscriptionsRequest.php: -------------------------------------------------------------------------------- 1 | customerId = $customerId; 24 | 25 | parent::__construct($from, $limit); 26 | } 27 | 28 | /** 29 | * The resource path. 30 | */ 31 | public function resolveResourcePath(): string 32 | { 33 | return "customers/{$this->customerId}/subscriptions"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPaginatedTerminalsRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 26 | } 27 | 28 | /** 29 | * Resolve the resource path. 30 | */ 31 | public function resolveResourcePath(): string 32 | { 33 | return "payment-links/{$this->id}"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Requests/GetPermissionRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 23 | } 24 | 25 | public function resolveResourcePath(): string 26 | { 27 | return "permissions/{$this->id}"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/GetProfileRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 23 | } 24 | 25 | public function resolveResourcePath(): string 26 | { 27 | return "profiles/{$this->id}"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/Requests/GetSalesInvoiceRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 25 | } 26 | 27 | public function resolveResourcePath(): string 28 | { 29 | return "sales-invoices/{$this->id}"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Http/Requests/GetSessionRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 19 | } 20 | 21 | public function resolveResourcePath(): string 22 | { 23 | return 'sessions/' . $this->id; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Http/Requests/GetSettlementRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 20 | } 21 | 22 | public function resolveResourcePath(): string 23 | { 24 | return "settlements/{$this->id}"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Http/Requests/GetSubscriptionRequest.php: -------------------------------------------------------------------------------- 1 | customerId = $customerId; 28 | $this->id = $id; 29 | } 30 | 31 | public function resolveResourcePath(): string 32 | { 33 | return "customers/{$this->customerId}/subscriptions/{$this->id}"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Requests/GetTerminalRequest.php: -------------------------------------------------------------------------------- 1 | id = $id; 23 | } 24 | 25 | /** 26 | * The resource path. 27 | */ 28 | public function resolveResourcePath(): string 29 | { 30 | return "terminals/{$this->id}"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Http/Requests/ListCapabilitiesRequest.php: -------------------------------------------------------------------------------- 1 | from = $from; 23 | $this->limit = $limit; 24 | } 25 | 26 | protected function defaultQuery(): array 27 | { 28 | return [ 29 | 'from' => $this->from, 30 | 'limit' => $this->limit, 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Http/Requests/ReleasePaymentAuthorizationRequest.php: -------------------------------------------------------------------------------- 1 | paymentId = $paymentId; 18 | } 19 | 20 | public function resolveResourcePath(): string 21 | { 22 | return 'payments/' . $this->paymentId . '/release-authorization'; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Http/Requests/RevokeMandateRequest.php: -------------------------------------------------------------------------------- 1 | customerId = $customerId; 26 | $this->mandateId = $mandateId; 27 | } 28 | 29 | public function resolveResourcePath(): string 30 | { 31 | return "customers/{$this->customerId}/mandates/{$this->mandateId}"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Http/Requests/SortablePaginatedRequest.php: -------------------------------------------------------------------------------- 1 | query()->add('sort', $sort); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Idempotency/FakeIdempotencyKeyGenerator.php: -------------------------------------------------------------------------------- 1 | fakeKey = $fakeKey; 16 | } 17 | 18 | public function generate(): string 19 | { 20 | return $this->fakeKey; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Repositories/JsonPayloadRepository.php: -------------------------------------------------------------------------------- 1 | store); 15 | } 16 | 17 | public function toStream(StreamFactoryInterface $streamFactory): StreamInterface 18 | { 19 | return $streamFactory->createStream((string) $this); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Resources/AnyResource.php: -------------------------------------------------------------------------------- 1 | attributes, $name); 22 | } 23 | 24 | /** 25 | * @param array|stdClass $attributes 26 | */ 27 | public function fill($attributes): void 28 | { 29 | $this->attributes = $attributes instanceof stdClass ? (array) $attributes : $attributes; 30 | } 31 | 32 | public function toArray(): array 33 | { 34 | return $this->attributes; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resources/BalanceCollection.php: -------------------------------------------------------------------------------- 1 | connector = $connector; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resources/CapabilityCollection.php: -------------------------------------------------------------------------------- 1 | Organization::class, 47 | 'onboarding' => Onboarding::class, 48 | ]; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Resources/ClientCollection.php: -------------------------------------------------------------------------------- 1 | connector->profileMethods->createForCurrentProfile($methodId); 18 | } 19 | 20 | /** 21 | * Disable a payment method for this profile. 22 | * 23 | * 24 | * @throws ApiException 25 | */ 26 | public function disableMethod(string $methodId): void 27 | { 28 | $this->connector->profileMethods->deleteForCurrentProfile($methodId); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resources/CustomerCollection.php: -------------------------------------------------------------------------------- 1 | filter(fn (Mandate $mandate) => $mandate->status === $status); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Resources/MethodCollection.php: -------------------------------------------------------------------------------- 1 | setResponse($response); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Resources/ResourceWrapper.php: -------------------------------------------------------------------------------- 1 | wrapped = $wrapped; 21 | 22 | return $this; 23 | } 24 | 25 | /** 26 | * @param mixed $resource 27 | * @return static 28 | */ 29 | public function wrap($resource) 30 | { 31 | return $this->setWrapped($resource); 32 | } 33 | 34 | /** 35 | * @return mixed 36 | */ 37 | public function getWrapped() 38 | { 39 | return $this->wrapped; 40 | } 41 | 42 | public function __get($name) 43 | { 44 | return $this->wrapped->{$name}; 45 | } 46 | 47 | public function __call($name, $arguments) 48 | { 49 | return $this->forwardDecoratedCallTo($this->wrapped, $name, $arguments); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Resources/Route.php: -------------------------------------------------------------------------------- 1 | wrapper = $wrapper; 18 | } 19 | 20 | public function getWrapper(): string 21 | { 22 | return $this->wrapper; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Traits/GetAllConstants.php: -------------------------------------------------------------------------------- 1 | getConstants()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Traits/HandlesAuthentication.php: -------------------------------------------------------------------------------- 1 | authenticator = new ApiKeyAuthenticator($apiKey); 22 | 23 | return $this; 24 | } 25 | 26 | /** 27 | * @param string $accessToken OAuth access token, starting with 'access_' 28 | * 29 | * @throws ApiException 30 | */ 31 | public function setAccessToken(string $accessToken): self 32 | { 33 | $this->authenticator = new AccessTokenAuthenticator($accessToken); 34 | 35 | return $this; 36 | } 37 | 38 | public function getAuthenticator(): ?Authenticator 39 | { 40 | return $this->authenticator; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Traits/HandlesTestmode.php: -------------------------------------------------------------------------------- 1 | testmode = $testmode; 12 | 13 | return $this; 14 | } 15 | 16 | public function getTestmode(): ?bool 17 | { 18 | return $this->testmode; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Traits/HandlesVersions.php: -------------------------------------------------------------------------------- 1 | addVersionString('Mollie/'.MollieApiClient::CLIENT_VERSION); 17 | $this->addVersionString('PHP/'.phpversion()); 18 | 19 | if ($clientVersion = $this->httpClient->version()) { 20 | $this->addVersionString($clientVersion); 21 | } 22 | } 23 | 24 | /** 25 | * @param string $versionString 26 | */ 27 | public function addVersionString($versionString): self 28 | { 29 | $this->versionStrings[] = str_replace([' ', "\t", "\n", "\r"], '-', $versionString); 30 | 31 | return $this; 32 | } 33 | 34 | public function getVersionStrings(): array 35 | { 36 | return $this->versionStrings; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Traits/HasDefaultFactories.php: -------------------------------------------------------------------------------- 1 | headers ??= new ArrayStore($this->defaultHeaders()); 15 | } 16 | 17 | protected function defaultHeaders(): array 18 | { 19 | return []; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Traits/HasJsonPayload.php: -------------------------------------------------------------------------------- 1 | body ??= new JsonPayloadRepository($this->defaultPayload()); 14 | } 15 | 16 | protected function defaultPayload(): array 17 | { 18 | return []; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Traits/HasMiddleware.php: -------------------------------------------------------------------------------- 1 | middleware ??= new Middleware; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Traits/HasMode.php: -------------------------------------------------------------------------------- 1 | mode === 'test'; 13 | } 14 | 15 | public function withMode(array $options = []): array 16 | { 17 | return array_merge($options, ['testmode' => $this->isInTestmode()]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Traits/HasQuery.php: -------------------------------------------------------------------------------- 1 | queryStore ??= new ArrayStore($this->defaultQuery()); 15 | } 16 | 17 | protected function defaultQuery(): array 18 | { 19 | return []; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Traits/HasRequestProperties.php: -------------------------------------------------------------------------------- 1 | response; 15 | } 16 | 17 | /** 18 | * @return $this 19 | */ 20 | public function setResponse(Response $response) 21 | { 22 | $this->response = $response; 23 | 24 | return $this; 25 | } 26 | 27 | public function getPendingRequest(): PendingRequest 28 | { 29 | return $this->response->getPendingRequest(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Traits/Initializable.php: -------------------------------------------------------------------------------- 1 | getShortName(); 16 | 17 | if (method_exists($this, $method)) { 18 | $this->{$method}(); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Traits/IsIteratableRequest.php: -------------------------------------------------------------------------------- 1 | iteratorEnabled; 19 | } 20 | 21 | public function iteratesBackwards(): bool 22 | { 23 | return $this->iterateBackwards; 24 | } 25 | 26 | public function useIterator(): self 27 | { 28 | $this->iteratorEnabled = true; 29 | 30 | return $this; 31 | } 32 | 33 | public function setIterationDirection(bool $iterateBackwards = false): self 34 | { 35 | $this->iterateBackwards = $iterateBackwards; 36 | 37 | return $this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Traits/SendsRequests.php: -------------------------------------------------------------------------------- 1 | executeRequestHandlers(); 23 | 24 | $pendingRequest = (new DataTransformer())->transform($pendingRequest); 25 | 26 | try { 27 | $response = $this->httpClient->sendRequest($pendingRequest); 28 | 29 | return $pendingRequest->executeResponseHandlers($response); 30 | } catch (MollieException $exception) { 31 | $exception = $pendingRequest->executeFatalHandlers($exception); 32 | 33 | throw $exception; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Types/ApprovalPrompt.php: -------------------------------------------------------------------------------- 1 | requestFactory = $requestFactory; 27 | $this->responseFactory = $responseFactory; 28 | $this->streamFactory = $streamFactory; 29 | $this->uriFactory = $uriFactory; 30 | } 31 | } 32 | --------------------------------------------------------------------------------