Skip to content
Snippets Groups Projects
Commit edeb605a authored by mattwire's avatar mattwire
Browse files

Support limit/offset for StripeCustomer.updatestripemetadata

parent 8a06d51e
No related branches found
Tags 5.3.2
1 merge request!23Bugfixes - detect webform correctly, fix stripe customer creation in test mode
......@@ -62,16 +62,24 @@ class CRM_Stripe_Customer {
*
* @return array|null
*/
public static function getAll($isLive, $processorId) {
public static function getAll($isLive, $processorId, $options = []) {
$queryParams = [
1 => [$isLive ? 1 : 0, 'Boolean'],
2 => [$processorId, 'Integer'],
];
$limitClause = '';
if ($limit = CRM_Utils_Array::value('limit', $options)) {
$limitClause = "LIMIT $limit";
if ($offset = CRM_Utils_Array::value('offset', $options)) {
$limitClause .= " OFFSET $offset";
}
}
$customerIds = [];
$dao = CRM_Core_DAO::executeQuery("SELECT id
FROM civicrm_stripe_customers
WHERE is_live = %1 AND processor_id = %2", $queryParams);
WHERE is_live = %1 AND processor_id = %2 {$limitClause}", $queryParams);
while ($dao->fetch()) {
$customerIds[] = $dao->id;
}
......
......@@ -225,7 +225,7 @@ function civicrm_api3_stripe_customer_updatestripemetadata($params) {
if (!isset($params['is_live']) || !isset($params['processor_id'])) {
throw new CiviCRM_API3_Exception('Missing required parameters is_live and/or processor_id when using without a customer id');
}
$customerIds = CRM_Stripe_Customer::getAll($params['is_live'], $params['processor_id']);
$customerIds = CRM_Stripe_Customer::getAll($params['is_live'], $params['processor_id'], $params['options']);
}
else {
$customerIds = [$params['id']];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment