Skip to content

Commit

Permalink
Merge pull request #842 from stripe/ob-order-nested-resource-methods
Browse files Browse the repository at this point in the history
Reorder methods for nested resources
  • Loading branch information
ob-stripe authored Jan 29, 2020
2 parents 5ca8c27 + ba10810 commit 6a58162
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 132 deletions.
89 changes: 44 additions & 45 deletions lib/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ public function deauthorize($clientId = null, $opts = null)
* capabilities property which is a hash and not the sub-list of capabilities.
*/

/**
* @param string $id The ID of the account on which to retrieve the capabilities.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection The list of capabilities.
*/
public static function allCapabilities($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts);
}

/**
* @param string $id The ID of the account to which the capability belongs.
Expand Down Expand Up @@ -188,17 +201,17 @@ public static function updateCapability($id, $capabilityId, $params = null, $opt
}

/**
* @param string $id The ID of the account on which to retrieve the capabilities.
* @param string $id The ID of the account on which to retrieve the external accounts.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection The list of capabilities.
* @return \Stripe\Collection The list of external accounts (BankAccount or Card).
*/
public static function allCapabilities($id, $params = null, $opts = null)
public static function allExternalAccounts($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts);
return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
}

/**
Expand All @@ -217,61 +230,47 @@ public static function createExternalAccount($id, $params = null, $opts = null)

/**
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to retrieve.
* @param string $externalAccountId The ID of the external account to delete.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BankAccount|\Stripe\Card
*/
public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null)
public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}

/**
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to update.
* @param string $externalAccountId The ID of the external account to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BankAccount|\Stripe\Card
*/
public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null)
public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}

/**
* @param string $id The ID of the account to which the external account belongs.
* @param string $externalAccountId The ID of the external account to delete.
* @param string $externalAccountId The ID of the external account to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\BankAccount|\Stripe\Card
*/
public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}

/**
* @param string $id The ID of the account on which to retrieve the external accounts.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection The list of external accounts (BankAccount or Card).
*/
public static function allExternalAccounts($id, $params = null, $opts = null)
public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts);
return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts);
}

/**
Expand Down Expand Up @@ -306,76 +305,76 @@ public function persons($params = null, $opts = null)
}

/**
* @param string $id The ID of the account on which to create the person.
* @param string $id The ID of the account on which to retrieve the persons.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
* @return \Stripe\Collection The list of persons.
*/
public static function createPerson($id, $params = null, $opts = null)
public static function allPersons($id, $params = null, $opts = null)
{
return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
}

/**
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to retrieve.
* @param string $id The ID of the account on which to create the person.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
*/
public static function retrievePerson($id, $personId, $params = null, $opts = null)
public static function createPerson($id, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts);
}

/**
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to update.
* @param string $personId The ID of the person to delete.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
*/
public static function updatePerson($id, $personId, $params = null, $opts = null)
public static function deletePerson($id, $personId, $params = null, $opts = null)
{
return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}

/**
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to delete.
* @param string $personId The ID of the person to retrieve.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Person
*/
public static function deletePerson($id, $personId, $params = null, $opts = null)
public static function retrievePerson($id, $personId, $params = null, $opts = null)
{
return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}

/**
* @param string $id The ID of the account on which to retrieve the persons.
* @param string $id The ID of the account to which the person belongs.
* @param string $personId The ID of the person to update.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection The list of persons.
* @return \Stripe\Person
*/
public static function allPersons($id, $params = null, $opts = null)
public static function updatePerson($id, $personId, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts);
return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts);
}

public function serializeParameters($force = false)
Expand Down
28 changes: 14 additions & 14 deletions lib/ApplicationFee.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ class ApplicationFee extends ApiResource

const PATH_REFUNDS = '/refunds';

/**
* @param string $id The ID of the application fee on which to retrieve the fee refunds.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection The list of fee refunds.
*/
public static function allRefunds($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts);
}

/**
* @param string $id The ID of the application fee on which to create the fee refund.
* @param array|null $params
Expand Down Expand Up @@ -75,18 +89,4 @@ public static function updateRefund($id, $refundId, $params = null, $opts = null
{
return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
}

/**
* @param string $id The ID of the application fee on which to retrieve the fee refunds.
* @param array|null $params
* @param array|string|null $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection The list of fee refunds.
*/
public static function allRefunds($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts);
}
}
Loading

0 comments on commit 6a58162

Please sign in to comment.