Skip to content

Commit

Permalink
Fix possible warning when removing user
Browse files Browse the repository at this point in the history
The warning was caused by missing payment metadata
which is only stored for successful payments. Fail
payments triggered the warning.

remp/crm#3230
  • Loading branch information
rootpd committed Jun 24, 2024
1 parent ce6ca5c commit 91fc8e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Models/User/AppleAppstoreUserDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ public function delete($userId, $protectedData = [])
AppleAppstoreModule::META_KEY_CANCELLATION_DATE,
AppleAppstoreModule::META_KEY_CANCELLATION_REASON,
];
$userPayments = $this->paymentsRepository->userPayments($userId);
$userPayments = $this->paymentsRepository->userPayments($userId)
->where([
'status' => PaymentsRepository::STATUS_PREPAID,
'payment_gateway.code' => AppleAppstoreGateway::GATEWAY_CODE,
]);

if ($userPayments) {
foreach ($userPayments as $userPayment) {
foreach ($metaKeys as $key => $value) {
Expand Down

0 comments on commit 91fc8e4

Please sign in to comment.