Skip to content

Commit

Permalink
Log debug info when IP is missing from CSOB payload
Browse files Browse the repository at this point in the history
Initial payment exists and has IP address linked. Trying to find out why
it's not used.

remp/crm#2990
  • Loading branch information
markoph committed Oct 2, 2023
1 parent 635bca8 commit 8eccdb0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Models/Gateway/CsobOneClick.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ public function charge($payment, $token): string
$oneClickPaymentRequest['clientIp'] = $initialPaymentMeta->payment->ip;
}

// temp debug; remp/crm#2990
if ($oneClickPaymentRequest['clientIp'] === 'cli') {
$metaData = [];
if ($initialPaymentMeta === null) {
$metaData['error'] = "Unable to find payment meta for token [{$token}]";
} else {
$metaData['initial_payment_id'] = $initialPaymentMeta->payment_id;
$metaData['initial_client_ip'] = $initialPaymentMeta->payment->ip;
$metaData['initial_payment_data'] = $initialPaymentMeta->payment->toArray();
}
$dmd = print_r($metaData, true);
Debugger::log("CSOB One Click: clientIp cannot be 'cli'. PayId: [{$token}]. Initial payment: [{$dmd}]", Debugger::ERROR);
}

if (!empty($payment->user->last_name)) {
$oneClickPaymentRequest['name'] = $this->getUserName($payment->user);
}
Expand Down

0 comments on commit 8eccdb0

Please sign in to comment.