Skip to content

Commit a31c1eb

Browse files
iulian03Iulian Masar
andauthored
[release] 3.39.0 (#698)
* [feature] added country property to recipients (#696) * added country property to recipients * run linter --------- Co-authored-by: Iulian Masar <iulian.masar@codegile.com> * handle get all deposits by user or card (#694) Co-authored-by: Iulian Masar <iulian.masar@codegile.com> * identity verification updates (#693) - removed get checks endpoint - handle get all endpoint - updated tests - updated event types Co-authored-by: Iulian Masar <iulian.masar@codegile.com> * reverted TestKycPageFile.png --------- Co-authored-by: Iulian Masar <iulian.masar@codegile.com>
1 parent ccdbe6b commit a31c1eb

16 files changed

+156
-68
lines changed

MangoPay/ApiDeposits.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,30 @@ public function Cancel($depositId, CancelDeposit $dto)
3737
{
3838
return $this->SaveObject('deposits_cancel', $dto, '\MangoPay\Deposit', $depositId);
3939
}
40+
41+
/**
42+
* Get all deposits for a user
43+
* @param string $userId User identifier
44+
* @param Pagination $pagination Pagination object
45+
* @param FilterPreAuthorizations $filter Filtering object
46+
* @param Sorting $sorting Sorting object
47+
* @return Deposit[] Deposit list returned from API
48+
*/
49+
public function GetAllForUser($userId, $pagination = null, $filter = null, $sorting = null)
50+
{
51+
return $this->GetList('deposits_get_all_for_user', $pagination, '\MangoPay\Deposit', $userId, $filter, $sorting);
52+
}
53+
54+
/**
55+
* Get all deposits for a user
56+
* @param string $cardId Card identifier
57+
* @param Pagination $pagination Pagination object
58+
* @param FilterPreAuthorizations $filter Filtering object
59+
* @param Sorting $sorting Sorting object
60+
* @return Deposit[] Deposit list returned from API
61+
*/
62+
public function GetAllForCard($cardId, $pagination = null, $filter = null, $sorting = null)
63+
{
64+
return $this->GetList('deposits_get_all_for_card', $pagination, '\MangoPay\Deposit', $cardId, $filter, $sorting);
65+
}
4066
}

MangoPay/ApiIdentityVerification.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public function Get($id)
2828
}
2929

3030
/**
31-
* Get IdentityVerificationCheck
32-
* @param string $id IdentityVerification identifier
33-
* @return \MangoPay\IdentityVerificationCheck IdentityVerificationCheck object returned from API
31+
* Get all IdentityVerifications for a user
32+
* @param string $userId User identifier
33+
* @return \MangoPay\IdentityVerification[] IdentityVerification list returned from API
3434
*/
35-
public function GetChecks($id)
35+
public function GetAll($userId, $pagination = null, $filter = null, $sorting = null)
3636
{
37-
return $this->GetObject('identity_verification_checks_get', '\MangoPay\IdentityVerificationCheck', $id);
37+
return $this->GetList('identity_verification_get_all', $pagination, '\MangoPay\IdentityVerification', $userId, $filter, $sorting);
3838
}
3939
}

MangoPay/ApiRecipients.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,20 @@ public function GetPayoutMethods($country, $currency)
6060
* @param string $payoutMethodType Defines the payout method (e.g., LocalBankTransfer, InternationalBankTransfer).
6161
* @param string $recipientType Specifies whether the recipient is an Individual or a Business.
6262
* @param string $currency 3-letter ISO 4217 destination currency code (e.g. EUR, USD, GBP, AUD, CAD,HKD, SGD, MXN).
63+
* @param string $country Country ISO
6364
* @return RecipientSchema
6465
* @throws Exception
6566
*/
66-
public function GetSchema($payoutMethodType, $recipientType, $currency)
67+
public function GetSchema($payoutMethodType, $recipientType, $currency, $country)
6768
{
68-
return $this->GetObject('recipients_get_schema', '\MangoPay\RecipientSchema', $payoutMethodType, $recipientType, $currency);
69+
return $this->GetObjectManyQueryParams(
70+
'recipients_get_schema',
71+
'\MangoPay\RecipientSchema',
72+
$payoutMethodType,
73+
$recipientType,
74+
$currency,
75+
$country
76+
);
6977
}
7078

7179
/**

MangoPay/CardPreAuthorizationPaymentStatus.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ class CardPreAuthorizationPaymentStatus
1111
const Expired = 'EXPIRED';
1212
const Validated = 'VALIDATED';
1313
const Waiting = 'WAITING';
14+
const CancelRequested = 'CANCEL_REQUESTED';
15+
const ToBeCompleted = 'TO_BE_COMPLETED';
16+
const NoShowRequested = 'NO_SHOW_REQUESTED';
17+
const NoShow = 'NO_SHOW';
18+
const Failed = 'FAILED';
1419
}

MangoPay/Check.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,10 @@ class Check extends Dto
4444
* @var CheckData[]
4545
*/
4646
public $Data;
47+
48+
/**
49+
* The data points collected and verified during the check.
50+
* @var CheckData[]
51+
*/
52+
public $Reasons;
4753
}

MangoPay/CheckData.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class CheckData extends Dto
88
{
99
/**
1010
* The type of the data point.
11-
* For more details, <a href="https://mangopay-idv.mintlify.app/guides/users/verification/hosted?_gl=1*1unwn0t*_up*MQ..*_ga*ODg5MjI4ODQzLjE3Mzg5MjY2NjE.*_ga_VZLQHP6CFB*MTczODkyNjY2MC4xLjAuMTczODkyNjY2MC4wLjAuMA..#verified-data-returned">see the Verified data returned.</a>
1211
* @var string
1312
*/
1413
public $Type;

MangoPay/EventType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ class EventType
9696
const IdentityVerificationInconclusive = "IDENTITY_VERIFICATION_INCONCLUSIVE";
9797
const IdentityVerificationOutdated = "IDENTITY_VERIFICATION_OUTDATED";
9898
const IdentityVerificationTimeout = "IDENTITY_VERIFICATION_TIMEOUT";
99+
const IdentityVerificationPending = "IDENTITY_VERIFICATION_PENDING";
100+
99101
const RecipientActive = "RECIPIENT_ACTIVE";
100102
const RecipientCanceled = "RECIPIENT_CANCELED";
101103
const RecipientDeactivated = "RECIPIENT_DEACTIVATED";

MangoPay/IdentityVerification.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,19 @@ class IdentityVerification extends Libraries\EntityBase
2828
* @var string
2929
*/
3030
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;
3146
}

MangoPay/IdentityVerificationCheck.php

Lines changed: 0 additions & 45 deletions
This file was deleted.

MangoPay/Libraries/ApiBase.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ protected function getLogger()
244244
'deposits_create' => ['/deposit-preauthorizations/card/direct', RequestType::POST],
245245
'deposits_get' => ['/deposit-preauthorizations/%s', RequestType::GET],
246246
'deposits_cancel' => ['/deposit-preauthorizations/%s', RequestType::PUT],
247+
'deposits_get_all_for_user' => ['/users/%s/deposit-preauthorizations', RequestType::GET],
248+
'deposits_get_all_for_card' => ['/cards/%s/deposit-preauthorizations', RequestType::GET],
247249

248250
'get_conversion_rate' => ['/conversions/rate/%s/%s', RequestType::GET],
249251
'create_client_wallets_instant_conversion' => ['/clients/conversions/instant-conversion', RequestType::POST],
@@ -262,13 +264,13 @@ protected function getLogger()
262264

263265
'identity_verification_create' => ['/users/%s/identity-verifications', RequestType::POST],
264266
'identity_verification_get' => ['/identity-verifications/%s', RequestType::GET],
265-
'identity_verification_checks_get' => ['/identity-verifications/%s/checks', RequestType::GET],
267+
'identity_verification_get_all' => ['/users/%s/identity-verifications', RequestType::GET],
266268

267269
'recipients_create' => ['/users/%s/recipients', RequestType::POST],
268270
'recipients_get' => ['/recipients/%s', RequestType::GET],
269271
'recipients_get_all' => ['/users/%s/recipients', RequestType::GET],
270272
'recipients_get_payout_methods' => ['/recipients/payout-methods?country=%s&currency=%s', RequestType::GET],
271-
'recipients_get_schema' => ['/recipients/schema?payoutMethodType=%s&recipientType=%s&currency=%s', RequestType::GET],
273+
'recipients_get_schema' => ['/recipients/schema?payoutMethodType=%s&recipientType=%s&currency=%s&country=%s', RequestType::GET],
272274
'recipients_validate' => ['/users/%s/recipients/validate', RequestType::POST],
273275
'recipients_deactivate' => ['/recipients/%s', RequestType::PUT]
274276
];
@@ -366,6 +368,25 @@ protected function GetObject($methodKey, $responseClassName, $firstEntityId = nu
366368
return $response;
367369
}
368370

371+
/**
372+
* Get entity object from API endpoint that has a lot of query params
373+
* @param string $methodKey Key with request data
374+
* @param object $responseClassName Name of entity class from response
375+
* @return object Response data
376+
* @throws Exception
377+
*/
378+
protected function GetObjectManyQueryParams($methodKey, $responseClassName, ...$queryParams)
379+
{
380+
$urlMethod = sprintf($this->GetRequestUrl($methodKey), ...$queryParams);
381+
$rest = new RestTool($this->_root, true, true);
382+
$response = $rest->Request($urlMethod, $this->GetRequestType($methodKey));
383+
384+
if (!is_null($responseClassName)) {
385+
return $this->CastResponseToEntity($response, $responseClassName);
386+
}
387+
return $response;
388+
}
389+
369390
/**
370391
* Get lst with entities object from API
371392
* @param string $methodKey Key with request data

0 commit comments

Comments
 (0)