/var/www/hkosl.com/littleark/webadmin/models/PaymentRefund.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php

class PaymentRefund extends BaseModel
{
    protected 
$table "payment_refund";

    public function 
paymenRecord()
    {
        return 
$this->belongsTo('PaymentRecord''v_oid''code');
    }

    public function 
currency()
    {
        return 
$this->belongsTo('Currency''currency_code''iso_code');
    }

    
// public function process($value='')
    // {
    //     switch ($this->paymenRecord->payment_type) {
    //         case 'PAYEASE':
    //             # code...
    //             break;

    //         case 'PAYEASE_DOKU':
    //             # code...
    //             break;

    //         case 'TRUSTPAY':
    //             # code...
    //             break;

    //         default:
    //             throw new Exception("Unable to refund: type={$this->payment_type}", 1);
    //             break;
    //     }
    // }


    
public function sendEmailCustomer()
    {
        
vdump($this->order->customer_id); exit;
        
// do something after payment refund
        // email to seller
        // email to customer
        
$order_info get_order($refund_info["customser_id"], $refund_info["order_id"]);
        
$langcode   $order_info["langcode"];

        
$x_mail = new PHPMailer();
        
// default values
        
$x_mail->IsSMTP();
        
$x_mail->IsHTML(true);
        
// $x_mail->SMTPDebug     = 1;
        // $x_mail->SMTPDebug  = true;
        
$x_mail->Host       MasterSetting::get('SMTP_HOST') ?: $x_mail->Host;
        
$x_mail->Port       MasterSetting::get('SMTP_PORT') ?: $x_mail->Port;
        
$x_mail->SMTPAuth   MasterSetting::get('SMTP_SMTPAUTH') ? true false;
        
$x_mail->Username   MasterSetting::get('SMTP_USERNAME');
        
$x_mail->Password   MasterSetting::get('SMTP_PASSWORD');
        
$x_mail->SMTPSecure MasterSetting::get('SMTP_SMTPSECURE') ?: $x_mail->SMTPSecure;
        
$x_mail->CharSet    "UTF-8";
        
$x_mail->WordWrap   50;
        
$x_mail->Sender     MasterSetting::get('PLATFORM_ORDER_EMAIL');
        
$x_mail->From       MasterSetting::get('PLATFORM_ORDER_EMAIL');
        
$x_mail->FromName   $site_info{"companyname_" $langcode};
        
$x_mail->Subject    $site_info{"companyname_" $langcode} . " " $this->code;
        
//send to user not send to client
        
$x_mail->AddAddress($enquiryemail$company_name);
        
// $x_mail->AddAddress($customer_info->email, $customer_info->fullname());

        
ob_start();
        require 
__DIR__ '/../resources/refund_customer.php';
        
$x_mail->Body ob_get_contents();
        
ob_end_clean();
echo 
$x_mail->Body; exit;
        if (
$x_mail->Send()) {
            echo 
"<script>alert('" lang("Refund email sends out successfully.") . "'); window.location.href='refund_modifyform.php?id=" $id "';</script>";
            exit;
        } else {
            echo 
"<script>alert('" lang("Refund email cannot send out.") . "'); window.location.href='refund_modifyform.php?id=" $id "';</script>";
            exit;
        }
    }
}