Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Webkul\Admin\Listeners; use Webkul\Admin\Mail\Order\RefundedNotification..
Decoded Output download
<?php
namespace Webkul\Admin\Listeners;
use Webkul\Admin\Mail\Order\RefundedNotification;
use Webkul\Paypal\Payment\SmartButton;
class Refund extends Base
{
/**
* After order is created
*
* @param \Webkul\Sales\Contracts\Refund $refund
* @return void
*/
public function afterCreated($refund)
{
$this->refundOrder($refund);
try {
if (! core()->getConfigData('emails.general.notifications.emails.general.notifications.new_refund')) {
return;
}
$this->prepareMail($refund, new RefundedNotification($refund));
} catch (\Exception $e) {
report($e);
}
}
/**
* After Refund is created
*
* @param \Webkul\Sales\Contracts\Refund $refund
* @return void
*/
public function refundOrder($refund)
{
$order = $refund->order;
if ($order->payment->method === 'paypal_smart_button') {
/* getting smart button instance */
$smartButton = new SmartButton;
/* getting paypal oder id */
$paypalOrderID = $order->payment->additional['orderID'];
/* getting capture id by paypal order id */
$captureID = $smartButton->getCaptureId($paypalOrderID);
/* now refunding order on the basis of capture id and refund data */
$smartButton->refundOrder($captureID, [
'amount' => [
'value' => round($refund->grand_total, 2),
'currency_code' => $refund->order_currency_code,
],
]);
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Webkul\Admin\Listeners;
use Webkul\Admin\Mail\Order\RefundedNotification;
use Webkul\Paypal\Payment\SmartButton;
class Refund extends Base
{
/**
* After order is created
*
* @param \Webkul\Sales\Contracts\Refund $refund
* @return void
*/
public function afterCreated($refund)
{
$this->refundOrder($refund);
try {
if (! core()->getConfigData('emails.general.notifications.emails.general.notifications.new_refund')) {
return;
}
$this->prepareMail($refund, new RefundedNotification($refund));
} catch (\Exception $e) {
report($e);
}
}
/**
* After Refund is created
*
* @param \Webkul\Sales\Contracts\Refund $refund
* @return void
*/
public function refundOrder($refund)
{
$order = $refund->order;
if ($order->payment->method === 'paypal_smart_button') {
/* getting smart button instance */
$smartButton = new SmartButton;
/* getting paypal oder id */
$paypalOrderID = $order->payment->additional['orderID'];
/* getting capture id by paypal order id */
$captureID = $smartButton->getCaptureId($paypalOrderID);
/* now refunding order on the basis of capture id and refund data */
$smartButton->refundOrder($captureID, [
'amount' => [
'value' => round($refund->grand_total, 2),
'currency_code' => $refund->order_currency_code,
],
]);
}
}
}
Function Calls
None |
Stats
MD5 | 620832a35d3b4c2310262070275731d1 |
Eval Count | 0 |
Decode Time | 114 ms |