Jump to content

Seb

Administrators
  • Posts

    674
  • Joined

  • Last visited

Posts posted by Seb

  1. Things like this we would definitely consider core.  We're building a global billing system and Croatia still has hundreds of thousands of businesses that need software!

    Generally I think fiscalization is a trend that's going to increase. There are similar requirements in other countries.

    Webhooks is something we have planned.  As for the callback to then put something on an invoice, that should be relatively trivial for us once we have the webhooks added.

    Is there an API for the government system or something you can share with us (privately if confidential)?

     

    • Like 1
  2. On 9/24/2022 at 6:52 AM, Luis said:

    One last thing 

    they recently implemented invoice templating

    /admin/settings/invoice-template

    I didn’t take a look yet but maybe you can put some logic on the code. 

    Exactly this

     

    Syntax would be 

     

    {% if invoice.current_data.content.client_address is not empty %}
    	{% if invoice.current_data.content.client_address.country.code = 'FR' %}
          <p>French Address<br />
          Line 1<br />
          Line 2</p>
    	{% else %}
          <p>Other Address<br />
          Line 1<br />
          Line 2</p>
        {% endif %}
    {% endif %}

     

  3. A client needed some guidance putting a quick API call together and our API docs aren't yet particularly user-friendly, so for anyone else's benefit here is a very quick and dirty proof of concept of how to get tickets and create a ticket via the API

    <?php
    
    class upmindAuth {
    
        public $api_url;
        public $origin;
        public $token;
        
        function __construct($origin){
            $this->api_url = 'api.upmind.io'; //live api url
            $this->origin = $origin; // Brand Origin
        }
        
        public function validate($username,$password){
            if (!$this->api_token(array('username'=>$username,'password'=>$password,'grant_type'=>'admin'))){
                return false;
            }
            return true;
        }
        
        public function api_token($params){
        
            $curl = curl_init();
            curl_setopt_array($curl, array(
              CURLOPT_URL => "https://".$this->api_url."/oauth/access_token",
              CURLOPT_RETURNTRANSFER => true,
              CURLOPT_ENCODING => "",
              CURLOPT_MAXREDIRS => 10,
              CURLOPT_TIMEOUT => 30,
              CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
              CURLOPT_CUSTOMREQUEST => "POST",
              CURLOPT_POSTFIELDS => json_encode($params),
              CURLOPT_HTTPHEADER => array(
                "accept: application/vnd.pub.v1+json",
                "cache-control: no-cache",
                "content-type: application/json",
                "origin: $this->origin",
              ),
            ));
        
            $response = curl_exec($curl);
            $err = curl_error($curl);
        
            if ($err) {
                return array('success'=>false,'error'=>"cURL Error #:" . $err);
            } else {
                $actor = json_decode($response);           
                $this->token = $actor->access_token;
                return true;
            }
        }
        
        public function get($endpoint){
          
            $curl = curl_init();
            curl_setopt_array($curl, array(
            CURLOPT_URL => "https://".$this->api_url.$endpoint,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
            CURLOPT_HTTPHEADER => array(
              "authorization: Bearer ".$this->token,
              "cache-control: no-cache",
              "origin: ".$this->origin,
            ),
          ));
        
          $response = curl_exec($curl);
        
          $err = curl_error($curl);
          
          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
              return json_decode($response);
          }
        }
        
        public function post($endpoint,$params){
        
          $curl = curl_init();
          curl_setopt_array($curl, array(
          CURLOPT_URL => "https://".$this->api_url.$endpoint,
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => "",
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 30,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => "POST",
          CURLOPT_POSTFIELDS => $params,
          CURLOPT_HTTPHEADER => array(
            "authorization: Bearer ".$this->token,
            "cache-control: no-cache",
            "origin: ".$this->origin,
          ),
        ));
        
        $response = curl_exec($curl);
        $err = curl_error($curl);
        
        if ($err) {
          echo "cURL Error #:" . $err;
        } else {
            return json_decode($response);
        }
        }
        
    }
    
    // Upmind API Creds
    $instance = "https://xxxxxxxxx.upmind.app"; // Your Upmind Brand URL (E.g. https://my.domain.com)
    $user = "xxxx"; // username
    $pass = "xxxx"; // password
    
    // Now we get tickets from Upmind
    $upmind = new upmindAuth($instance);
    if (!$upmind->validate($user,$pass)){
        echo "Username and password incorrect"; die;
    }
    
    if (isset($_POST['ticketsubject'])){
        $clientid = "xxx-xxx-xxx"; // ID of your client 
        $endpoint  = "/api/admin/tickets";
        $ticket = $upmind->post($endpoint,array('client_id'=>$clientid,'subject'=>$_POST['ticketsubject'],'body'=>$_POST['ticketbody']));
        if ($ticket->status == 'ok') { 
            echo "<p>Ticket with reference " . $ticket->data->reference . " created</p>"; 
        } else {
            echo "<p>Error</p>";
        }
    }
    
    // Single API call to get the data we need
    $endpoint = "/api/admin/tickets?with=messages";
    $output = $upmind->get($endpoint);
    
    foreach ($output->data as $o){
        ?>Ticket Ref: <?=$o->reference?>: <?=$o->subject?> (<?php echo sizeof($o->messages);?>)<br /><?php
    }
    
    ?>
    <h2>Create new ticket</h2>
    <form method="post">
        New Ticket Subject: <input name="ticketsubject" type="text" placeholder="subject"><br />
        New Ticket Body: <textarea name="ticketbody"></textarea><br />
        <input type="submit" value="Create new ticket">
    </form>

     

    • Like 2
  4. We've actually had some discussions with Revolut directly about this and will be adding it to the list to build

    It's not high up the list precisely because our first priority for gateways at the moment is basically getting global coverage. But once we've done that we can loop back to this

  5. Have created an issue for future -- we  can use the basket functionality to make formal quotes with some restrictions that allow the customer to convert the quote to order within a timeframe

     

    You can for now create a basket within a client account and let the client continue it.

    • Like 4
  6. Hi Daniel

    So two things

    1. We're very close to releasing a tool to build third party integrations. However to begin with any integrations would get merged into our main provisioning system (once reviewed by us) so you wouldn't really build your own custom ones here. This is really so we and others can build connections with popular systems (e.g. server providers, hosting control panels etc)

    2. Upmind is set up so that you can make custom blueprints, and we're also planning it so you will be able to do that directly in the application. The provisioning system is open source and standalone so you could have entirely custom integrations completely apart from Upmind that we interface with. However, this is not around the corner and we need to get 1) sorted first.

     

    • Like 2
×
×
  • Create New...