<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Paycenter_lib
{
    protected $ci;
    protected $key = '7a46484300f04031b42fdd44559578e4';
    protected $domain = 'https://secure.chinahighlights.com/pay/paymentservice/?';
    // https://secure.chinahighlights.com/pay/paymentservice/?b3JkZXJfaWQ9MTUwNDE0NzIwM19UJnN1YmplY3Q9MTUwNDE0NzIwM19UJnRvdGFsX2Ftb3VudD0xNTAmY3VycmVuY3k9U0dEJmxnPWVuX1VTJnJtYl9hbW91bnQ9NzM2LjUmd3hfYWNjb3VudD1jaHQmc2lnbj04RUI5RTJFOTAyNUM0Mzg1MEYxQzU1ODk1Q0ZBRTA5QiZib2R5PVRyYWNraW5nIENvZGU6DQpUcmF2ZWwgQWR2aXNvcjoNCkNvbnRlbnQ6

    public function __construct()
    {
        $this->ci =& get_instance();
    }

    public function create($arr)
    {
        $arr['sign'] = $this->make_sign($arr);
        $query_str = http_build_query($arr);
        return $this->domain . base64_encode($query_str);
    }

    private function make_sign($arr)
    {
        $raw = "currency=" . strtoupper($arr['currency']);
        $raw .= "&order_id=" . $arr['order_id'];
        $raw .= "&rmb_amount=" . $arr['rmb_amount'];
        $raw .= "&total_amount=" . $arr['total_amount'];
        $raw .= "&key=" . $this->key;
        $sign = md5($raw);
        return $sign;
    }



}

/* End of file Paycenter.php */
