Skip to content

Commit

Permalink
Reduce number of log entries made by check_paytrail_response method. …
Browse files Browse the repository at this point in the history
…Fixes issue #102
  • Loading branch information
chrisgan committed Jan 8, 2024
1 parent 7078599 commit cf6cc43
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,21 @@ public function check_paytrail_response() {
$order_id = filter_input(INPUT_GET, 'order_id');
$reference = filter_input(INPUT_GET, 'checkout-reference');

if (!$reference && !$refund_callback && !$refund_unique_id) {
$this->log('Paytrail: check_paytrail_response, no reference found for reference: ' . $reference, 'debug');
if(!$status && !$reference && !$refund_callback && !$refund_unique_id){
//no log to reduce number of log entries
return;
}

if (!$reference && $status && !$refund_callback && !$refund_unique_id) {
$this->log('Paytrail: check_paytrail_response, no reference found for status: ' . $status, 'debug');
return;
}
if (!$status && !$refund_callback && !$refund_unique_id) {
$this->log('Paytrail: check_paytrail_response, no status found. ' . $reference, 'debug');

if (!$status && $reference && !$refund_callback && !$refund_unique_id) {
$this->log('Paytrail: check_paytrail_response, no status found for reference ' . $reference, 'debug');
return;
}

$sleepTime = rand(0, 3);
$sleepTimeCallback = rand(3, 6);

Expand Down Expand Up @@ -936,7 +943,7 @@ public function process_payment( $order_id) {
} else {
$this->log('Paytrail: Token value: ' . print_r($token, true), 'debug');
}

} else {
$this->log('Paytrail: init PaymentRequest', 'debug');
$payment = new PaymentRequest();
Expand Down

0 comments on commit cf6cc43

Please sign in to comment.