Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## EDocument Integration

Integration app for sending and receiving PEPPOL e-documents via service providers (B2B Router, Recommand).
Integration app for sending and receiving PEPPOL e-documents via service providers (B2B Router, Recommand, Peppyrus).

This app extends the [edocument](https://github.com/prilk-consulting/edocument) app by providing integration capabilities with PEPPOL service providers for:
- **Sending e-documents**: Transmit PEPPOL invoices and credit notes via API to service providers
Expand Down Expand Up @@ -52,12 +52,26 @@ Configure integration with PEPPOL service providers using the **EDocument Integr
- **EDocument Integrator**: Choose your service provider:
- **B2B Router**: For B2B Router integration
- **Recommand**: For Recommand integration
- **Peppyrus**: For Peppyrus integration
- **API Configuration**: Enter your API credentials:
- **API Key**: Your service provider API key
- **API Secret**: Your service provider API secret (for Recommand)
- **Base URL**: Your service provider's API base URL
- **Account ID**: Your account identifier (for B2B Router, also used as team_id for Recommand)
- **Company ID**: Your company identifier (for Recommand)
- **API Secret**: Your service provider API secret (Recommand only)
- **Base URL**: Your service provider's API base URL. For Peppyrus use `https://api.test.peppyrus.be/v1` for test or `https://api.peppyrus.be/v1` for production.
- **Account ID**: Your account identifier for providers that require it, such as B2B Router and Recommand
- **Company ID**: Your provider company identifier where required, such as Recommand

### Peppyrus Setup

To use Peppyrus integration:

1. Create or obtain a Peppyrus API key
2. Set **EDocument Integrator** to **Peppyrus**
3. Set **API Key** to your Peppyrus key
4. Set **Base URL** to the Peppyrus environment you want to target:
- Test: `https://api.test.peppyrus.be/v1`
- Production: `https://api.peppyrus.be/v1`

Peppyrus message transmission uses the participant identifiers embedded in the generated UBL XML, so supplier and customer EndpointID values must be present in the document.

### Recommand Setup

Expand Down Expand Up @@ -106,7 +120,7 @@ For receiving incoming documents via polling:
3. Each document will be automatically processed and create an **EDocument** record
4. The system will automatically detect the profile and validate the XML

**Automatic Polling**: The app includes a scheduled task that automatically polls for incoming documents every hour. This runs for all active integration settings with Recommand integrator.
**Automatic Polling**: The app includes a scheduled task that automatically polls for incoming documents every hour. This runs for all active integration settings.

## Usage

Expand Down Expand Up @@ -166,6 +180,15 @@ After receiving an incoming document:
- Document verification
- Transparent pricing

### Peppyrus

- **API Documentation**: [Peppyrus API](https://api.test.peppyrus.be/v1)
- **Features**:
- Send documents via the documented `/message` endpoint
- Poll inbox messages via the documented message list/detail endpoints
- Validate connectivity using organization information endpoints
- Look up recipients in the Peppol directory

## API Endpoints

### Webhook Endpoint
Expand Down
22 changes: 16 additions & 6 deletions edocument_integration/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ def transmit_edocument(edocument_name: str):
elif integrator == "Recommand":
from .recommand_api import transmit_invoice

transmission_result = transmit_invoice(
xml_content, invoice_doc=edocument_doc, integration_settings=integration_settings
)
elif integrator == "Peppyrus":
from .peppyrus_api import transmit_invoice

transmission_result = transmit_invoice(
xml_content, invoice_doc=edocument_doc, integration_settings=integration_settings
)
Expand Down Expand Up @@ -376,14 +382,18 @@ def poll_incoming_invoices(profile: str | None = None, company: str | None = Non
frappe.throw(_("No integration settings found for profile: {0}").format(profile))

integrator = integration_settings.get("edocument_integrator")
if integrator != "Recommand":
frappe.throw(_("Polling incoming invoices is only supported for Recommand integrator."))
if integrator == "Recommand":
from .recommand_api import poll_inbox

# Import poll_inbox function
from .recommand_api import poll_inbox
poll_result = poll_inbox(integration_settings=integration_settings, company_id=company)
elif integrator == "Peppyrus":
from .peppyrus_api import poll_inbox

# Poll inbox for incoming invoices
poll_result = poll_inbox(integration_settings=integration_settings, company_id=company)
poll_result = poll_inbox(integration_settings=integration_settings, company_id=company)
else:
frappe.throw(
_("Polling incoming invoices is only supported for Recommand and Peppyrus integrators.")
)

if not poll_result.get("invoices"):
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"fieldname": "edocument_integrator",
"fieldtype": "Select",
"label": "EDocument Integrator",
"options": "B2B Router\nRecommand"
"options": "B2B Router\nRecommand\nPeppyrus"
},
{
"fieldname": "company",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class EDocumentIntegrationSettings(Document):
base_url: DF.Data | None
company: DF.Link | None
company_id: DF.Data | None
edocument_integrator: DF.Literal["B2B Router", "Recommand"]
edocument_integrator: DF.Literal["B2B Router", "Recommand", "Peppyrus"]
edocument_profile: DF.Link | None
# end: auto-generated types

Expand Down Expand Up @@ -129,6 +129,10 @@ def poll_incoming_documents(self):
elif self.edocument_integrator == "B2B Router":
from edocument_integration.b2brouter_api import poll_inbox

poll_result = poll_inbox(integration_settings=integration_settings, company_id=self.company_id)
elif self.edocument_integrator == "Peppyrus":
from edocument_integration.peppyrus_api import poll_inbox

poll_result = poll_inbox(integration_settings=integration_settings, company_id=self.company_id)
else:
frappe.throw(_("Unsupported E-document integrator: {0}").format(self.edocument_integrator))
Expand Down
Loading
Loading