· 5 years ago · Aug 31, 2020, 04:04 AM
1 public function actionEcoll()
2 {
3 $method = new ChosePay();
4 $getConfig = $method->getPositions();
5
6 foreach($getConfig as $row){
7 $result = json_decode($row['config'], true);
8 }
9
10 $partnerDec = base64_decode($_GET['partner']);
11 $home = '/?partner='.$_GET['partner'];
12 $secret = $result['secret'];
13 $cid = $result['cid'];
14 $url = $result['link'];
15 $explode = explode(":",$partnerDec);
16 $pid = $explode[0];
17 $key = $explode[1];
18
19 $customerPayment = CustomerPayment::find()
20 ->where(['transaction_id' => $_GET['id']])
21 ->one();
22
23 $customer = Customer::find()
24 ->where(['customer_prime_id' => $customerPayment['customer_prime_id']])
25 ->one();
26
27 $product = Product::find()
28 ->where(['product_id' => $customerPayment['product_id']])
29 ->one();
30
31 $dataplan ='';
32 if($customerPayment['product_plan_year'] == 0 ){
33 $dataplan.= "";
34 }else{
35 $dataplan.= $customerPayment->product_plan_year.' Tahun';
36 }
37 if($customerPayment['product_plan_month'] == 0 ){
38 $dataplan.= "";
39 }else{
40 $dataplan.= $customerPayment->product_plan_month.' Bulan';
41 }
42 if($customerPayment['product_plan_day'] == 0 ){
43 $dataplan.= "";
44 }else{
45 $dataplan.= $customerPayment->product_plan_day.' Hari';
46 }
47
48 $cid = "70119";
49 $prefix = "988";
50 $secret_key = "3a51914bdf896e4294e9992c686b84b4";
51
52 $dataCreate = array(
53 "type" => "createbilling",
54 "trx_id" => $customerPayment['transaction_id'],
55 "client_id" => $cid,
56 "trx_amount" => intval($customerPayment['product_price']),
57 "billing_type" => "c",
58 "customer_name" => $customer['fullname'],
59 "datetime_expired" => date('c', strtotime('+13 hour', strtotime(date('Y-m-d H:i:s'))))
60 );
61
62 $hashed_string = BniEnc::encrypt($dataCreate,$cid,$secret_key);
63
64 $request = array(
65 'client_id' => $cid,
66 'data' => $hashed_string,
67 'prefix' => $prefix
68 );
69
70 $response = BniEnc::get_content($url, json_encode($request));
71 $response_json = json_decode($response, true);
72