Jump to content

eldzee

Members
  • Posts

    11
  • Joined

Posts posted by eldzee

  1. Hi guys,

    I'm trying to build a custom merchant payment gateway with custom CC form (so I can inject custom js from the merchant page to handle 3DS stuff)

    seems like blesta doesn't pass information about the card to the buildCcForm function thus it is unable to pre-fill the data when client want to edit the card (using custom form)

    is there a better way to be able to grab that particular card data to prefill the custom form?

     

    right now my solution was to edit a few stuffs in: (passing $vars to the function)

    /components/gateway_payments/gateway_payments.php ::
    	public function getBuildCcForm($currency, $vars = null) {
            $html = '';
            $gateway = $this->GatewayManager->getInstalledMerchant($this->company_id, $currency);
    
            $errors = null;
            if ($gateway) {
                // Initialize the gateway
                $gateway_obj = $this->initGateway($gateway, $currency);
    
                if ($gateway_obj instanceof MerchantCcForm) {
                    //Check how if buildCCForm function accept parameter or not
                    $method = new ReflectionMethod($gateway_obj, 'buildCCForm');
                    $numParam = $method->getNumberOfParameters();
    				
    				//Pass param $vars to the function if it accept parameter
                    $html = $numParam ? $gateway_obj->buildCcForm($vars) : $gateway_obj->buildCcForm();
                    $errors = $gateway_obj->errors();
                }
            }
    
            if ($errors) {
                $this->Input->setErrors($errors);
            }
    
            return $html;
        }
    /app/models/payment.php ::
    	public function getBuildCcForm($currency, $vars = null)
        {
            $result = $this->GatewayPayments->getBuildCcForm($currency, $vars);
    		...
    /plugins/order/controllers/checkout.php ::
    	private function setCcView(stdClass $vars, $edit = false, $save_account = false)
        {
            $this->uses(['Payments']);
    
            // Fetch the cc form to be used with this company and currency
            $gateway_form = $this->Payments->getBuildCcForm(isset($this->client)
                ? $this->client->settings['default_currency']
                : null
                , $vars
            );
    		...
    /app/controllers/client_pay.php ::
    	private function setCcView(stdClass $vars, $edit = false, $save_account = false)
        {
            $this->uses(['Payments']);
    
            // Fetch the cc form to be used with this company and currency
            $gateway_form = $this->Payments->getBuildCcForm($this->client->settings['default_currency'], $vars);
    		...
    /app/controllers/client_account.php ::
    	private function getCcView(stdClass $vars, $edit = false, $save_account = false)
        {
            $this->uses(['Payments']);
    
            // Fetch the cc form to be used with this company and currency
            $gateway_form = $this->Payments->getBuildCcForm($this->client->settings['default_currency'], $vars);
    		...
    /app/controllers/admin_clients.php ::
    	private function setCcView(stdClass $vars, stdClass $client, $edit = false, $save_account = false)
        {
            $this->uses(['Payments']);
    
            // Fetch the cc form to be used with this company and currency
            $gateway_form = $this->Payments->getBuildCcForm($client->settings['default_currency'], $vars);

    and then on the custom Gateway can pass the vars to the View

    CustomGateway ::
    
    	public function buildCcForm($vars = null) {
            // Load the view into this object, so helpers can be automatically added to the view
            $this->view = $this->makeView('cc_form', 'default', str_replace(ROOTWEBDIR, '', dirname(__FILE__) . DS));
    
            // Load the helpers required for this view
            Loader::loadHelpers($this, ['Form', 'Html']);
    
            $this->view->set('meta', $this->meta);
            $this->view->set('vars', $vars);
    
            return $this->view->fetch();
        }

     

  2. There's a problem using this plugin on a fresh install blesta-4.0.1

    The navigator links will disappear after loading the admin page.

    basically the link is still there, but un-clickable since there is no content inside the anchor form (the 'Live Chat' text is missing)

    the original source shows that the link exist, but using firebug viewing the live DOM source, shows the text has gone missing thus causing the top navigator bar to the site_admin missing

    lc01.PNG

    lc02.PNG

    lc03.PNG

  3. The system should be converting from UTC as stored in the database for display and other actions. If you find areas where this is not happening, please open a bug report.

     

    In terms of utilizing data from the database in another application, you will need to adjust the date times from UTC to your desired timezone.

     

    I see, so blesta took care of the conversion.

     

    But is there any reason not to change the table column type into TIMESTAMP instead of DATETIME (for those transactional type date), and then also open the PDO connection with SET time_zone to UTC query;

    this way, the functionality of the date record stays the same, but it'll make easier for database admin to view the data without requiring the date conversion.

  4. Hello,

    I'm not sure whether this is working as designed or something else.

     

    I noticed that the value of datetime field in the database are all in UTC thus causing whenever I do direct analysis to the database from external application, the time values are shifted.

    e.g. currently both my php and database timezones are set in: UTC+0700,

    and now is: [2016-04-16 13:00:00], but whenever I add someting (client or notes), the value in the database for date_added became [2016-04-16 06:00:00]

  5. Actually, let me rephrase.

     

    We do sometimes have clients who want to separate their sub-domain hosting into different hosting account (e.g to split the quota usage, etc)

    Lets say that that client own example.com, then want to purchase new hosting account for the subdomain sub1.example.com

     

    if the client doesn't have any subdomain/dns setup for sub1 under example.com account, the auto provision will run without problem,

    but if the dns record already set under the base domain, then it will fail to provision sub1.example.com

     

    What we need is some kind of notification when the client about to order new hosting account which the auto provision might fail (due to dns entry already exists),

    so at least the client knows and can do removal for such entry before proceeding in ordering new account.

  6. Hi,

     

    whenever an admin tick the select all, and submit services for scheduled cancelation, blesta will throw error

     

    Oh noes!

    Trying to get property of non-object on line 2114 in {BLESTA}/app/models/services.php

     

    Seems like the service_id includes a non-numeric data (from the select all tickbox)

     

    POST DATA:

    _csrf_token:....
    service_ids[]:all
    service_ids[]:38
    date:2015-10-31
    action_type:term
    action:schedule_cancellation

    I did a quick hack in the /app/controllers/admin_client.php (around line 314), and seems like the problem goes away

    private function updateServices($client, array $data) {
    ...
                        foreach ($data['service_ids'] as $service_id) {
                            // ignore non numeric service_id <'all'>
                            if (!is_numeric($service_id))
                                continue;
                            if ($data['action_type'] == "none") {
                                $this->Services->unCancel($service_id);
                            } else {
                                $this->Services->cancel($service_id, $vars);
                            }
                            $success = true;
                        }
    ...
    }
    
  7. Hi,

     

    I got question about payment process for the non-merchant gateway

    my transaction doesn't get recorded into the system after I call the callback/return url

     

    basically my validate/success function is as: (using get method to test)

        public function success(array $get, array $post) {
    
            $client_id = $this->ifSet($get['cid']);
            $return = array(
                'client_id' => $client_id,
                'amount' => $this->ifSet($get['amount']),
                'currency' => $this->ifSet($get['currency']),
                'invoices' => $this->unserializeInvoices($this->ifSet($get['inv'])),
                'status' => "approved",
                'transaction_id' => $this->ifSet($get['txid']),
                'parent_transaction_id' => $this->ifSet($get['txid'])
            );
            return $return;
        }

    and I called the return/callback url with the param:

    ?currency=IDR&cid=3&txid=1234&amount=1000.000&inv=32=1000.0000

    But the invoices doesn't get credited, it still have outstanding payment of 1000

    and I don't see any transaction being recorded

     

     

    Is there any functions to record the payment transaction that I missed?

     

  8. Hello,

     

    I'm trying to create a custom non-merchant payment gateway which can accept multiple payment method,

    and I would like to control which payment method it uses.

     

    I created a form which pass an array value of the payment method,

    but upon passing it to the error checking, I always get

    Undefined index: value on line 820 in {BLESTA}/components/record/record.php

    it only occurs when the error checking passes (true value)

     

    metas:

    Array
    (
        [merchant_id] => mercID
        [server_key] => servKey
        [client_key] => clientKey
        [acceptable_payment_type] => Array
            (
                [0] => cc
                [1] => transfer
            )
    
        [currencies] => Array
            (
                [0] => IDR
            )
    
    )

    and this causes the error message: (whenever the value is true)

    $rules = array(
                'acceptable_payment_type' => array(
                    'valid' => array(
                        'rule' => true,
                        'message' => "Payment type invalid"
                    )
                )
            );

    settings.pdt:

    <?php
                            foreach($acceptablePayment as $ap) {
                                print "<li>";
                                $this->Form->fieldCheckbox("acceptable_payment_type[]", $ap, true, array('id'=>"acceptable_payment_type[]"));
                                print $this->_("test.payment_type_".$ap, true);
                                print "</li>";
                               
                            }
                ?>
×
×
  • Create New...