/var/www/hkosl.com/littleark/webadmin/models/FinpayVirtualAccout.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
<?php
/**
 * Finnet Finpay Virtual Account (same notification as Finpay Code)
 * Refer to: Dokumen Integrasi.pdf
 * @author Garrick Lam
 */

class FinpayVirtualAccount extends FinpayCode
{
    protected 
$payment_method         'FINPAY_VA';
    protected 
$gateway_url_sandbox    "https://fat.finnet.co.id/response-insert.php";
    protected 
$gateway_url_production "https://fat.finnet.co.id/response-insert.php";

    protected 
$trax_type = [
        
// 'PAYMENT_CODE_195'   => "195code",
        // 'PAYMENT_CODE_20111' => "02111code",
        // 'VA_PERMATA_NET' => "vaPERMATACode",
        
'VA_PERMATA' => "vaPERMATACode",
        
'VA_MANDIRI' => "vaMANDIRICode",
        
'VA_BNI'     => "vaBNICode",
        
'VA_BRI'     => "vaBRICode",
        
'VA_BCA'     => "vaBCACode",
    ];

    public function 
paymentParam($payment_method='')
    {
        global 
$site_info;

        
$endpoint $this->gateway_url;

        
$args = [
            
'trax_type'   => $this->trax_type[$payment_method],
            
'merchant_id' => $this->merchant_id,
            
'invoice'     => $this->invoice->code,
            
'amount'      => get_currency_price($this->invoice->amountnull$this->payment_currency3),
            
'add_info1'   => $args['add_info1'] ?: "Silkroad ebelt",
            
'add_info2'   => $args['add_info2'] ?: "",
            
'add_info3'   => $args['add_info3'] ?: "",
            
'add_info4'   => $args['add_info4'] ?: "",
            
'add_info5'   => $args['add_info5'] ?: "",
            
'timeout'     => $this->timeout,
            
'return_url'  => "{$site_info['url']}/finpay/api.php?payment_method={$this->payment_method}",
        ];

        
$args array_merge($args$this->generateCustomizedData($payment_type));
        
$args array_merge($args$this->generateSignature($args));

        
ApiLog::create([
            
'type'     => get_class($this),
            
'endpoint' => $endpoint,
            
'request'  => $args,
        ]);

        return [
            
"endpoint" => $endpoint,
            
"method"   => "POST",
            
"args"     => $args,
        ];
    }
}