billie / shopware6-payment-module
Billie payment for Shopware 6
Installs: 3 137
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 0
Type:shopware-platform-plugin
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0
- billie/api-php-sdk: ^3.1
- shopware/core: ~6.5.0
Requires (Dev)
- phpstan/phpstan: ^1.11
- rector/rector: ^1.2
- symplify/easy-coding-standard: ^12.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.x-dev
- 3.0.0
- 2.0.x-dev
- 2.0.1
- 1.0.2
- 1.0.1
- 1.0.0
- dev-3.0-sw65
- dev-task/BILLSWVI-81_add-merchant-name
- dev-task/BILLSWVI-95_direct-debit
- dev-task/BILLSWVI-95_direct-debit_phpstan
- dev-task/BILLSWVI-74_65x-compatibility
- dev-task/BILLSWVI-74_65x-compatibility_64
- dev-task/BILLSWVI-83_apiv2
This package is auto-updated.
Last update: 2025-01-02 14:53:39 UTC
README
If you do not use the Shopware default invoice documents, you need to inform the Billie module about the invoice number form the ERP/WaWi.
Please do NOT modify any data via direct SQL commands!
The following code snippet will show you how you can modify the Billie data correctly. You should create a custom plugin for this, or integrate it into the adaptor of your WaWi/ERP system.
Preparation
You should inject the entity repository via DI of Symfony. The name of the service is called
billie_order_data.repository
and will be an instance
of \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository
You can also get it via the container (not the recommended):
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */ /** @var \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $repository */ $repository = $container->get('billie_order_data.repository');
Fetch Billie order data by order id
If you do only have the entity id of the order, you need to use the repository to find the billie data by the order id.
/** @var \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $repository */ $orderId = 'YOUR_ORDER_ID'; $criteria = new \Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria(); $criteria->addFilter(new \Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter( \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_ORDER_ID, $orderId )); /** @var \Billie\BilliePayment\Components\Order\Model\OrderDataEntity $billieOrderData */ $billieOrderData = $repository->search($criteria, \Shopware\Core\Framework\Context::createDefaultContext())->first(); $billieOrderData->getId(); // ID of the Billie order data entity $billieOrderData->getReferenceId(); // billie order reference id (uui) $billieOrderData->getExternalInvoiceNumber(); // external invoice number $billieOrderData->getExternalInvoiceUrl(); // external invoice url $billieOrderData->getExternalDeliveryNoteUrl(); // external delivery note url $billieOrderData->getBankIban(); // bank account: iban $billieOrderData->getBankBic(); // bank account: bic $billieOrderData->getBankName(); // bank account: name
Fetch Billie order data from loaded order entity
If you already have an instance of an order entity, you can get the order data simply by the getExtension
-method.
/** @var \Shopware\Core\Checkout\Order\OrderEntity $order */ $order = [...]; /** @var \Billie\BilliePayment\Components\Order\Model\OrderDataEntity $billieOrderData */ $billieOrderData = $order->getExtension(\Billie\BilliePayment\Components\Order\Model\Extension\OrderExtension::EXTENSION_NAME); $billieOrderData->getExternalInvoiceNumber(); // External invoice number $billieOrderData->getExternalInvoiceUrl(); // external invoice url $billieOrderData->getExternalDeliveryNoteUrl(); // external delivery note url
Update Billie order data
If you need to modify the Billie data, you should do this with the entity repository and the upsert
-method.
/** @var \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $repository */ $repository->upsert([ [ \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_ID => 'ID of the Billie order data entity', // This is always required ! \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_EXTERNAL_INVOICE_NUMBER => 'external invoice number', \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_EXTERNAL_INVOICE_URL => 'external invoice url', \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_EXTERNAL_DELIVERY_NOTE_URL => 'external delivery note url', ] ], \Shopware\Core\Framework\Context::createDefaultContext());