Skip to content
Snippets Groups Projects
kaszarobert's avatar
Issue #3281082 by kaszarobert: Add possibility to use sandbox API
Robert Kasza authored
47068c42
History

CONTENTS OF THIS FILE

  • Introduction
  • Requirements
  • Installation
  • Configuration
  • Maintainers
  • Sponsors

INTRODUCTION

SuperFaktura is an easy to use online app, that allows you to create great looking online invoices, proformas, price estimates, orders, delivery and credit notes. You can invoice in foreign currencies and languages. Accept payments online, organize your stock management, send electronic invoices online, or in paper form via hybrid post.

REQUIREMENTS

INSTALLATION

  • with composer

     composer require drupal/superfaktura
  • with drush

     drush en superfaktura

CONFIGURATION

After installation you need to set your SFAPI email and key (from your SuperFaktura account) and other invoice details on page

/admin/commerce/config/superfaktura

Next step is to create own module with subscriber to call SuperFaktura service. In example below SuperFaktura service is called when Order is placed.

<?php

namespace Drupal\your_module\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\state_machine\Event\WorkflowTransitionEvent;

/**
 * Superfaktura event subscriber.
 */
class SuperfakturaSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      'commerce_order.place.pre_transition' => ['createInvoice', -200],
    ];
  }

  /**
   * Create Invoice in Superfaktura from created order.
   *
   * @param \Drupal\state_machine\Event\WorkflowTransitionEvent $event
   *   Transition Event.
   */
  public function createInvoice(WorkflowTransitionEvent $event) {
    /** @var \Drupal\commerce_order\Entity\Order $order */
    $order = $event->getEntity();
    $invoice = \Drupal::service('superfaktura.invoice_service');
    $invoice->createInvoice($order);
  }

}

MAINTAINERS

SPONSORS

The development of this module is sponsored by SuperFaktura