├── CHANGELOG.md ├── LICENSE ├── MangoPay ├── AVSResult.php ├── Address.php ├── ApiBankAccounts.php ├── ApiBankingAliases.php ├── ApiCardPreAuthorizations.php ├── ApiCardRegistrations.php ├── ApiCards.php ├── ApiClients.php ├── ApiConversions.php ├── ApiDeposits.php ├── ApiDisputeDocuments.php ├── ApiDisputes.php ├── ApiEvents.php ├── ApiHooks.php ├── ApiIdentityVerification.php ├── ApiKycDocuments.php ├── ApiMandates.php ├── ApiPayIns.php ├── ApiPayOuts.php ├── ApiRecipients.php ├── ApiRefunds.php ├── ApiRegulatory.php ├── ApiReports.php ├── ApiRepudiations.php ├── ApiResponses.php ├── ApiTransfers.php ├── ApiUboDeclarations.php ├── ApiUsers.php ├── ApiVirtualAccounts.php ├── ApiWallets.php ├── Autoloader.php ├── BankAccount.php ├── BankAccountDetails.php ├── BankAccountDetailsCA.php ├── BankAccountDetailsGB.php ├── BankAccountDetailsIBAN.php ├── BankAccountDetailsOTHER.php ├── BankAccountDetailsUS.php ├── BankingAlias.php ├── BankingAliasIBAN.php ├── BankingAliasOTHER.php ├── BankingAliasType.php ├── Billing.php ├── Birthplace.php ├── BrowserInfo.php ├── BusinessRecipient.php ├── BusinessRecipientPropertySchema.php ├── BusinessType.php ├── CancelDeposit.php ├── Card.php ├── CardInfo.php ├── CardPreAuthorization.php ├── CardPreAuthorizationPaymentStatus.php ├── CardPreAuthorizationStatus.php ├── CardRegistration.php ├── CardRegistrationStatus.php ├── CardValidation.php ├── CardValidationStatus.php ├── CardValidity.php ├── Check.php ├── CheckData.php ├── Client.php ├── ClientLogoUpload.php ├── CompanyNumber.php ├── CompanyNumberDetails.php ├── Conversion.php ├── ConversionQuote.php ├── ConversionRate.php ├── CountryAuthorization.php ├── CountryAuthorizationData.php ├── CreateCardPreAuthorizedDepositPayIn.php ├── CreateClientWalletsInstantConversion.php ├── CreateClientWalletsQuotedConversion.php ├── CreateDeposit.php ├── CreateInstantConversion.php ├── CreateQuotedConversion.php ├── CurrencyIso.php ├── DebitedBankAccount.php ├── DeclaredUbo.php ├── DeclaredUboStatus.php ├── Deposit.php ├── DepositStatus.php ├── Dispute.php ├── DisputeDocument.php ├── DisputeDocumentPage.php ├── DisputeDocumentStatus.php ├── DisputeDocumentType.php ├── DisputeReason.php ├── DisputeReasonType.php ├── DisputeStatus.php ├── DisputeType.php ├── DocumentPageConsult.php ├── EMoney.php ├── Event.php ├── EventType.php ├── FallbackReason.php ├── FilterBankAccounts.php ├── FilterBase.php ├── FilterCards.php ├── FilterDisputeDocuments.php ├── FilterDisputes.php ├── FilterEvents.php ├── FilterKycDocuments.php ├── FilterPreAuthorizations.php ├── FilterRecipients.php ├── FilterRefunds.php ├── FilterReports.php ├── FilterTransactions.php ├── FilterWallets.php ├── FundsType.php ├── Hook.php ├── HookStatus.php ├── HookValidity.php ├── IdentityVerification.php ├── IndividualRecipient.php ├── IndividualRecipientPropertySchema.php ├── InstantPayout.php ├── InternationalAccount.php ├── InternationalAccountDetails.php ├── KeyValueArray.php ├── KycDocument.php ├── KycDocumentRefusedReasonType.php ├── KycDocumentStatus.php ├── KycDocumentType.php ├── KycLevel.php ├── KycPage.php ├── LegalPersonType.php ├── LegalRepresentative.php ├── Libraries │ ├── ApiBase.php │ ├── ApiOAuth.php │ ├── AuthenticationHelper.php │ ├── AuthorizationTokenManager.php │ ├── Configuration.php │ ├── DefaultStorageStrategy.php │ ├── Document.php │ ├── Dto.php │ ├── EntityBase.php │ ├── Error.php │ ├── Exception.php │ ├── HttpBase.php │ ├── HttpCurl.php │ ├── HttpResponse.php │ ├── IStorageStrategy.php │ ├── Logs.php │ ├── OAuthToken.php │ ├── RequestType.php │ ├── ResponseException.php │ ├── RestTool.php │ ├── Upload.php │ └── UrlTool.php ├── LineItem.php ├── LocalAccount.php ├── LocalAccountDetails.php ├── LocalAccountDetailsBankingAlias.php ├── Mandate.php ├── MandateStatus.php ├── MangoPayApi.php ├── Money.php ├── NaturalUserCapacity.php ├── Pagination.php ├── PayIn.php ├── PayInCardTemplateURLOptions.php ├── PayInExecutionDetails.php ├── PayInExecutionDetailsDirect.php ├── PayInExecutionDetailsExternalInstruction.php ├── PayInExecutionDetailsWeb.php ├── PayInExecutionType.php ├── PayInPaymentDetails.php ├── PayInPaymentDetailsApplePay.php ├── PayInPaymentDetailsBancontact.php ├── PayInPaymentDetailsBankWire.php ├── PayInPaymentDetailsBlik.php ├── PayInPaymentDetailsCard.php ├── PayInPaymentDetailsDirectDebit.php ├── PayInPaymentDetailsDirectDebitDirect.php ├── PayInPaymentDetailsGiropay.php ├── PayInPaymentDetailsGooglePay.php ├── PayInPaymentDetailsIdeal.php ├── PayInPaymentDetailsKlarna.php ├── PayInPaymentDetailsMbway.php ├── PayInPaymentDetailsMultibanco.php ├── PayInPaymentDetailsPayByBank.php ├── PayInPaymentDetailsPayconiq.php ├── PayInPaymentDetailsPaypal.php ├── PayInPaymentDetailsPreAuthorized.php ├── PayInPaymentDetailsSatispay.php ├── PayInPaymentDetailsSwish.php ├── PayInPaymentDetailsTwint.php ├── PayInPaymentType.php ├── PayInRecurring.php ├── PayInRecurringRegistration.php ├── PayInRecurringRegistrationGet.php ├── PayInRecurringRegistrationRequestResponse.php ├── PayInRecurringRegistrationUpdate.php ├── PayInStatus.php ├── PayInTemplateURLOptions.php ├── PayInWebExtendedView.php ├── PayOut.php ├── PayOutEligibilityRequest.php ├── PayOutEligibilityResponse.php ├── PayOutPaymentDetails.php ├── PayOutPaymentDetailsBankWire.php ├── PayOutPaymentRef.php ├── PayOutPaymentType.php ├── PayOutStatus.php ├── PayPalWebTracking.php ├── PayinsLinked.php ├── PaymentData.php ├── PaymentMethodMetadata.php ├── PayoutMethods.php ├── PendingUserAction.php ├── PersonType.php ├── PlatformCategorization.php ├── RateLimit.php ├── Recipient.php ├── RecipientAddressPropertySchema.php ├── RecipientPropertySchema.php ├── RecipientSchema.php ├── RecurringPayInCIT.php ├── RecurringPayInCurrentState.php ├── RecurringPayInMIT.php ├── RecurringPayPalPayInCIT.php ├── RecurringPayPalPayInMIT.php ├── Refund.php ├── RefundReasonDetails.php ├── RefundStatus.php ├── ReportRequest.php ├── ReportStatus.php ├── ReportType.php ├── Repudiation.php ├── Response.php ├── ScopeBlocked.php ├── Sector.php ├── SecurityInfo.php ├── SettlementTransfer.php ├── Shipping.php ├── ShippingAddress.php ├── ShippingPreference.php ├── SortDirection.php ├── Sorting.php ├── Transaction.php ├── TransactionNature.php ├── TransactionStatus.php ├── TransactionType.php ├── Transfer.php ├── Ubo.php ├── UboDeclaration.php ├── UboDeclarationRefusedOrIncompleteReasonType.php ├── UboDeclarationRefusedReasonType.php ├── UboDeclarationStatus.php ├── UboRefusedReasonType.php ├── UpdateDeposit.php ├── User.php ├── UserBlockStatus.php ├── UserCategory.php ├── UserEnrollmentResult.php ├── UserLegal.php ├── UserLegalSca.php ├── UserNatural.php ├── UserNaturalSca.php ├── VirtualAccount.php ├── VirtualAccountAddress.php ├── VirtualAccountAvailabilities.php ├── VirtualAccountAvailability.php ├── VirtualAccountCapabilities.php ├── VirtualAccountOwner.php ├── VirtualAccountPurpose.php ├── VirtualAccountStatus.php └── Wallet.php ├── README.md ├── composer.json └── tests ├── Cases ├── BankAccountsTest.php ├── BankingAliasTest.php ├── Base.php ├── CardPreAuthorizationsTest.php ├── CardRegistrationsTest.php ├── CardsTest.php ├── ClientTest.php ├── ConfigurationTest.php ├── Constants.php ├── ConversionsTest.php ├── DepositTest.php ├── DisputesTest.php ├── ErrorTests.php ├── EventsTest.php ├── HooksTest.php ├── IdempotencyTest.php ├── IdentityVerificationTest.php ├── KycDocumentsTest.php ├── MandatesTest.php ├── PayInsTest.php ├── PayOutsTest.php ├── RateLimitTest.php ├── RecipientsTest.php ├── RefundsTest.php ├── RegulatoryTest.php ├── ReportsTest.php ├── TokensTest.php ├── TransfersTest.php ├── UboDeclarationsTest.php ├── UsersTest.php ├── VirtualAccountsTest.php └── WalletsTest.php ├── Mocks └── MockStorageStrategy.php └── TestKycPageFile.png /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mangopay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /MangoPay/AVSResult.php: -------------------------------------------------------------------------------- 1 | IsEmpty($this->AddressLine1) 49 | && $this->IsEmpty($this->AddressLine2) 50 | && $this->IsEmpty($this->City) 51 | && $this->IsEmpty($this->Region) 52 | && $this->IsEmpty($this->PostalCode) 53 | && $this->IsEmpty($this->Country); 54 | } 55 | 56 | private function IsEmpty($value) 57 | { 58 | return is_null($value) || empty($value); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /MangoPay/ApiBankAccounts.php: -------------------------------------------------------------------------------- 1 | GetList('transactions_get_for_bank_account', $pagination, '\MangoPay\Transaction', $bankAccountId, $filter, $sorting); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MangoPay/ApiCardPreAuthorizations.php: -------------------------------------------------------------------------------- 1 | CreateObject('preauthorization_create', $cardPreAuthorization, '\MangoPay\CardPreAuthorization', null, null, $idempotencyKey); 18 | } 19 | 20 | /** 21 | * Get pre-authorization object 22 | * @param string $cardPreAuthorizationId PreAuthorization identifier 23 | * @return \MangoPay\CardPreAuthorization Card registration object returned from API 24 | */ 25 | public function Get($cardPreAuthorizationId) 26 | { 27 | return $this->GetObject('preauthorization_get', '\MangoPay\CardPreAuthorization', $cardPreAuthorizationId); 28 | } 29 | 30 | /** 31 | * Update pre-authorization object 32 | * @param \MangoPay\CardPreAuthorization $cardPreAuthorization PreAuthorization object to save 33 | * @return \MangoPay\CardPreAuthorization PreAuthorization object returned from API 34 | */ 35 | public function Update($cardPreAuthorization) 36 | { 37 | return $this->SaveObject('preauthorization_save', $cardPreAuthorization, '\MangoPay\CardPreAuthorization'); 38 | } 39 | 40 | public function GetTransactions($cardPreAuthorizationId, & $pagination = null, $filter = null, $sorting = null) 41 | { 42 | return $this->GetList('preauthorization_transactions_get', $pagination, '\MangoPay\Transaction', $cardPreAuthorizationId, $filter, $sorting); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MangoPay/ApiCardRegistrations.php: -------------------------------------------------------------------------------- 1 | CreateObject('cardregistration_create', $cardRegistration, '\MangoPay\CardRegistration', null, null, $idempotencyKey); 18 | } 19 | 20 | /** 21 | * Get card registration 22 | * @param string $cardRegistrationId Card Registration identifier 23 | * @return \MangoPay\CardRegistration Card registration object returned from API 24 | */ 25 | public function Get($cardRegistrationId) 26 | { 27 | return $this->GetObject('cardregistration_get', '\MangoPay\CardRegistration', $cardRegistrationId); 28 | } 29 | 30 | /** 31 | * Update card registration 32 | * @param \MangoPay\CardRegistration $cardRegistration Card registration object to save 33 | * @return \MangoPay\CardRegistration Card registration object returned from API 34 | */ 35 | public function Update($cardRegistration) 36 | { 37 | return $this->SaveObject('cardregistration_save', $cardRegistration, '\MangoPay\CardRegistration'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MangoPay/ApiDisputeDocuments.php: -------------------------------------------------------------------------------- 1 | GetObject('disputes_document_get', 'MangoPay\DisputeDocument', $documentId); 23 | } 24 | 25 | /** 26 | * Gets dispute's documents for client 27 | * @param \MangoPay\Pagination $pagination Pagination object 28 | * @param \MangoPay\Sorting $sorting Object to sorting data 29 | * @param \MangoPay\FilterKycDocuments $filter Filtering object 30 | * @return \MangoPay\DisputeDocument[] List of dispute documents returned from API 31 | */ 32 | public function GetAll(& $pagination = null, $sorting = null, $filter = null) 33 | { 34 | return $this->GetList('disputes_document_all', $pagination, 'MangoPay\DisputeDocument', null, $filter, $sorting); 35 | } 36 | 37 | /** 38 | * Creates temporary URLs where each page of a dispute document can be viewed. 39 | * 40 | * @param string $documentId Identification of the document whose pages to view 41 | * @param \MangoPay\Pagination $pagination Pagination object 42 | * @return \MangoPay\DocumentPageConsult[] Array of consults for viewing the dispute document's pages 43 | */ 44 | public function CreateDisputeDocumentConsult($documentId, & $pagination = null) 45 | { 46 | return $this->GetList('disputes_document_create_consult', $pagination, 'MangoPay\DocumentPageConsult', $documentId, null, null); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /MangoPay/ApiEvents.php: -------------------------------------------------------------------------------- 1 | GetList('events_all', $pagination, '\MangoPay\Event', null, $filter, $sorting); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MangoPay/ApiHooks.php: -------------------------------------------------------------------------------- 1 | CreateObject('hooks_create', $hook, '\MangoPay\Hook', null, null, $idempotencyKey); 19 | } 20 | 21 | /** 22 | * Get hook 23 | * @param string $hookId Hook identifier 24 | * @return \MangoPay\Hook Wallet object returned from API 25 | */ 26 | public function Get($hookId) 27 | { 28 | return $this->GetObject('hooks_get', '\MangoPay\Hook', $hookId); 29 | } 30 | 31 | /** 32 | * Save hook 33 | * @param \MangoPay\Hook $hook Hook object to save 34 | * @return \MangoPay\Hook Hook object returned from API 35 | */ 36 | public function Update($hook) 37 | { 38 | return $this->SaveObject('hooks_save', $hook, '\MangoPay\Hook'); 39 | } 40 | 41 | /** 42 | * Get all hooks 43 | * @param \MangoPay\Pagination $pagination Pagination object 44 | * @param \MangoPay\Sorting $sorting Sorting object 45 | * @return \MangoPay\Hook[] Array with objects returned from API 46 | * @throws Libraries\Exception 47 | */ 48 | public function GetAll(& $pagination = null, $sorting = null) 49 | { 50 | return $this->GetList('hooks_all', $pagination, '\MangoPay\Hook', null, null, $sorting); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /MangoPay/ApiIdentityVerification.php: -------------------------------------------------------------------------------- 1 | CreateObject('identity_verification_create', $identityVerification, '\MangoPay\IdentityVerification', $userId, null, $idempotencyKey); 18 | } 19 | 20 | /** 21 | * Get IdentityVerification 22 | * @param string $id IdentityVerification identifier 23 | * @return \MangoPay\IdentityVerification IdentityVerification object returned from API 24 | */ 25 | public function Get($id) 26 | { 27 | return $this->GetObject('identity_verification_get', '\MangoPay\IdentityVerification', $id); 28 | } 29 | 30 | /** 31 | * Get all IdentityVerifications for a user 32 | * @param string $userId User identifier 33 | * @return \MangoPay\IdentityVerification[] IdentityVerification list returned from API 34 | */ 35 | public function GetAll($userId, $pagination = null, $filter = null, $sorting = null) 36 | { 37 | return $this->GetList('identity_verification_get_all', $pagination, '\MangoPay\IdentityVerification', $userId, $filter, $sorting); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MangoPay/ApiKycDocuments.php: -------------------------------------------------------------------------------- 1 | GetList('kyc_documents_all', $pagination, '\MangoPay\KycDocument', null, $filter, $sorting); 20 | } 21 | 22 | /** 23 | * Get KYC document 24 | * @param string $kycDocumentId Document identifier 25 | * @return \MangoPay\KycDocument Document returned from API 26 | */ 27 | public function Get($kycDocumentId) 28 | { 29 | return $this->GetObject('kyc_documents_get_alt', '\MangoPay\KycDocument', $kycDocumentId); 30 | } 31 | 32 | 33 | /** 34 | * Creates temporary URLs where each page of a KYC document can be viewed. 35 | * 36 | * @param string $kycDocumentId Identification of the document whose pages to view 37 | * @param \MangoPay\Pagination $pagination Pagination object 38 | * @return \MangoPay\DocumentPageConsult[] Array of consults for viewing the KYC document's pages 39 | * @throws Libraries\Exception 40 | */ 41 | public function CreateKycDocumentConsult($kycDocumentId, & $pagination = null) 42 | { 43 | return $this->GetList('kyc_documents_create_consult', $pagination, '\MangoPay\DocumentPageConsult', $kycDocumentId, null, null); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /MangoPay/ApiRefunds.php: -------------------------------------------------------------------------------- 1 | GetObject('refunds_get', '\MangoPay\Refund', $refundId); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /MangoPay/ApiRegulatory.php: -------------------------------------------------------------------------------- 1 | GetObject('country_authorization_get', '\MangoPay\CountryAuthorization', $countryCode, null, null, false); 19 | } 20 | 21 | /** 22 | * Get all countries authorizations 23 | * @param \MangoPay\Pagination $pagination 24 | * @param \MangoPay\Sorting $sorting 25 | * @return \MangoPay\CountryAuthorization[] 26 | * @throws Libraries\Exception 27 | */ 28 | public function GetAllCountryAuthorizations(& $pagination = null, $sorting = null) 29 | { 30 | return $this->GetList('country_authorization_all', $pagination, 'MangoPay\CountryAuthorization', null, null, $sorting, null, false); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /MangoPay/ApiReports.php: -------------------------------------------------------------------------------- 1 | ReportType; 18 | 19 | if (is_null($type) || strlen($type) == 0) { 20 | throw new Libraries\Exception('Report type property is required when create a report request.'); 21 | } 22 | 23 | switch ($type) { 24 | case ReportType::Transactions: 25 | return $this->CreateObject('reports_transactions_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey); 26 | case ReportType::Wallets: 27 | return $this->CreateObject('reports_wallets_create', $reportRequest, '\MangoPay\ReportRequest', $type, null, $idempotencyKey); 28 | default: 29 | throw new Libraries\Exception('Unexpected Report type. Wrong ReportType value.'); 30 | } 31 | } 32 | 33 | /** 34 | * Gets report request. 35 | * @param string $reportRequestId Report request identifier 36 | * @return \MangoPay\ReportRequest Report request instance returned from API 37 | */ 38 | public function Get($reportRequestId) 39 | { 40 | return $this->GetObject('reports_get', '\MangoPay\ReportRequest', $reportRequestId); 41 | } 42 | 43 | /** 44 | * Gets all report requests. 45 | * @param \MangoPay\Pagination $pagination Pagination object 46 | * @param \MangoPay\FilterTransactions $filter Object to filter data 47 | * @param \MangoPay\Sorting $sorting Object to sorting data 48 | * @return \MangoPay\ReportRequest Array with report requests 49 | */ 50 | public function GetAll(& $pagination = null, $filter = null, $sorting = null) 51 | { 52 | return $this->GetList('reports_all', $pagination, 'MangoPay\ReportRequest', null, $filter, $sorting); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MangoPay/ApiRepudiations.php: -------------------------------------------------------------------------------- 1 | GetObject('repudiation_get', '\MangoPay\Repudiation', $repudiationId); 16 | } 17 | 18 | /** 19 | * Retrieves a list of Refunds pertaining to a certain Repudiation 20 | * @param string $repudiationId Repudiation identifier 21 | * @param \MangoPay\Pagination $pagination Pagination object 22 | * @param \MangoPay\FilterRefunds $filter Filtering object 23 | * @param \MangoPay\Sorting $sorting Sorting object 24 | * @return \MangoPay\Refund[] 25 | */ 26 | public function GetRefunds($repudiationId, & $pagination = null, $filter = null, $sorting = null) 27 | { 28 | return $this->GetList('refunds_get_for_repudiation', $pagination, '\MangoPay\Repudiation', $repudiationId, $filter, $sorting); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /MangoPay/ApiResponses.php: -------------------------------------------------------------------------------- 1 | GetObject('responses_get', 'MangoPay\Response', $idempotencyKey); 19 | 20 | // Same logic as RestTool::CheckResponseCode 21 | if ($response->StatusCode >= 200 && $response->StatusCode <= 299) { 22 | // Target the class to use from the SDK 23 | $className = $this->GetObjectForIdempotencyUrl($response->RequestURL); 24 | if (is_null($className) || empty($className) || is_null($response->Resource) || empty($response->Resource)) { 25 | return $response; 26 | } 27 | 28 | $response->Resource = $this->CastResponseToEntity($response->Resource, $className); 29 | return $response; 30 | } 31 | 32 | $response->Resource = $this->CastResponseToError($response->Resource); 33 | return $response; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /MangoPay/ApiTransfers.php: -------------------------------------------------------------------------------- 1 | CreateObject('transfers_create', $transfer, '\MangoPay\Transfer', null, null, $idempotencyKey); 18 | } 19 | 20 | /** 21 | * Get transfer 22 | * @param string $transferId Transfer identifier 23 | * @return \MangoPay\Transfer Transfer object returned from API 24 | */ 25 | public function Get($transferId) 26 | { 27 | return $this->GetObject('transfers_get', '\MangoPay\Transfer', $transferId); 28 | } 29 | 30 | /** 31 | * Create refund for transfer object 32 | * @param string $transferId Transfer identifier 33 | * @param \MangoPay\Refund $refund Refund object to create 34 | * @return \MangoPay\Refund Object returned by REST API 35 | */ 36 | public function CreateRefund($transferId, $refund, $idempotencyKey = null) 37 | { 38 | return $this->CreateObject('transfers_createrefunds', $refund, '\MangoPay\Refund', $transferId, null, $idempotencyKey); 39 | } 40 | 41 | /** 42 | * Retrieve list of Refunds pertaining to a certain Transfer 43 | * @param string $transferId Transfer identifier 44 | * @param \MangoPay\Pagination $pagination Pagination object 45 | * @param \MangoPay\FilterRefunds $filter Filtering object 46 | * @param \MangoPay\Sorting $sorting Sorting object 47 | * @return \MangoPay\Refund[] List of the Transfer's Refunds 48 | */ 49 | public function GetRefunds($transferId, & $pagination = null, $filter = null, $sorting = null) 50 | { 51 | return $this->GetList('refunds_get_for_transfer', $pagination, '\MangoPay\Refund', $transferId, $filter, $sorting); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /MangoPay/ApiVirtualAccounts.php: -------------------------------------------------------------------------------- 1 | CreateObject('virtual_account_create', $virtualAccount, '\MangoPay\VirtualAccount', $walletId, $idempotencyKey); 16 | } 17 | 18 | /** 19 | * @param string $walletId 20 | * @param string $virtualAccountId 21 | * @return \MangoPay\VirtualAccount 22 | */ 23 | public function Get($walletId, $virtualAccountId) 24 | { 25 | return $this->GetObject('virtual_account_get', '\MangoPay\VirtualAccount', $walletId, $virtualAccountId); 26 | } 27 | 28 | /** 29 | * @param \MangoPay\Pagination $pagination Pagination object 30 | * @param string $walletId 31 | * @return \MangoPay\VirtualAccount[] 32 | */ 33 | public function GetAll($walletId, $pagination = null, $sorting = null) 34 | { 35 | return $this->GetList('virtual_account_get_all', $pagination, '\MangoPay\VirtualAccount', $walletId, $sorting); 36 | } 37 | 38 | /** 39 | * @param string $walletId 40 | * @param string $virtualAccountId 41 | * @return \MangoPay\VirtualAccount 42 | */ 43 | public function Deactivate($walletId, $virtualAccountId) 44 | { 45 | $empty_object = new VirtualAccount(); 46 | return $this->SaveObject('virtual_account_deactivate', $empty_object, '\MangoPay\VirtualAccount', $walletId, $virtualAccountId); 47 | } 48 | 49 | /** 50 | * @return \MangoPay\VirtualAccountAvailabilities 51 | */ 52 | public function GetAvailabilities() 53 | { 54 | return $this->GetObject('virtual_account_get_availabilities', '\MangoPay\VirtualAccountAvailabilities'); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /MangoPay/ApiWallets.php: -------------------------------------------------------------------------------- 1 | CreateObject('wallets_create', $wallet, '\MangoPay\Wallet', null, null, $idempotencyKey); 18 | } 19 | 20 | /** 21 | * Get wallet 22 | * @param string $walletId Wallet identifier 23 | * @param string $scaContext Optional. Possible values: USER_NOT_PRESENT, USER_PRESENT 24 | * In case USER_PRESENT is used and SCA is required, an error containing the RedirectUrl will be thrown 25 | * @return \MangoPay\Wallet Wallet object returned from API 26 | */ 27 | public function Get($walletId, $scaContext = null) 28 | { 29 | if ($scaContext != null) { 30 | return $this->GetObject('wallets_get_sca', '\MangoPay\Wallet', $walletId, $scaContext); 31 | } 32 | return $this->GetObject('wallets_get', '\MangoPay\Wallet', $walletId); 33 | } 34 | 35 | /** 36 | * Save wallet 37 | * @param Wallet $wallet Wallet object to save 38 | * @return \MangoPay\Wallet Wallet object returned from API 39 | */ 40 | public function Update($wallet) 41 | { 42 | return $this->SaveObject('wallets_save', $wallet, '\MangoPay\Wallet'); 43 | } 44 | 45 | /** 46 | * Get transactions for the wallet 47 | * @param string $walletId Wallet identifier 48 | * @param \MangoPay\Pagination $pagination Pagination object 49 | * @param \MangoPay\FilterTransactions $filter Object to filter data 50 | * @param \MangoPay\Sorting $sorting Object to sorting data 51 | * @return \MangoPay\Transaction[] Transactions for wallet returned from API 52 | */ 53 | public function GetTransactions($walletId, & $pagination = null, $filter = null, $sorting = null) 54 | { 55 | return $this->GetList('wallets_alltransactions', $pagination, '\MangoPay\Transaction', $walletId, $filter, $sorting); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /MangoPay/Autoloader.php: -------------------------------------------------------------------------------- 1 | [ 66 | '_property_name' => 'Details', 67 | 'IBAN' => '\MangoPay\BankAccountDetailsIBAN', 68 | 'GB' => '\MangoPay\BankAccountDetailsGB', 69 | 'US' => '\MangoPay\BankAccountDetailsUS', 70 | 'CA' => '\MangoPay\BankAccountDetailsCA', 71 | 'OTHER' => '\MangoPay\BankAccountDetailsOTHER', 72 | ] 73 | ]; 74 | } 75 | 76 | /** 77 | * Get array with read-only properties 78 | * @return array 79 | */ 80 | public function GetReadOnlyProperties() 81 | { 82 | $properties = parent::GetReadOnlyProperties(); 83 | array_push($properties, 'UserId'); 84 | array_push($properties, 'Type'); 85 | return $properties; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /MangoPay/BankAccountDetails.php: -------------------------------------------------------------------------------- 1 | BUSINESS_VERIFICATION - Verification of the business entity of a Legal User.
18 | *IDENTITY_DOCUMENT_VERIFICATION - Verification of the identity document of a Natural User or the legal representative of a Legal User.
19 | *PERSONS_SIGNIFICANT_CONTROL - Verification of a person of significant control of a Legal User.
20 | * @var string 21 | */ 22 | public $Type; 23 | 24 | /** 25 | * Returned values: VALIDATED, REFUSED, REVIEW 26 | * @var string 27 | */ 28 | public $CheckStatus; 29 | 30 | /** 31 | * The date and time at which the check was created. 32 | * @var int 33 | */ 34 | public $CreationDate; 35 | 36 | /** 37 | * The date and time at which the check was last updated. 38 | * @var int 39 | */ 40 | public $LastUpdate; 41 | 42 | /** 43 | * The data points collected and verified during the check. 44 | * @var CheckData[] 45 | */ 46 | public $Data; 47 | 48 | /** 49 | * The data points collected and verified during the check. 50 | * @var CheckData[] 51 | */ 52 | public $Reasons; 53 | } 54 | -------------------------------------------------------------------------------- /MangoPay/CheckData.php: -------------------------------------------------------------------------------- 1 | '\MangoPay\CountryAuthorizationData' 42 | ]; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MangoPay/CountryAuthorizationData.php: -------------------------------------------------------------------------------- 1 | The type of the client wallet to be debited: 13 | *FEES – Fees Wallet, for fees collected by the platform.
14 | *CREDIT – Repudiation Wallet, for funds related to dispute management.
15 | *The amount and currency of the debited funds are defined by the quote.
16 | * @var string 17 | */ 18 | public $DebitedWalletType; 19 | 20 | /** 21 | * The sell funds 22 | * @var Money 23 | */ 24 | public $DebitedFunds; 25 | 26 | /** 27 | * Allowed values: FEES, CREDIT 28 | * 29 | *The type of the client wallet to be credited:
30 | *FEES – Fees Wallet, for fees collected by the platform.
31 | *CREDIT – Repudiation Wallet, for funds related to dispute management.
32 | *The amount and currency of the credited funds are defined by the quote.
33 | * @var string 34 | */ 35 | public $CreditedWalletType; 36 | 37 | /** 38 | * The buy funds 39 | * @var Money 40 | */ 41 | public $CreditedFunds; 42 | 43 | /** 44 | * Custom data. 45 | * @var string 46 | */ 47 | public $Tag; 48 | } 49 | -------------------------------------------------------------------------------- /MangoPay/CreateClientWalletsQuotedConversion.php: -------------------------------------------------------------------------------- 1 | The type of the client wallet to be debited: 22 | *FEES – Fees Wallet, for fees collected by the platform.
23 | *CREDIT – Repudiation Wallet, for funds related to dispute management.
24 | *The amount and currency of the debited funds are defined by the quote.
25 | * @var string 26 | */ 27 | public $DebitedWalletType; 28 | 29 | /** 30 | * Allowed values: FEES, CREDIT 31 | * 32 | *The type of the client wallet to be credited:
33 | *FEES – Fees Wallet, for fees collected by the platform.
34 | *CREDIT – Repudiation Wallet, for funds related to dispute management.
35 | *The amount and currency of the credited funds are defined by the quote.
36 | * @var string 37 | */ 38 | public $CreditedWalletType; 39 | 40 | /** 41 | * Custom data. 42 | * @var string 43 | */ 44 | public $Tag; 45 | } 46 | -------------------------------------------------------------------------------- /MangoPay/CreateDeposit.php: -------------------------------------------------------------------------------- 1 | PENDING – The session is available on the HostedUrl, to which the user must be redirected to complete it. 16 | *VALIDATED – The session was successful.
17 | *REFUSED – The session was refused.
18 | *REVIEW – The session is under manual review by Mangopay.
19 | *OUT_OF_DATE – The session is no longer valid (likely due to expired documents used during the session).
20 | *TIMEOUT – The session timed out due to inactivity.
21 | *ERROR – The session was not completed because an error occurred.
22 | * @var string 23 | */ 24 | public $Status; 25 | 26 | /** 27 | * The URL to which the user is returned after the hosted identity verification session, regardless of the outcome. 28 | * @var string 29 | */ 30 | public $ReturnUrl; 31 | 32 | /** 33 | * @var int 34 | */ 35 | public $LastUpdate; 36 | 37 | /** 38 | * @var string 39 | */ 40 | public $UserId; 41 | 42 | /** 43 | * @var Check[] 44 | */ 45 | public $Checks; 46 | } 47 | -------------------------------------------------------------------------------- /MangoPay/IndividualRecipient.php: -------------------------------------------------------------------------------- 1 | IsEmpty($this->FirstName) 55 | && $this->IsEmpty($this->LastName) 56 | && $this->IsEmpty($this->ProofOfIdentity) 57 | && $this->IsEmpty($this->Email) 58 | && $this->IsEmpty($this->Birthday) 59 | && $this->IsEmpty($this->Nationality) 60 | && $this->IsEmpty($this->CountryOfResidence) 61 | && $this->IsEmpty($this->PhoneNumber) 62 | && $this->IsEmpty($this->PhoneNumberCountry); 63 | } 64 | 65 | private function IsEmpty($value) 66 | { 67 | return is_null($value) || empty($value); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /MangoPay/Libraries/ApiOAuth.php: -------------------------------------------------------------------------------- 1 | GetRequestUrl('authentication_oauth'); 17 | $requestType = $this->GetRequestType('authentication_oauth'); 18 | $requestData = [ 19 | 'grant_type' => 'client_credentials' 20 | ]; 21 | 22 | $rest = new RestTool($this->_root, false, false); 23 | $authHlp = new AuthenticationHelper($this->_root); 24 | 25 | $urlDetails = parse_url($this->_root->Config->BaseUrl); 26 | $rest->AddRequestHttpHeader('Host: ' . @$urlDetails['host']); 27 | $rest->AddRequestHttpHeader('Authorization: Basic ' . $authHlp->GetHttpHeaderBasicKey()); 28 | $rest->AddRequestHttpHeader('Content-Type: application/x-www-form-urlencoded'); 29 | if ($this->_root->Config->UKHeaderFlag) { 30 | $rest->AddRequestHttpHeader('x-tenant-id: uk'); 31 | } 32 | $response = $rest->Request($urlMethod, $requestType, $requestData); 33 | $token = $this->CastResponseToEntity($response, '\MangoPay\Libraries\OAuthToken'); 34 | $token->autentication_key = $authHlp->GetAutenticationKey(); 35 | 36 | return $token; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MangoPay/Libraries/AuthorizationTokenManager.php: -------------------------------------------------------------------------------- 1 | _root = $root; 19 | 20 | $this->RegisterCustomStorageStrategy(new DefaultStorageStrategy($this->_root->Config)); 21 | } 22 | 23 | /** 24 | * Gets the current authorization token. 25 | * In the very first call, this method creates a new token before returning. 26 | * If currently stored token is expired, this method creates a new one. 27 | * @return \MangoPay\Libraries\OAuthToken Valid OAuthToken instance. 28 | */ 29 | public function GetToken($autenticationKey) 30 | { 31 | $token = $this->_storageStrategy->Get(); 32 | 33 | if (is_null($token) || false === $token || $token->IsExpired() || $token->GetAutenticationKey() != $autenticationKey) { 34 | $this->StoreToken($this->_root->AuthenticationManager->CreateToken()); 35 | } 36 | 37 | return $this->_storageStrategy->Get(); 38 | } 39 | 40 | /** 41 | * Stores authorization token passed as an argument in the underlying 42 | * storage strategy implementation. 43 | * @param \MangoPay\Libraries\OAuthToken $token Token instance to be stored. 44 | */ 45 | public function StoreToken($token) 46 | { 47 | $this->_storageStrategy->Store($token); 48 | } 49 | 50 | /** 51 | * Registers custom storage strategy implementation. 52 | * By default, the DefaultStorageStrategy instance is used. 53 | * There is no need to explicitly call this method until some more complex 54 | * storage implementation is needed. 55 | * @param \MangoPay\Libraries\IStorageStrategy $customStorageStrategy IStorageStrategy interface implementation. 56 | */ 57 | public function RegisterCustomStorageStrategy($customStorageStrategy) 58 | { 59 | $this->_storageStrategy = $customStorageStrategy; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /MangoPay/Libraries/Configuration.php: -------------------------------------------------------------------------------- 1 | Id = $id; 34 | } 35 | 36 | /** 37 | * Get array with read-only properties 38 | * @return array 39 | */ 40 | public function GetReadOnlyProperties() 41 | { 42 | return [ 'Id', 'CreationDate' ]; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /MangoPay/Libraries/Error.php: -------------------------------------------------------------------------------- 1 | Errors); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /MangoPay/Libraries/Exception.php: -------------------------------------------------------------------------------- 1 | _root = $root; 29 | $this->logger = $root->getLogger(); 30 | } 31 | 32 | 33 | /** 34 | * @param RestTool $restTool 35 | * 36 | * @return HttpResponse 37 | */ 38 | abstract public function Request(RestTool $restTool); 39 | } 40 | -------------------------------------------------------------------------------- /MangoPay/Libraries/HttpResponse.php: -------------------------------------------------------------------------------- 1 | '; 13 | print $message . ': '; 14 | print_r($data); 15 | print 'Default value: WEB
25 | *The platform environment of the post-payment flow. The PaymentFlow value combines with the ReturnURL to manage the redirection behavior after payment:
26 | *Set the value to APP to send the user to your platform’s mobile app
27 | *Set the value to WEB to send the user to a web browser
28 | *In both cases you need to provide the relevant ReturnURL, whether to your app or website.
29 | * @var string 30 | */ 31 | public $PaymentFlow; 32 | 33 | /** 34 | * Custom description to show on the user's bank statement. 35 | * It can be up to 10 char alphanumeric and space. 36 | * @var string 37 | */ 38 | public $StatementDescriptor; 39 | } 40 | -------------------------------------------------------------------------------- /MangoPay/PayInPaymentDetailsTwint.php: -------------------------------------------------------------------------------- 1 | [ 37 | '_property_name' => 'MeanOfPaymentDetails', 38 | PayOutPaymentType::BankWire => '\MangoPay\PayOutPaymentDetailsBankWire', 39 | // ...and more in future... 40 | ] 41 | ]; 42 | } 43 | 44 | /** 45 | * Get array with read-only properties 46 | * @return array 47 | */ 48 | public function GetReadOnlyProperties() 49 | { 50 | $properties = parent::GetReadOnlyProperties(); 51 | array_push($properties, 'PaymentType'); 52 | 53 | return $properties; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /MangoPay/PayOutEligibilityRequest.php: -------------------------------------------------------------------------------- 1 | 12 | * Caution: Before redirecting the user on this URL, you must add the query parameter ReturnUrl with the percent-encoded URL to which you want the SCA session to return the user after authentication (whether successful or not). 13 | *
14 | * For more details, see How to redirect a user for an SCA session
15 | * @var string
16 | */
17 | public $RedirectUrl;
18 | }
19 |
--------------------------------------------------------------------------------
/MangoPay/PersonType.php:
--------------------------------------------------------------------------------
1 | >
44 | */
45 | public $LocalBankTransfer;
46 |
47 | /**
48 | * @var array