Download the PHP package abeta-io/abeta-punchout without Composer
On this page you can find all versions of the php package abeta-io/abeta-punchout. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abeta-io/abeta-punchout
More information about abeta-io/abeta-punchout
Files in abeta-io/abeta-punchout
Package abeta-punchout
Short Description Abeta extension for Laravel
License OSL-3.0 AFL-3.0
Informations about the package abeta-punchout
Abeta for Laravel
The official Laravel Punchout plugin for Abeta. Offer OCI and cXML PunchOut quickly and easily with Abeta. Connect with procurement systems / ERPs such as Coupa, Oracle and Sap Ariba. Increase the turnover of existing customers or acquire new customers with the help of B2B connections.
Requirements
To properly use this plugin a registered Abeta account is needed!
Installation
Install via composer:
Publish the config file
Publish the routes file
Quick start
Return cart Facade
Use the global helper to check if a user is a PunchOut user
Order Confirmation Integration
The package provides two approaches for handling order confirmation: event listeners or callback functions. This flexibility simplifies the integration of the order processing flow into various systems.
Option 1: Using Event Listeners
It is possible to listen to the OrderReceived event to handle order confirmation data. The event provides access to a structured Order DTO, making it easy to retrieve order details.
Example Listener:
Registering the Listener By default, Laravel will automatically find and register your event listeners by scanning your application's Listeners directory. However, if event discovery is disabled in your project, you will need to register the listener manually in the EventServiceProvider. To do so, follow these steps:
Option 2: Using the Callback Function
Alternatively, the onOrderProcessed callback function can be used to handle order data. This approach is useful for inline or quick customizations.
Example Callback inside AppServiceProvider:
Error Handling
The plugin uses a custom exception, OrderProcessingException, to handle errors during order processing. This exception ensures that errors are properly caught and returned as structured messages by the controller.
The plugin validates incoming data in the controller and returns error messages in the response when validation fails. However, you can also implement custom error handling logic in your event listener or callback function.
Order DTO Structure
| The Order DTO provides an object-oriented structure for accessing order data: | Property | Description |
|---|---|---|
cart_id |
Unique identifier for the cart | |
total |
Total order amount | |
currency |
Order currency (e.g., EUR) |
|
delivery_datetime |
Delivery date and time | |
order_reference |
Reference number for the order | |
customer_reference |
Reference number for the customer | |
products |
Collection of Product objects |
|
billTo |
Billing address (Address object) |
|
shippTo |
Shipping address (Address object) |
Converting Order to Array
To convert the Order DTO to an array for further processing:
Configuration
Customizing Routes
The package provides predefined routes for handling login operations. If you prefer to customize these routes, you can configure the following options in config/abeta.php:
Using other model than User model
Want to use another model than Laravels default User model?
<?php
/*
* Configuration of the Abeta Punchout Package, used to offer OCI and cXML via the Abeta Middleware.
*/
return [
/*
* Customer model, used to select customer from.
*/
'customerModel' => '\App\Models\User',
/*
* Auth provider
*/
'auth' => '\Illuminate\Support\Facades\Auth',
/*
* String, representing database column of username
*/
'username' => 'email',
/*
* String, representing database column of password
*/
'password' => 'password',
];