From 06d7c906fa218ada1f3591f2b60bcfcdab625eb2 Mon Sep 17 00:00:00 2001 From: Ameet Deshpande Date: Thu, 5 Mar 2026 01:35:09 +0530 Subject: [PATCH] Add P2P trading examples, implementation guides, and enrollment specs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - P2P Trading implementation guide (revised) with notes on allocation/settlement and payment - Onboarding implementation guide for digital energy programs - Example JSONs for P2P trading flows (discover, select, init, confirm, status) - Example JSONs for P2P trading interdiscom flows (including cascaded, curtailment, settlement) - Example JSONs for enrollment flows (OAuth2, OTP, prosumer/consumer variants) - EV charging examples reorganized under examples/ev-charging/ - Energy credential VC examples (consumption, generation, storage profiles) - Updated schema validation and Postman collection generation scripts - Removed old examples/v2/P2P_Trading/ (superseded by new structure) - Removed taxonomy.md (content integrated into implementation guide) Part of PR #160 decomposition — Examples & Implementation Guides Co-Authored-By: Claude Opus 4.6 --- ...arding_Users_in_Digital_Energy_Programs.md | 464 ++ .../v2/EV_Charging/EV_Charging.md | 2 +- ...arding_users_in_digital_energy_programs.md | 2775 ++++++++++++ .../P2P_Trading_implementation_guide_DRAFT.md | 3740 +++++++++++------ .../note-on-allocation-settlement-logic.md | 1275 ++++++ ...e-on-payment-in-p2p-trading-interdiscom.md | 1487 +++++++ .../v2/P2P_Trading/taxonomy.md | 253 -- examples/enrollment/v2/README.md | 53 + .../enrollment/v2/confirm-request-oauth2.json | 58 + .../enrollment/v2/confirm-request-otp.json | 62 + examples/enrollment/v2/confirm-request.json | 60 + .../enrollment/v2/init-request-oauth2.json | 53 + examples/enrollment/v2/init-request-otp.json | 54 + .../init-request-prosumer-solar-battery.json | 81 + .../v2/init-request-simple-consumer.json | 67 + .../v2/on-confirm-response-no-meter.json | 64 + .../v2/on-confirm-response-oauth2.json | 86 + .../v2/on-confirm-response-otp.json | 85 + .../v2/on-confirm-response-success.json | 67 + .../v2/on-init-response-conflict.json | 69 + .../enrollment/v2/on-init-response-error.json | 50 + .../v2/on-init-response-oauth2.json | 83 + .../enrollment/v2/on-init-response-otp.json | 52 + .../v2/on-init-response-success.json | 94 + ...on-update-response-consent-revocation.json | 56 + .../v2/on-update-response-unenrollment.json | 69 + .../v2/update-request-consent-revocation.json | 46 + .../v2/update-request-unenrollment.json | 45 + .../v1-EOS/cancel/cancel-request.json | 29 + .../on_cancel-charger_breakdown-request.json | 212 + .../v1-EOS/cancel/on_cancel-request.json | 206 + .../v1-EOS/confirm/confirm-request.json | 104 + .../v1-EOS/confirm/on_confirm-request.json | 224 + .../ev-charging/v1-EOS/init/init-request.json | 65 + .../v1-EOS/init/on_init-request.json | 208 + .../v1-EOS/rating/on_rating-request.json | 30 + .../v1-EOS/rating/rating-request.json | 31 + .../v1-EOS/search/on_search-request.json | 288 ++ .../v1-EOS/search/search-request.json | 58 + .../v1-EOS/select/on_select-request.json | 175 + .../v1-EOS/select/select-request.json | 52 + .../v1-EOS/status/on_status-request.json | 220 + .../v1-EOS/status/status-request.json | 25 + .../v1-EOS/support/on_support-request.json | 30 + .../v1-EOS/support/support-request.json | 29 + .../on_update-request-charging-end.json | 220 + .../on_update-request-charging-start.json | 220 + .../update/update-request-charging-end.json | 37 + .../update/update-request-charging-start.json | 38 + .../v2/cascaded-confirm-request.json | 142 + .../v2/cascaded-init-request.json | 134 + .../v2/cascaded-on-confirm-response.json | 143 + .../v2/cascaded-on-init-response.json | 142 + .../v2/confirm-request.json | 176 + .../v2/confirm-response.json | 182 + .../v2/discover-request.json | 40 + .../v2/discover-response.json | 143 + .../v2/init-request.json | 176 + .../v2/init-response.json | 186 + .../v2/on-update-response-curtailment.json | 133 + .../v2/on-update-response-final-invoice.json | 246 ++ ...n-update-response-settlement-complete.json | 115 + .../v2/publish-catalog.json | 178 + .../v2/publish-reduce-catalog-inventory.json | 179 + .../v2/publish-revoke-catalog.json | 177 + .../v2/select-request.json | 159 + .../v2/select-response.json | 174 + .../v2}/status-request.json | 5 +- .../v2/status-response-completed.json | 231 + .../v2/status-response-curtailed.json | 217 + .../v2/status-response-final-invoice.json | 227 + .../status-response-settlement-complete.json | 96 + .../v2/status-response.json | 191 + .../v2/cascaded-confirm-request.json | 102 + .../p2p-trading/v2/cascaded-init-request.json | 102 + .../v2/cascaded-on-confirm-response.json | 103 + .../v2/cascaded-on-init-response.json | 102 + examples/p2p-trading/v2/confirm-request.json | 161 + examples/p2p-trading/v2/confirm-response.json | 162 + .../v2}/discover-request.json | 11 +- .../p2p-trading/v2/discover-response.json | 170 + examples/p2p-trading/v2/init-request.json | 161 + examples/p2p-trading/v2/init-response.json | 161 + .../v2/on-update-response-curtailment.json | 113 + examples/p2p-trading/v2/publish-catalog.json | 206 + examples/p2p-trading/v2/select-request.json | 155 + examples/p2p-trading/v2/select-response.json | 155 + examples/p2p-trading/v2/status-request.json | 20 + .../v2/status-response-completed.json | 213 + .../v2/status-response-curtailed.json | 183 + examples/p2p-trading/v2/status-response.json | 179 + .../v2/P2P_Trading/cascaded-init-request.json | 109 - .../cascaded-on-init-response.json | 114 - examples/v2/P2P_Trading/confirm-request.json | 56 - examples/v2/P2P_Trading/confirm-response.json | 91 - .../v2/P2P_Trading/discover-response.json | 104 - examples/v2/P2P_Trading/init-request.json | 96 - examples/v2/P2P_Trading/init-response.json | 94 - examples/v2/P2P_Trading/select-request.json | 40 - examples/v2/P2P_Trading/select-response.json | 69 - .../status-response-completed.json | 161 - examples/v2/P2P_Trading/status-response.json | 145 - scripts/generate_postman_collection.py | 139 +- scripts/validate_schema.py | 69 +- .../examples/consumption-profile-vc.json | 25 + .../examples/generation-profile-vc.json | 28 + .../examples/program-enrollment-vc.json | 23 + .../examples/storage-profile-vc.json | 26 + .../examples/utility-customer-vc. json | 31 + 109 files changed, 18730 insertions(+), 2792 deletions(-) create mode 100644 docs/Onboarding_Users_in_Digital_Energy_Programs.md create mode 100644 docs/implementation-guides/v2/Onboarding/IG_Onboarding_users_in_digital_energy_programs.md create mode 100644 docs/implementation-guides/v2/P2P_Trading/note-on-allocation-settlement-logic.md create mode 100644 docs/implementation-guides/v2/P2P_Trading/note-on-payment-in-p2p-trading-interdiscom.md delete mode 100644 docs/implementation-guides/v2/P2P_Trading/taxonomy.md create mode 100644 examples/enrollment/v2/README.md create mode 100644 examples/enrollment/v2/confirm-request-oauth2.json create mode 100644 examples/enrollment/v2/confirm-request-otp.json create mode 100644 examples/enrollment/v2/confirm-request.json create mode 100644 examples/enrollment/v2/init-request-oauth2.json create mode 100644 examples/enrollment/v2/init-request-otp.json create mode 100644 examples/enrollment/v2/init-request-prosumer-solar-battery.json create mode 100644 examples/enrollment/v2/init-request-simple-consumer.json create mode 100644 examples/enrollment/v2/on-confirm-response-no-meter.json create mode 100644 examples/enrollment/v2/on-confirm-response-oauth2.json create mode 100644 examples/enrollment/v2/on-confirm-response-otp.json create mode 100644 examples/enrollment/v2/on-confirm-response-success.json create mode 100644 examples/enrollment/v2/on-init-response-conflict.json create mode 100644 examples/enrollment/v2/on-init-response-error.json create mode 100644 examples/enrollment/v2/on-init-response-oauth2.json create mode 100644 examples/enrollment/v2/on-init-response-otp.json create mode 100644 examples/enrollment/v2/on-init-response-success.json create mode 100644 examples/enrollment/v2/on-update-response-consent-revocation.json create mode 100644 examples/enrollment/v2/on-update-response-unenrollment.json create mode 100644 examples/enrollment/v2/update-request-consent-revocation.json create mode 100644 examples/enrollment/v2/update-request-unenrollment.json create mode 100644 examples/ev-charging/v1-EOS/cancel/cancel-request.json create mode 100644 examples/ev-charging/v1-EOS/cancel/on_cancel-charger_breakdown-request.json create mode 100644 examples/ev-charging/v1-EOS/cancel/on_cancel-request.json create mode 100644 examples/ev-charging/v1-EOS/confirm/confirm-request.json create mode 100644 examples/ev-charging/v1-EOS/confirm/on_confirm-request.json create mode 100644 examples/ev-charging/v1-EOS/init/init-request.json create mode 100644 examples/ev-charging/v1-EOS/init/on_init-request.json create mode 100644 examples/ev-charging/v1-EOS/rating/on_rating-request.json create mode 100644 examples/ev-charging/v1-EOS/rating/rating-request.json create mode 100644 examples/ev-charging/v1-EOS/search/on_search-request.json create mode 100644 examples/ev-charging/v1-EOS/search/search-request.json create mode 100644 examples/ev-charging/v1-EOS/select/on_select-request.json create mode 100644 examples/ev-charging/v1-EOS/select/select-request.json create mode 100644 examples/ev-charging/v1-EOS/status/on_status-request.json create mode 100644 examples/ev-charging/v1-EOS/status/status-request.json create mode 100644 examples/ev-charging/v1-EOS/support/on_support-request.json create mode 100644 examples/ev-charging/v1-EOS/support/support-request.json create mode 100644 examples/ev-charging/v1-EOS/update/on_update-request-charging-end.json create mode 100644 examples/ev-charging/v1-EOS/update/on_update-request-charging-start.json create mode 100644 examples/ev-charging/v1-EOS/update/update-request-charging-end.json create mode 100644 examples/ev-charging/v1-EOS/update/update-request-charging-start.json create mode 100644 examples/p2p-trading-interdiscom/v2/cascaded-confirm-request.json create mode 100644 examples/p2p-trading-interdiscom/v2/cascaded-init-request.json create mode 100644 examples/p2p-trading-interdiscom/v2/cascaded-on-confirm-response.json create mode 100644 examples/p2p-trading-interdiscom/v2/cascaded-on-init-response.json create mode 100644 examples/p2p-trading-interdiscom/v2/confirm-request.json create mode 100644 examples/p2p-trading-interdiscom/v2/confirm-response.json create mode 100644 examples/p2p-trading-interdiscom/v2/discover-request.json create mode 100644 examples/p2p-trading-interdiscom/v2/discover-response.json create mode 100644 examples/p2p-trading-interdiscom/v2/init-request.json create mode 100644 examples/p2p-trading-interdiscom/v2/init-response.json create mode 100644 examples/p2p-trading-interdiscom/v2/on-update-response-curtailment.json create mode 100644 examples/p2p-trading-interdiscom/v2/on-update-response-final-invoice.json create mode 100644 examples/p2p-trading-interdiscom/v2/on-update-response-settlement-complete.json create mode 100644 examples/p2p-trading-interdiscom/v2/publish-catalog.json create mode 100644 examples/p2p-trading-interdiscom/v2/publish-reduce-catalog-inventory.json create mode 100644 examples/p2p-trading-interdiscom/v2/publish-revoke-catalog.json create mode 100644 examples/p2p-trading-interdiscom/v2/select-request.json create mode 100644 examples/p2p-trading-interdiscom/v2/select-response.json rename examples/{v2/P2P_Trading => p2p-trading-interdiscom/v2}/status-request.json (70%) create mode 100644 examples/p2p-trading-interdiscom/v2/status-response-completed.json create mode 100644 examples/p2p-trading-interdiscom/v2/status-response-curtailed.json create mode 100644 examples/p2p-trading-interdiscom/v2/status-response-final-invoice.json create mode 100644 examples/p2p-trading-interdiscom/v2/status-response-settlement-complete.json create mode 100644 examples/p2p-trading-interdiscom/v2/status-response.json create mode 100644 examples/p2p-trading/v2/cascaded-confirm-request.json create mode 100644 examples/p2p-trading/v2/cascaded-init-request.json create mode 100644 examples/p2p-trading/v2/cascaded-on-confirm-response.json create mode 100644 examples/p2p-trading/v2/cascaded-on-init-response.json create mode 100644 examples/p2p-trading/v2/confirm-request.json create mode 100644 examples/p2p-trading/v2/confirm-response.json rename examples/{v2/P2P_Trading => p2p-trading/v2}/discover-request.json (57%) create mode 100644 examples/p2p-trading/v2/discover-response.json create mode 100644 examples/p2p-trading/v2/init-request.json create mode 100644 examples/p2p-trading/v2/init-response.json create mode 100644 examples/p2p-trading/v2/on-update-response-curtailment.json create mode 100644 examples/p2p-trading/v2/publish-catalog.json create mode 100644 examples/p2p-trading/v2/select-request.json create mode 100644 examples/p2p-trading/v2/select-response.json create mode 100644 examples/p2p-trading/v2/status-request.json create mode 100644 examples/p2p-trading/v2/status-response-completed.json create mode 100644 examples/p2p-trading/v2/status-response-curtailed.json create mode 100644 examples/p2p-trading/v2/status-response.json delete mode 100644 examples/v2/P2P_Trading/cascaded-init-request.json delete mode 100644 examples/v2/P2P_Trading/cascaded-on-init-response.json delete mode 100644 examples/v2/P2P_Trading/confirm-request.json delete mode 100644 examples/v2/P2P_Trading/confirm-response.json delete mode 100644 examples/v2/P2P_Trading/discover-response.json delete mode 100644 examples/v2/P2P_Trading/init-request.json delete mode 100644 examples/v2/P2P_Trading/init-response.json delete mode 100644 examples/v2/P2P_Trading/select-request.json delete mode 100644 examples/v2/P2P_Trading/select-response.json delete mode 100644 examples/v2/P2P_Trading/status-response-completed.json delete mode 100644 examples/v2/P2P_Trading/status-response.json create mode 100644 specification/energy-credentials/examples/consumption-profile-vc.json create mode 100644 specification/energy-credentials/examples/generation-profile-vc.json create mode 100644 specification/energy-credentials/examples/program-enrollment-vc.json create mode 100644 specification/energy-credentials/examples/storage-profile-vc.json create mode 100644 specification/energy-credentials/examples/utility-customer-vc. json diff --git a/docs/Onboarding_Users_in_Digital_Energy_Programs.md b/docs/Onboarding_Users_in_Digital_Energy_Programs.md new file mode 100644 index 00000000..c0669a0b --- /dev/null +++ b/docs/Onboarding_Users_in_Digital_Energy_Programs.md @@ -0,0 +1,464 @@ +# **Technical Specification: Multi-Channel Onboarding of Users into Digital Energy Programs** + +Version: 1.0 (Draft – Normative) + +--- + +## **Status of This Memo** + +This document defines the **technical specification** for onboarding users into Digital Energy Programs through multiple channels. +This is a **standards-track** document. + +--- + +## **Table of Contents** + +1. Scope +2. Normative References +3. Definitions +4. Architectural Overview +5. Identity & Authentication Specification +6. Asset Model Specification +7. Program Owner Specification (BPP Role) +8. Enrolment Channel Specification +9. Beckn-Based Enrollment Flow Specification +10. Enrollment Criteria Specification +11. Credential Specification +12. Registries +13. Security Considerations +14. Privacy Considerations +15. Compliance Requirements +16. Appendix (Message Structures) + +--- + +# **1. Scope** + +This specification defines the **protocols, message structures, identifiers, interactions, and requirements** for enrolling users into digital energy programs using: + +* **Utility Portals** +* **Certified Enrolment Agency Portals** +* **Network Participant Applications** using an **Onboarding SDK** + +The specification covers: + +* Identity and authentication +* Meter and DER association +* Program discovery and eligibility verification +* Consent acquisition +* Credential issuance +* Multi-utility onboarding +* Multi-persona handling +* Beckn protocol interactions for search → select → init → confirm + +This document is globally applicable and does not depend on any specific national identity scheme, tariff structure, or regulatory regime. + +--- + +# **2. Normative References** + +The following specifications are normative: + +* **Beckn Protocol 1.x / 2.0** — Discovery, Ordering, Fulfillment flows +* **W3C DID Core** +* **W3C Verifiable Credentials (VC Data Model)** +* **OpenID Connect Core** +* **RFC 6749 – OAuth 2.0** +* **RFC 8259 – JSON** +* **ISO/IEC 30141 – IoT Reference Architecture** +* **DEG Vision Document** (Identity, Verifiability, Interoperability principles) + +--- + +# **3. Definitions** + +### **3.1 User Identifier** + +One of: + +* National ID (e.g., Social Security Number, Aadhaar, SIN, BankID, etc.) +* Program-level Meter Identifier (UMID) +* Utility Customer Identifier + +### **3.2 Enrolment Agency (EA)** + +A utility-certified entity authorized to conduct onboarding flows. + +### **3.3 Program Owner** + +Entity operating a digital energy program. +In Beckn terms, Program Owner implements a **BPP**. + +### **3.4 Network Participant** + +Any BAP, BPP, NFO, EV app, DER app, or aggregator application integrating via the SDK. + +### **3.5 Behind-the-Meter (BTM) Appliances** + +Appliances consuming or producing energy through a user-side meter. + +--- + +# **4. Architectural Overview** + +The onboarding architecture comprises: + +## **4.1 Identity Layer** + +* OIDC-based unified Identity Provider (IdP) +* Federation with national ID or utility ID providers +* All login returns a `subject_id` + +## **4.2 Asset Layer** + +Defines relationships: + +* User ↔ Utility ↔ Accounts ↔ Meters ↔ Sites ↔ DERs (EV, solar, battery) + +## **4.3 Program Layer** + +Each Program Owner exposes: + +* Beckn Discovery endpoint +* Beckn Select + Init + Confirm to communicate eligibility and enrollment requirements +* Issuance of Program Enrollment Credential + +## **4.4 Channel Layer** + +Three approved channels: + +1. Utility Portal +2. Certified Enrolment Agency Portal +3. Network Participant App (via SDK) + +## **4.5 Credential Layer** + +All enrollment outcomes must issue: + +* **Program Enrollment Credential** as a Verifiable Credential + +--- + +# **5. Identity & Authentication Specification** + +### **5.1 Identity Provider (IdP) Requirements** + +The IdP MUST: + +1. Support OIDC Authorization Code Flow +2. Support at least three identifiers: + + * `national_id` + * `meter_id` (UMID) + * `utility_customer_id` +3. Issue ID Tokens containing: + +```json +{ + "sub": "", + "id_type": "national|meter|utility", + "meter_ids": [""], + "utility_customer_ids": ["<>"], + "acr": "assurance_level", + "iss": "https://idp.example.com" +} +``` + +### **5.2 Authentication Assurance** + +The IdP MUST support: + +* MFA (OTP, email, authenticator app, or national ID provider’s MFA) +* Federation with external trusted ID schemes + +--- + +# **6. Asset Model Specification** + +Every ecosystem MUST support the following data model: + +### **6.1 Entities** + +**User** + +* `subject_id` +* Contact info + +**Utility** + +* `utility_id` +* Service areas (CIM regions) + +**Meter** + +* `umid` (universal meter identity) +* `utility_meter_id` +* `utility_id` +* `site_id` + +**DER** + +* `der_id` +* `der_type` (EV, solarPV, battery, heat pump, V2G-EV) +* `primary_meter` (umid) +* `secondary_utility` for cross-utility usage + +**Program** + +* `program_id` +* Owned by Program Owner (BPP) + +--- + +# **7. Program Owner Specification (BPP Role)** + +### **7.1 Program Discovery** + +Program Owners MUST expose: + +* `POST /search` (Beckn Search) + Returns metadata: +* Supported personas +* Supported utilities +* Enrollment prerequisites + +### **7.2 Eligibility Evaluation** + +The **Init** API MUST return: + +```json +{ + "enrollment_criteria": { + "documents_required": [...], + "proof_required": [...], + "consents_required": [...], + "cross_utility_checks": [...], + "der_certification_required": true|false + }, + "next_steps": "collect_documents" +} +``` + +### **7.3 Enrollment Decision** + +The **Confirm** API MUST: + +* Approve or reject enrollment +* Issue Program Enrollment Credential + +--- + +# **8. Enrolment Channel Specification** + +Three channels MUST use identical Beckn interactions. + +### **8.1 Utility Portal** + +* MUST redirect to IdP for login +* MUST invoke `search → select → init → confirm` on Program Owner’s BPP +* MUST store final Program Enrollment Credential for user + +### **8.2 Certified Enrolment Agency Portal** + +* MUST redirect to IdP +* MUST call Program Owner BPP +* MUST include EA identity header: + +``` +X-Enrollment-Agency-ID: +``` + +### **8.3 Network Participant App with SDK** + +* MUST embed onboarding SDK +* MUST NOT directly call BPP +* SDK MUST perform all Beckn operations +* SDK MUST NOT override Enrollment decisions + +--- + +# **9. Beckn-Based Enrollment Flow Specification** + +### **9.1 Sequence** + +1. `search` – Program discovery +2. `on_search` – Program Owner BPP responds +3. `select` – User selects program +4. `on_select` – Program Owner returns preliminary eligibility +5. `init` – User submits identifiers, meters, DERs +6. `on_init` – Program Owner returns: + + * Required consents + * Required proofs + * Cross-utility checks +7. `confirm` – User submits consents + proofs +8. `on_confirm` – Program Owner issues enrollment credential + +### **9.2 Required Fields** + +**init.request** + +```json +{ + "subject_id": "did:example:123", + "meters": ["umid-123", "umid-456"], + "ders": ["der-ev-001"], + "cross_utility_info": ["utilityB"], + "persona_type": "consumer_multimeter" +} +``` + +--- + +# **10. Enrollment Criteria Specification** + +Program Owners MUST publish criteria **via Beckn Select/Init**, not via registries. + +Criteria MUST be returned as structured data: + +```json +{ + "criteria": { + "identity": ["national_id|meter_id|utility_id"], + "meter_association": true, + "der_certification": true, + "utility_ownership_verification": true, + "cross_utility_consent_required": true, + "v2g_control_consent_required": false + } +} +``` + +--- + +# **11. Credential Specification** + +### **11.1 Program Enrollment Credential (VC)** + +Required fields: + +```json +{ + "@context": ["https://www.w3.org/2018/credentials/v1", "https://dedi.global/energy-program/v1"], + "type": ["VerifiableCredential", "ProgramEnrollmentCredential"], + "issuer": "", + "credentialSubject": { + "subject_id": "", + "program_id": "", + "meters": [""], + "ders": [""], + "roles": ["consumer|prosumer|v2g-participant"], + "constraints": {...} + } +} +``` + +Must support **StatusList revocation**. + +--- + +# **12. Registries** + +Program discovery and criteria are **not registries**. + +The following registries **MUST** exist on `dedi.global`: + +### **12.1 Utility Registry** + +Contains: + +* Utility ID +* Public keys +* Service areas + +### **12.2 Enrolment Agency Registry** + +Contains: + +* EA ID +* Certification details +* Supported utilities +* Public signing keys + +### **12.3 Schema Registry** + +Contains: + +* Program Enrollment Credential schema +* Meter/DER schemas +* Consent schema + +Registries MUST be publicly accessible and versioned. + +--- + +# **13. Security Considerations** + +* All Beckn messages MUST be signed (non-repudiation). +* IdP must enforce MFA where legally required. +* DER control consents MUST be explicit. +* Cross-utility interactions MUST use mutual TLS. + +--- + +# **14. Privacy Considerations** + +* Programs MUST request minimum necessary data. +* National IDs must not be stored by Program Owners without legal basis. +* Cross-utility data sharing requires explicit consent. +* Users must be able to revoke participation at any time. + +--- + +# **15. Compliance Requirements** + +Entities MUST comply with: + +* Data protection laws (GDPR, CCPA, PDPA, etc.) +* Grid/utility regulatory frameworks +* Beckn protocol compliance +* Credential issuance standards +* Deg Vision principles (identity, verifiability, interoperability) + +--- + +# **16. Appendix: Message Structure Examples** + +## **16.1 Beckn init** + +```json +{ + "context": { "action": "init" }, + "message": { + "order": { + "provider": { "id": "program-owner-bpp" }, + "items": [{ "id": "program-id" }], + "fulfillments": [{ + "customer": { "id": "" }, + "instrument": { + "meters": ["umid-1"], + "ders": ["der-1"] + } + }] + } + } +} +``` + +## **16.2 Beckn on_confirm** + +```json +{ + "message": { + "order": { + "provider": { "id": "program-owner-bpp" }, + "id": "enrollment-12345", + "state": "CONFIRMED", + "documents": [{ + "type": "ProgramEnrollmentCredential", + "url": "https://utility.example.com/credential/123" + }] + } + } +} +``` diff --git a/docs/implementation-guides/v2/EV_Charging/EV_Charging.md b/docs/implementation-guides/v2/EV_Charging/EV_Charging.md index fb307e1e..e9d97703 100644 --- a/docs/implementation-guides/v2/EV_Charging/EV_Charging.md +++ b/docs/implementation-guides/v2/EV_Charging/EV_Charging.md @@ -303,7 +303,7 @@ Specifically, for EV Charging, please use the following configuration: ### 11.2.3. 10.2.3 Performing a test EV charging transaction -Step 1 : Download the postman collection, from [here](/testnet/postman-collections/v2/EV_Charging/). +Step 1 : Download the postman collection, from [here](/testnet/ev-charging-devkit/postman/). Step 2 : Run API calls diff --git a/docs/implementation-guides/v2/Onboarding/IG_Onboarding_users_in_digital_energy_programs.md b/docs/implementation-guides/v2/Onboarding/IG_Onboarding_users_in_digital_energy_programs.md new file mode 100644 index 00000000..2b35b6a0 --- /dev/null +++ b/docs/implementation-guides/v2/Onboarding/IG_Onboarding_users_in_digital_energy_programs.md @@ -0,0 +1,2775 @@ +# Implementation Guide: Multi-Channel Onboarding of Users into Digital Energy Programs + +Version 0.2 (Non-Normative) + +## Table of Contents +- [1. Introduction](#1-introduction) +- [2. Scope](#2-scope) +- [3. Terminology](#3-terminology) + - [3.1. Acronyms](#31-acronyms) +- [4. Terminology](#4-terminology) +- [5. Implementation Principles](#5-implementation-principles) +- [6. System Architecture Overview](#6-system-architecture-overview) +- [7. Identity and Authentication Implementation](#7-identity-and-authentication-implementation) + - [7.1. Authentication Flow](#71-authentication-flow) + - [7.2. OAuth2 Token Usage](#72-oauth2-token-usage) + - [7.3. Utility IdP API Examples](#73-utility-idp-api-examples) + - [7.4. MeterOwnershipCredential VC Issuance](#74-meterownershipcredential-vc-issuance) + - [7.5. Example Utility API Implementation](#75-example-utility-api-implementation) +- [8. Asset Mapping and Data Integration](#8-asset-mapping-and-data-integration) + - [8.1. Meter Discovery](#81-meter-discovery) + - [8.2. DER Discovery](#82-der-discovery) + - [8.3. Data Integration](#83-data-integration) +- [9. Beckn-Based Enrollment Implementation](#9-beckn-based-enrollment-implementation) + - [9.1. Standard Beckn Flow](#91-standard-beckn-flow) + - [9.2. Enrollment Flow Diagram](#92-enrollment-flow-diagram) + - [9.2.1. High-Level Overview (Both Flows)](#921-high-level-overview-both-flows) + - [9.2.2. OTP-Based Enrollment Flow (Detailed)](#922-otp-based-enrollment-flow-detailed) + - [9.2.3. OAuth2/OIDC-Based Enrollment Flow (Detailed)](#923-oauth2oidc-based-enrollment-flow-detailed) + - [9.2.4. Error Handling: No Meter Specified](#924-error-handling-no-meter-specified) +- [10. Channel-Specific Implementation Guides](#10-channel-specific-implementation-guides) + - [10.1. Utility Portal (UtilityPortal/BAP)](#101-utility-portal-utilityportalbap) + - [10.2. Enrolment Agency Portal (EA/BAP)](#102-enrolment-agency-portal-eabap) + - [10.3. Network Participant App (BAP)](#103-network-participant-app-bap) +- [11. Persona-Specific Implementation Guidance](#11-persona-specific-implementation-guidance) + - [11.1. Consumer – Single Household, Single Meter](#111-consumer--single-household-single-meter) + - [11.2. Consumer – Multiple Households, Multiple Meters](#112-consumer--multiple-households-multiple-meters) + - [11.3. Consumer – BTM Appliances via Home Meter](#113-consumer--btm-appliances-via-home-meter) + - [11.4. Consumer – BTM Appliances via Same Utility (e.g., neighbor’s meter)](#114-consumer--btm-appliances-via-same-utility-eg-neighbors-meter) + - [11.5. Consumer/Prosumer – BTM Appliances via Different Utility](#115-consumerprosumer--btm-appliances-via-different-utility) + - [11.6. Prosumer – Single Rooftop Solar Meter](#116-prosumer--single-rooftop-solar-meter) + - [11.7. Prosumer – Multiple Meters with Solar](#117-prosumer--multiple-meters-with-solar) + - [11.8. Prosumer – EV with V2G](#118-prosumer--ev-with-v2g) +- [12. Governance and Operational Guidance](#12-governance-and-operational-guidance) +- [13. Data Models and Storage Considerations](#13-data-models-and-storage-considerations) +- [14. Security and Privacy Implementation](#14-security-and-privacy-implementation) +- [15. Testing, Certification and Compliance](#15-testing-certification-and-compliance) +- [16. Deployment Topology Recommendations](#16-deployment-topology-recommendations) +- [17. Developer Tooling and SDK Recommendations](#17-developer-tooling-and-sdk-recommendations) +- [18. Appendix A – Sample Payloads](#18-appendix-a--sample-payloads) + - [18.1. Init Request](#181-init-request) + - [18.1.1. Example: OTP-Based Init Request](#1811-example-otp-based-init-request) + - [18.1.2. Example: OAuth2/OIDC-Based Init Request](#1812-example-oauth2oidc-based-init-request) + - [18.1.3. Example: Simple Consumer with Single Meter](#1813-example-simple-consumer-with-single-meter) + - [18.1.4. Example: Prosumer with Solar and Battery](#1814-example-prosumer-with-solar-and-battery) + - [18.2. On\_Init Response](#182-on_init-response) + - [18.2.1. Example: OTP-Based On\_Init Response](#1821-example-otp-based-on_init-response) + - [18.2.2. Example: OAuth2/OIDC-Based On\_Init Response](#1822-example-oauth2oidc-based-on_init-response) + - [18.2.3. Example: Successful Verification, No Conflicts](#1823-example-successful-verification-no-conflicts) + - [18.2.4. Example: Enrollment Conflict Detected](#1824-example-enrollment-conflict-detected) + - [18.3. Confirm Request](#183-confirm-request) + - [18.3.1. Example: OTP-Based Confirm Request](#1831-example-otp-based-confirm-request) + - [18.3.2. Example: OAuth2/OIDC-Based Confirm Request](#1832-example-oauth2oidc-based-confirm-request) + - [18.3.3. Example: Confirm with Enrollment Dates](#1833-example-confirm-with-enrollment-dates) + - [18.4. On\_Confirm Response](#184-on_confirm-response) + - [18.4.1. Example: OTP-Based On\_Confirm Response (Success)](#1841-example-otp-based-on_confirm-response-success) + - [18.4.2. Example: OAuth2/OIDC-Based On\_Confirm Response (Success)](#1842-example-oauth2oidc-based-on_confirm-response-success) + - [18.4.3. Example: No Meter Specified Error](#1843-example-no-meter-specified-error) + - [18.4.4. Example: Successful Enrollment with Credential](#1844-example-successful-enrollment-with-credential) + - [18.5. Error Response Example](#185-error-response-example) + - [18.5.1. Example: Credential Verification Failed](#1851-example-credential-verification-failed) + - [18.6. Consent Revocation](#186-consent-revocation) + - [18.6.1. Example: Consent Revocation Request](#1861-example-consent-revocation-request) + - [18.6.2. Example: Consent Revocation Response](#1862-example-consent-revocation-response) + - [18.7. Unenrollment](#187-unenrollment) + - [18.7.1. Example: Unenrollment Request](#1871-example-unenrollment-request) + - [18.7.2. Example: Unenrollment Response](#1872-example-unenrollment-response) +- [19. Appendix B – Multi-Utility Interaction Patterns](#19-appendix-b--multi-utility-interaction-patterns) +- [20. Appendix C – Error Handling Patterns](#20-appendix-c--error-handling-patterns) + +Table of contents and section auto-numbering was done using [Markdown-All-In-One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one) vscode extension. Specifically `Markdown All in One: Create Table of Contents` and `Markdown All in One: Add/Update section numbers` commands accessible via vs code command pallete. + +Example jsons were imported directly from source of truth elsewhere in this repo inline by inserting the pattern below within all json expand blocks, and running this [script](/scripts/embed_example_json.py), e.g. `python3 scripts/embed_example_json.py path_to_markdown_file.md`. + +``` +
txt_with_json_keyword + +
+``` + +--- + +## 1. Introduction + +This Implementation Guide explains how to build and operate a multi-channel onboarding system for Digital Energy Programs such as: + +* Peer-to-Peer (P2P) energy trading +* Demand flexibility or demand response +* Virtual Power Plants (VPPs) +* Community solar and other tariff or incentive programs + +A successful onboarding process must confirm: + +* The identity of the user +* The user’s relationship to one or more utilities +* The meters and sites associated with the user +* Any Behind-the-Meter (BTM) devices or Distributed Energy Resources (DERs) +* The user’s eligibility for a given program +* The necessary consents for data use, telemetry, or control rights + +This guide provides engineering and operational recommendations to implement the multi-channel model defined in the Technical Specification. + +--- + +## 2. Scope + +This document covers: + +* Engineering patterns for multi-channel onboarding +* Identity and login integration +* Meter and DER mapping +* How to use Beckn flows for onboarding +* Guidance for utility portals, Enrolment Agency portals, and SDK-based flows +* Persona-specific onboarding patterns +* Governance requirements for utilities and EAs +* Data, security, and compliance recommendations + +This guide does not redefine schemas or protocol rules; those remain in the Technical Specification. + +--- + +## 3. Terminology + +Below is a consolidated terminology set used throughout this guide. + +### 3.1. Acronyms + +| Acronym | Full Form | Definition | +|---------|-----------|------------| +| **Utility IdP** | Utility Identity Provider | The OIDC-based identity provider operated by or on behalf of a utility. Handles user authentication (OTP, password, etc.) and issues OAuth2 tokens and Verifiable Credentials. | +| **Program Owner BPP** | Program Owner Beckn Provider Platform | The BPP implementation operated by the Program Owner (utility or energy program operator). Also referred to as UtilityBPP or Orchestrator in some contexts. Handles enrollment flows and issues Program Enrollment Credentials. | + +--- + +## 4. Terminology + +| Term | Definition | +| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| User / End User | A person or organization participating in a digital energy program (consumer, prosumer, EV owner, business). | +| Utility | An electricity provider responsible for metering, billing, and grid operations. | +| Program Owner | The entity offering a digital energy program (P2P, Flex, VPP). Operates the Program Owner BPP (also called UtilityBPP/Orchestrator) for enrollment flows. | +| Utility IdP | Utility Identity Provider. OIDC-based identity provider that handles user authentication and issues OAuth2 tokens and Verifiable Credentials. | +| Program Owner BPP | Program Owner Beckn Provider Platform. The BPP implementation that handles enrollment flows and issues Program Enrollment Credentials. Also referred to as UtilityBPP or Orchestrator. | +| Enrolment Agency (EA) | A utility-certified entity authorized to onboard users, either via self-service or assisted flows. | +| Network Participant | Any Beckn-enabled application (BAP, BPP, NFO, EV app, DER app) that can trigger onboarding but is not a certified EA. | +| Network Facilitator Organization (NFO) | A neutral governance or orchestration entity in a digital energy network. Does not make eligibility decisions. | +| National Identity | A government-backed identity (e.g., Social Security Number, Aadhaar, BankID, SingPass) used via federated IdPs. | +| Utility Customer Identifier | A unique customer or account number issued by a utility. | +| Program-Level Meter Identifier (UMID) | A universal, utility-agnostic meter identity used across programs. | +| DER Identifier (DER-ID) | Unique program-level identifier for a distributed energy resource. | +| Subject Identifier (subject_id) | The unified identifier for a user across utilities, apps, and programs (often a DID or OIDC `sub`). | +| Meter | A physical electricity meter tracking consumption, generation, or net flow. | +| Behind-the-Meter (BTM) Appliance | A device consuming or producing energy behind a user’s meter (e.g., EV charging at home). | +| Distributed Energy Resource (DER) | Any distributed asset such as solar PV, EV, home batteries, V2G, or smart loads. | +| EVSE | Electric Vehicle Supply Equipment (charging station). | +| Digital Energy Program | Any structured offering such as P2P trading, Flex, VPP, Community Solar, or special tariffs. | +| Program Enrollment | Approval for a user to join a program, issued as a Verifiable Credential. | +| Eligibility Criteria | Conditions needed for joining a program, returned dynamically via Beckn select/init flows. | +| Consent | Authorization for data sharing, telemetry, control rights, or cross-utility interactions. | +| BAP (Beckn Application Platform) | A consumer-facing Beckn application. | +| BPP (Beckn Provider Platform) | A provider system responding to Beckn calls. The Program Owner serves as a BPP for onboarding. | +| Discover / Select / Init / Confirm | The four core Beckn workflow steps used for onboarding. | +| Context Object | Beckn metadata (transaction ID, timestamp, domain, signature info). | +| Utility Portal | User-facing portal run by a utility for onboarding. | +| Enrolment Agency Portal | A certified EA’s portal for onboarding users. | +| Onboarding SDK | A software kit embedded inside apps to execute standardized onboarding flows. | +| Network Participant Application | Any application embedding the onboarding SDK (EV, DER, aggregator, smart home apps). | +| Program Enrollment Credential | A Verifiable Credential proving program participation. | +| Revocation List | Mechanism for invalidating credentials. | +| DER Certification | Proof that a DER asset (solar, EVSE, etc.) is compliant and safely installed. | +| Audit Trail | Signed, immutable record of onboarding-related actions. | +| Authorization | Permission to onboard users or to control DER assets. | +| Capability | Functional characteristics an entity or device supports (e.g., V2G capability). | + + + +--- + +## 5. Implementation Principles + +1. All onboarding channels must route to the same Program Owner backend. +2. Onboarding follows a consistent order: + identity → meters → DERs → program evaluation → enrollment. +3. Eligibility criteria must be fetched dynamically from the Program Owner. +4. All telemetry, cross-utility, and DER control actions require explicit consent. +5. Beckn discover/select/init/confirm flows should be reused without deviation. +6. User inputs should be minimized through auto-discovery where possible. + +--- + +## 6. System Architecture Overview + +A typical implementation includes: + +* An Identity Provider (IdP) +* An Onboarding Orchestration Layer (portal or SDK backend) +* A Program Owner BPP (eligibility logic and enrollment credential issuer) +* Utility Core Systems (CIS, MDM, DER registry, billing) +* A credential issuance and verification subsystem + +Architecture Diagram (Mermaid): + +```mermaid +graph TD + subgraph UserSide[User and Apps] + U[User] --> AP1[Utility Portal] + U --> AP2[Enrolment Agency Portal] + U --> AP3[Network Participant App] + end + + AP1 -->|OIDC| IDP[Identity Provider] + AP2 -->|OIDC| IDP + AP3 --> SDK[Onboarding SDK] + SDK -->|OIDC| IDP + + AP1 -->|Beckn| BPP[Program Owner BPP] + AP2 -->|Beckn| BPP + SDK -->|Beckn| BPP + + BPP --> CIS[Customer Information System] + BPP --> MDM[Meter Data Management] + BPP --> DER[DER Registry] + BPP --> BILL[Billing System] + BPP --> VCISS[VC Issuer / Revocation Service] +``` + +--- + +## 7. Identity and Authentication Implementation + +The Utility IdP and Program Owner BPP work together to provide a seamless authentication and enrollment experience. Authentication can be integrated with the Beckn enrollment flow in two ways: + +### 7.1. Authentication Flow + +The enrollment flow supports two authentication methods, both embedded within the Beckn protocol messages. + +**Important: Authentication is NOT required for /discover and /select.** Users can browse programs anonymously. Authentication is only required starting from `/init`. + +**Option 1: OTP-Based Authentication (BPP-Orchestrated)** +1. User browses programs via `/discover` and `/select` (anonymous, no auth required) +2. User decides to enroll → provides mobile number to UtilityPortal/BAP +3. BAP sends `init` request with `userAuth: { authMethod: "OTP", mobile: "..." }` +4. Program Owner BPP calls Utility IdP to generate OTP +5. User receives OTP via SMS and enters it in the portal +6. BAP sends `confirm` request with `userAuth: { authMethod: "OTP", mobile, nguid, otp }` and `meters` array +7. Program Owner BPP calls Utility IdP to verify OTP and retrieve meter/p2pdetails +8. BPP creates enrollment and returns credential + +**Option 2: OAuth2/OIDC Authentication (Deferred until /init)** +1. User browses programs via `/discover` and `/select` (anonymous, no auth required) +2. User decides to enroll → BAP redirects to Utility IdP for OAuth2/OIDC login +3. User authenticates with Utility IdP (receives accessToken, idToken) +4. BAP sends `init` request with `userAuth: { authMethod: "OIDC", accessToken, idToken }` +5. Program Owner BPP validates token with Utility IdP, retrieves user's meters +6. BPP returns meters list in `/on_init` response +7. User selects meters → BAP sends `confirm` request with tokens and `meters` array +8. BPP creates enrollment and returns credential + +### 7.2. OAuth2 Token Usage + +**IMPORTANT: OAuth2/OIDC tokens are transmitted in the Beckn message payload (`orderAttributes.userAuth`), NOT in HTTP Authorization headers.** + +This design ensures: +- Authentication is part of the business flow, not transport layer +- BPP can orchestrate authentication with multiple IdPs +- Consistent handling across different authentication methods (OTP vs OAuth2) + +**Example Beckn Request with OAuth2 Token in Payload:** +```http +POST /beckn/init HTTP/1.1 +Host: program-owner-bpp.example.com +Content-Type: application/json +X-Gateway-Authorization: + +{ + "context": { + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "action": "init", + ... + }, + "message": { + "order": { + "orderAttributes": { + "@context": ".../EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", + "idToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." + } + } + } + } +} +``` + +**Example OTP-Based Request:** +```json +{ + "message": { + "order": { + "orderAttributes": { + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "mobile": "+919999999999" + } + } + } + } +} +``` + +**Example OAuth2 Token Payload (decoded JWT):** +```json +{ + "sub": "did:example:user-12345", + "aud": "program-owner-bpp", + "iss": "https://utility-idp.example.com", + "iat": 1704067200, + "exp": 1704070300, + "nonce": "abc123", + "acr": "2", + "amr": ["otp"], + "meterId": "umid-001", + "caNumber": "CA123456789" +} +``` + +**Standard OAuth2 Token Fields:** +- `sub`: Subject identifier (user's unique ID) +- `aud`: Audience (intended recipient, e.g., Program Owner BPP) +- `iss`: Issuer (Utility IdP URL) +- `iat`: Issued at (Unix timestamp) +- `exp`: Expiration time (Unix timestamp) +- `nonce`: Random value to prevent replay attacks +- `acr`: Authentication Context Class Reference (assurance level) +- `amr`: Authentication Methods References (e.g., ["otp", "password"]) + +**Custom Claims (Utility-Specific):** +- `meterId`: Meter identifier (UMID) +- `caNumber`: Customer account number +- Additional utility-specific claims as needed + +### 7.3. Utility IdP API Examples + +The Utility IdP provides APIs for OTP generation, verification, and consumer validation. **These APIs are called by the Program Owner BPP** (not the BAP) to orchestrate authentication. This design allows: +- BPP to manage authentication flow centrally +- Support for multiple Utility IdPs in multi-utility scenarios +- Consistent authentication regardless of BAP implementation + +The exact API structure may vary by utility, but the following represents common patterns: + +**Generic OTP Generation Request:** +```http +POST /api/v1/otp/generate +Authorization: Bearer +Content-Type: application/json + +{ + "mobileNumber": "+1234567890", + "requestId": "req-12345-67890" +} +``` + +**Generic OTP Generation Response:** +```json +{ + "status": "success", + "requestId": "req-12345-67890", + "otpSessionId": "session-abc123", + "expiresIn": 300, + "message": "OTP sent to registered mobile number" +} +``` + +**Generic OTP Verification Request:** +```http +POST /api/v1/otp/verify +Authorization: Bearer +Content-Type: application/json + +{ + "otpSessionId": "session-abc123", + "otp": "123456", + "mobileNumber": "+1234567890" +} +``` + +**Generic OTP Verification Response:** +```json +{ + "status": "success", + "verified": true, + "verifiedAt": "2024-10-15T10:35:05Z", + "meters": [ + { + "meterId": "umid-001", + "caNumber": "CA123456789", + "meterNumber": "METER987654321", + "address": "123 Main Street", + "sanctionedLoad": 5.0, + "connectionType": "residential" + }, + { + "meterId": "umid-002", + "caNumber": "CA123456790", + "meterNumber": "METER987654322", + "address": "456 Oak Avenue", + "sanctionedLoad": 10.0, + "connectionType": "commercial" + } + ], + "p2pdetails": { + "usertype": "prosumer", + "isp2pactive": false, + "iscaactive": false, + "sdload": "5.0", + "cuflimit": "10.0" + }, + "meterOwnershipCredential": { + "credentialId": "vc-meter-ownership-001", + "type": "MeterOwnershipCredential", + "format": "VC-JWT", + "credentialData": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." + } +} +``` + +**Note:** The `accessToken` is optional in the response. The BPP may or may not receive an OAuth2 token from the Utility IdP. The critical data returned is the `meters` array and optional `p2pdetails` (additionalAttributes) which are passed to the BAP in the `on_confirm` response. + +**Generic Consumer Validation Request:** +```http +POST /api/v1/consumer/validate +Authorization: Bearer +Content-Type: application/json + +{ + "caNumber": "CA123456789", + "mobileNumber": "+1234567890", + "userType": "CONSUMER" +} +``` + +**Generic Consumer Validation Response:** +```json +{ + "status": "success", + "consumer": { + "caNumber": "CA123456789", + "meterNumber": "METER987654321", + "name": "John Doe", + "address": "123 Main Street", + "connectionStatus": "ACTIVE", + "sanctionLoad": 5.0, + "meterType": "SMART_METER" + } +} +``` + +### 7.4. MeterOwnershipCredential VC Issuance + +After successful OTP verification and consumer validation, the Utility IdP issues a `MeterOwnershipCredential` Verifiable Credential. This VC is then included in the Beckn `init` request's `orderAttributes.meterOwnershipCredential` field. + +**Example MeterOwnershipCredential VC (decoded JWT payload):** +```json +{ + "vc": { + "@context": ["https://www.w3.org/2018/credentials/v1"], + "type": ["VerifiableCredential", "MeterOwnershipCredential"], + "credentialSubject": { + "id": "did:example:user-12345", + "meterId": "umid-001", + "utilityId": "utility-example-001", + "caNumber": "CA123456789", + "meterNumber": "METER987654321", + "ownershipStatus": "OWNER", + "validFrom": "2024-01-01T00:00:00Z", + "validUntil": "2025-12-31T23:59:59Z" + }, + "issuanceDate": "2024-10-15T10:25:00Z" + }, + "iss": "did:example:utility-idp", + "iat": 1704067200 +} +``` + +This VC proves that the user (identified by `subject_id` from OAuth2 token) owns the specified meter/CA, as verified through the OTP flow with the Utility IdP. + +### 7.5. Example Utility API Implementation + +For reference, the following section shows an example of how a specific utility might implement these APIs. **Note:** This is for illustration only; actual utility implementations may vary. + +
+Example Utility API Implementation (Click to expand) + +**Example: Utility-Specific OTP API** + +Some utilities may require field-level encryption for security. The following shows an example pattern: + +**GenerateOTP Request (with encryption):** +```http +POST /api/integration/otp/generate +Content-Type: application/json + +{ + "sms_id": "ENC[base64_encrypted_sms_id]", + "mobile_no": "ENC[base64_encrypted_mobile_number]", + "username": "ENC[base64_encrypted_username]" +} +``` + +**GenerateOTP Response:** +```json +{ + "message": "SUCCESS", + "Response_code": "200", + "sessionId": "session-12345-67890" +} +``` + +**VerifyOTP Request (with encryption):** +```http +POST /api/integration/otp/verify +Content-Type: application/json + +{ + "sms_id": "ENC[base64_encrypted_sms_id]", + "mobile_no": "ENC[base64_encrypted_mobile_number]", + "username": "ENC[base64_encrypted_username]", + "sessionId": "session-12345-67890", + "otp": "ENC[base64_encrypted_otp]" +} +``` + +**ValidateConsumer Request (with encryption):** +```http +POST /api/integration/consumer/validate +Content-Type: application/json + +{ + "cano": "ENC[base64_encrypted_ca_number]", + "mobile_no": "ENC[base64_encrypted_mobile_number]", + "USERTYPE": "ENC[base64_encrypted_user_type]", + "FLAG": "ENC[base64_encrypted_flag]", + "ADDTNL1": "ENC[base64_encrypted_additional1]", + "ADDTNL2": "ENC[base64_encrypted_additional2]" +} +``` + +**ValidateConsumer Response (decrypted):** +```json +{ + "CA": "CA123456789", + "METER": "METER987654321", + "NAME": "John Doe", + "ADDRESS": "123 Main Street", + "CON_STATUS": "ACTIVE", + "Sanction_load": 5.0 +} +``` + +**Note:** Field-level encryption (AES-256-CBC) may be required by some utilities for compliance. The encryption keys and algorithms are typically provided by the utility as part of the integration documentation. + +
+ +--- + +## 8. Asset Mapping and Data Integration + +### 8.1. Meter Discovery + +Utility Portal: call CIS/MDM. +EA Portal: call a protected utility Meter API with user token. +SDK: rely on BPP’s Beckn init to resolve meter associations. + +### 8.2. DER Discovery + +Sources include: + +* Utility DER registries +* EV or OEM backends +* Inverter, battery, or smart home systems +* User declarations (with certification uploads) + +### 8.3. Data Integration + +Typical integrations: + +* CIS/CRM for customer accounts +* MDM for meter–subject relationships +* DER registry or asset database +* EV charging platforms if relevant + +--- + +## 9. Beckn-Based Enrollment Implementation + +### 9.1. Standard Beckn Flow + +1. discover +2. on_discover +3. select +4. on_select +5. init +6. on_init +7. confirm +8. on_confirm + +### 9.2. Enrollment Flow Diagram + +The enrollment flow supports two authentication methods embedded within the Beckn protocol: +1. **OTP-based authentication** - BPP orchestrates OTP flow with Utility IdP +2. **OAuth2/OIDC authentication** - User authenticates at /init, token passed in message payload + +**Key Design Principles:** +- **Anonymous discovery**: `/discover` and `/select` do NOT require authentication - users can browse programs freely +- **Authentication at /init**: Authentication is only required when user decides to enroll (at `/init` call) +- Authentication credentials (OTP or OAuth2 tokens) are passed in **message payload** (`orderAttributes.userAuth`), NOT in HTTP headers +- Program Owner BPP orchestrates authentication by calling Utility IdP +- `/on_init` response includes **list of user's meters** for selection +- After verification, BPP returns meters array and optional p2pdetails (additionalAttributes) +- If no meters specified in `/confirm`, error response includes available meters for user selection + +#### 9.2.1. High-Level Overview (Both Flows) + +```mermaid +sequenceDiagram + participant User + participant BAP as UtilityPortal/BAP + participant BPP as Program Owner BPP + participant IdP as Utility IdP + + rect rgb(240, 248, 255) + Note over User,IdP: Phase 1: Anonymous Discovery (common) + User->>BAP: Browse programs + BAP->>BPP: /discover, /select + BPP-->>BAP: Programs & details + end + + rect rgb(255, 250, 240) + Note over User,IdP: Phase 2: Authentication (at /init) + alt OTP Flow + BAP->>BPP: /init (mobile) + BPP->>IdP: generateOTP + IdP->>User: SMS OTP + BPP-->>BAP: /on_init (nguid) + User->>BAP: Enter OTP + else OAuth2/OIDC Flow + User->>IdP: Login (redirect) + IdP-->>BAP: Tokens + BAP->>BPP: /init (tokens) + BPP->>IdP: Validate + BPP-->>BAP: /on_init (meters list) + end + end + + rect rgb(240, 255, 240) + Note over User,IdP: Phase 3: Enrollment (common) + User->>BAP: Select meters + BAP->>BPP: /confirm (userAuth + meters) + BPP->>IdP: Verify (OTP) or Validate (token) + BPP-->>BAP: /on_confirm (credential, p2pdetails) + BAP-->>User: Enrollment complete + end +``` + +The detailed flows below show the full message payloads for each authentication method. + +#### 9.2.2. OTP-Based Enrollment Flow (Detailed) + +```mermaid +sequenceDiagram + participant User + participant BAP as UtilityPortal/BAP + participant BPP as Program Owner BPP + participant UtilityIdP as Utility IdP + + Note over User,UtilityIdP: Phase 1: Discovery & Program Selection + User->>BAP: Request program discovery + BAP->>BPP: POST /discover + BPP-->>BAP: /on_discover (available programs) + BAP->>User: Show programs + User->>BAP: Select program + BAP->>BPP: POST /select + BPP-->>BAP: /on_select (program details) + + Note over User,UtilityIdP: Phase 2: OTP Authentication (within Beckn init) + User->>BAP: Enter mobile number + BAP->>BPP: POST /init
orderAttributes.userAuth: {
authMethod: "OTP",
mobile: "+919999999999"
} + + BPP->>UtilityIdP: generateOTP(mobile) + UtilityIdP->>User: SMS with OTP + UtilityIdP-->>BPP: { nguid, expiresAt } + + BPP-->>BAP: /on_init
orderAttributes.userAuth: {
authMethod: "OTP",
nguid: "session-token",
message: "OTP sent",
expiresAt: "..."
} + + BAP->>User: Show OTP input + User->>BAP: Enter OTP + + Note over User,UtilityIdP: Phase 3: OTP Verification & Enrollment (within Beckn confirm) + BAP->>BPP: POST /confirm
orderAttributes: {
userAuth: {
authMethod: "OTP",
mobile: "+919999999999",
nguid: "session-token",
otp: "123456"
},
meters: [{ meterId: "umid-001" }]
} + + BPP->>UtilityIdP: verifyOTP(mobile, nguid, otp) + UtilityIdP->>UtilityIdP: Validate consumer + UtilityIdP-->>BPP: { verified: true,
meters: [...],
p2pdetails: {...} } + + BPP->>BPP: Create enrollment,
issue ProgramEnrollmentCredential + + BPP-->>BAP: /on_confirm
orderAttributes: {
userAuth: { verified: true },
enrollmentId: "...",
credential: { ... },
additionalAttributes: { p2pdetails: {...} }
} + + BAP-->>User: Enrollment successful +``` + +#### 9.2.3. OAuth2/OIDC-Based Enrollment Flow (Detailed) + +For OAuth2/OIDC flow, **authentication is NOT required for /discover and /select**. User can browse programs anonymously, then authenticate at /init: + +```mermaid +sequenceDiagram + participant User + participant BAP as UtilityPortal/BAP + participant BPP as Program Owner BPP + participant UtilityIdP as Utility IdP + + Note over User,UtilityIdP: Phase 1: Anonymous Discovery (NO authentication required) + User->>BAP: Browse available programs + BAP->>BPP: POST /discover
(no userAuth needed) + BPP-->>BAP: /on_discover (available programs) + BAP->>User: Show programs + User->>BAP: Select program + BAP->>BPP: POST /select
(no userAuth needed) + BPP-->>BAP: /on_select (program details, requirements) + BAP->>User: Show program details + + Note over User,UtilityIdP: Phase 2: User decides to enroll → Authentication at /init + User->>BAP: Click "Enroll" → Redirect to IdP + BAP->>UtilityIdP: OAuth2/OIDC login redirect + User->>UtilityIdP: Login (credentials) + UtilityIdP-->>BAP: accessToken, idToken (via callback) + + Note over User,UtilityIdP: Phase 3: Init with OAuth2 tokens (first authenticated call) + BAP->>BPP: POST /init
orderAttributes.userAuth: {
authMethod: "OIDC",
accessToken: "eyJ...",
idToken: "eyJ..."
} + + BPP->>UtilityIdP: Validate token (introspection/JWKS) + UtilityIdP-->>BPP: { valid: true,
subject: "user-123",
meters: [...],
p2pdetails: {...} } + + BPP-->>BAP: /on_init
orderAttributes: {
userAuth: {
authMethod: "OIDC",
verified: true,
subject: "user-123",
issuer: "https://..."
},
meters: [
{ meterId: "umid-001", sanctionedLoad: 5.0 },
{ meterId: "umid-002", sanctionedLoad: 10.0 }
]
} + + BAP->>User: Show user's meters & consents + + Note over User,UtilityIdP: Phase 4: Confirm enrollment with selected meters + User->>BAP: Select meters, accept consents + BAP->>BPP: POST /confirm
orderAttributes: {
userAuth: {
authMethod: "OIDC",
accessToken: "eyJ..."
},
meters: [{ meterId: "umid-001" }]
} + + BPP->>BPP: Create enrollment + + BPP-->>BAP: /on_confirm
orderAttributes: {
enrollmentId: "...",
credential: { ... },
additionalAttributes: { p2pdetails: {...} }
} + + BAP-->>User: Enrollment successful +``` + +**Key Points:** +- `/discover` and `/select` are **anonymous** - no authentication required +- Authentication happens at `/init` - this is when BPP validates token and retrieves user's meters +- `/on_init` response includes the **list of meters** belonging to the user +- BAP displays meters to user for selection before `/confirm` + +#### 9.2.4. Error Handling: No Meter Specified + +If `userAuth` is verified but `meters` array is empty or missing in confirm request, BPP returns an error **with the list of available meters** so the user can select: + +```mermaid +sequenceDiagram + participant BAP as UtilityPortal/BAP + participant BPP as Program Owner BPP + + BAP->>BPP: POST /confirm
orderAttributes: {
userAuth: { ... },
meters: [] // Empty!
} + + BPP-->>BAP: /on_confirm
error: {
code: "BIZ_NO_METER_SPECIFIED",
message: "No meter specified",
details: {
path: "$.message.order.orderAttributes.meters",
availableMeters: [
{ meterId: "umid-001", sanctionedLoad: 5.0 },
{ meterId: "umid-002", sanctionedLoad: 10.0 }
]
}
} + + BAP->>User: Show available meters
for selection + User->>BAP: Select meter(s) + BAP->>BPP: POST /confirm (retry)
meters: [{ meterId: "umid-001" }] +``` + +**Error Response JSON Example:** +```json +{ + "error": { + "code": "BIZ_NO_METER_SPECIFIED", + "message": "No meter specified for enrollment. Please select from available meters.", + "details": { + "path": "$.message.order.orderAttributes.meters", + "availableMeters": [ + { + "meterId": "umid-001", + "meterNumber": "METER987654321", + "address": "123 Main Street", + "sanctionedLoad": 5.0, + "connectionType": "residential" + }, + { + "meterId": "umid-002", + "meterNumber": "METER987654322", + "address": "456 Oak Avenue", + "sanctionedLoad": 10.0, + "connectionType": "commercial" + } + ] + } + } +} +``` + +This allows the BAP to display the user's meters and let them select which meter(s) to enroll, then retry the `/confirm` request. + +--- + +## 10. Channel-Specific Implementation Guides + +### 10.1. Utility Portal (UtilityPortal/BAP) + +The Utility Portal acts as a Beckn Application Platform (BAP) and is the primary user interface: + +* Collects user input (mobile number for OTP, or OAuth2 tokens) +* Passes authentication credentials to BPP via `orderAttributes.userAuth` +* **Does NOT directly call Utility IdP** for OTP generation/verification (BPP orchestrates this) +* Displays meters returned from BPP after authentication +* Collects meter selection from user for `meters` array in confirm request +* Displays p2pdetails and enrollment results from BPP + +### 10.2. Enrolment Agency Portal (EA/BAP) + +* Acts as BAP on behalf of users +* Collects user's mobile number for OTP flow +* Passes authentication to BPP (BPP handles IdP integration) +* Must log all actions for audit +* Supports assisted onboarding for complex personas + +### 10.3. Network Participant App (BAP) + +BAP responsibilities: + +* Collect authentication credentials (mobile for OTP, or OAuth2 tokens) +* Pass credentials to BPP in `orderAttributes.userAuth` +* Run Beckn flows (discover → select → init → confirm) +* Manage session and state +* Display meters and collect user selection +* Relay enrollment outcome to host app + +App responsibilities: + +* Trigger onboarding from appropriate context +* Store only non-sensitive results +* Never bypass BPP decisions +* **Never call Utility IdP directly** (BPP orchestrates authentication) + +--- + +## 11. Persona-Specific Implementation Guidance + +### 11.1. Consumer – Single Household, Single Meter + +Straightforward auto-discovery; minimal input required. + +### 11.2. Consumer – Multiple Households, Multiple Meters + +Portal must display meter–program matrix. + +### 11.3. Consumer – BTM Appliances via Home Meter + +SDK initiated from EV or smart home app. + +### 11.4. Consumer – BTM Appliances via Same Utility (e.g., neighbor’s meter) + +Requires two-party consent. + +### 11.5. Consumer/Prosumer – BTM Appliances via Different Utility + +Requires cross-utility identity linking and consent. + +### 11.6. Prosumer – Single Rooftop Solar Meter + +Requires DER certification. + +### 11.7. Prosumer – Multiple Meters with Solar + +Multiple program enrollments required. + +### 11.8. Prosumer – EV with V2G + +Requires control rights, telemetry consent, and device capability checks. + +--- + +## 12. Governance and Operational Guidance + +Utilities must: + +* Operate or federate IdP +* Maintain accurate meter and DER registries +* Expose BPP endpoints +* Certify and monitor EAs + +EAs must: + +* Maintain trained staff +* Keep audit trails +* Adhere to data retention and privacy policies + +Network participants must: + +* Use the onboarding SDK +* Not store identity information beyond what is allowed +* Present correct program information + +--- + +## 13. Data Models and Storage Considerations + +Recommended tables: + +* subjects +* subject_utility_links +* meters and meter_subject_links +* ders and der_subject_links +* program_enrollments (VC references) +* consents and consent_events +* audit_logs + +Use encryption, tokenization, and strict retention schedules. + +--- + +## 14. Security and Privacy Implementation + +* Enforce mutual TLS for all service-to-service calls. +* Sign Beckn messages. +* Rotate signing keys. +* Avoid collecting identity attributes beyond what is required. +* Provide consent revocation and logging. + +--- + +## 15. Testing, Certification and Compliance + +Test categories include: + +* Identity login flows +* Multi-meter and multi-site flows +* DER discovery and certification +* Cross-utility onboarding +* Beckn compliance +* VC issuance + +Compliance levels range from basic consumer onboarding to V2G-capable advanced programs. + +--- + +## 16. Deployment Topology Recommendations + +Recommend: + +* Separate identity, BPP, and data layers +* Use API gateway for Beckn traffic +* Deploy BPP close to CIS/MDM for low latency +* Maintain separate environments +* Use centralized logging and monitoring + +Topology diagram: + +```mermaid +graph TD + subgraph DMZ[Edge Layer] + GW[API Gateway] + end + + subgraph APP[Application Layer] + PORTAL[Utility or EA Portals] + SDKSVC[SDK Backend] + BPP[Program Owner BPP] + end + + subgraph CORE[Utility Core Systems] + CIS[CIS] + MDM[MDM] + DERREG[DER Registry] + BILL[Billing] + end + + subgraph IDSYS[Identity and Credentials] + IDP[Identity Provider] + VCISS[VC Issuer / Revocation] + end + + PORTAL --> GW --> BPP + SDKSVC --> GW --> BPP + PORTAL --> IDP + SDKSVC --> IDP + BPP --> CIS + BPP --> MDM + BPP --> DERREG + BPP --> BILL + BPP --> VCISS +``` + +--- + +## 17. Developer Tooling and SDK Recommendations + +* SDK available for JavaScript/TypeScript, Kotlin/Java, Swift, Flutter. +* Include UI modules for consent screens. +* Provide reference apps and API collections. +* Offer sandbox environments for testing. + +--- + +## 18. Appendix A – Sample Payloads + +### 18.1. Init Request + +The init request includes Verifiable Credentials (VCs) provided by the calling entity (Portal/BAP) that prove meter ownership, program eligibility, and DER certifications. + +**Credential Placement:** +- **Meter ownership credentials** are placed in `orderAttributes.meterOwnershipCredential` (single object, not array) +- **Program eligibility and DER certification credentials** are placed in `fulfillmentAttributes.credentials[]` (array) +- **Existing enrollments** for conflict checking are placed in `fulfillmentAttributes.existingEnrollments[]` (array) + +For utilities requiring OTP verification, the `MeterOwnershipCredential` VC is issued by the Utility IdP after successful OTP verification and is included in `orderAttributes`. + +The Program Owner BPP verifies these credentials and checks for conflicts with existing enrollments. + +#### 18.1.1. Example: OTP-Based Init Request + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:00Z", + "message_id": "msg-init-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "mobile": "+919999999999", + "utilityCustomerId": "CUST-123456", + "userType": "CONSUMER" + }, + "customer": { + "name": "Rajesh Kumar" + } + } + } + } +} + +``` +
+ +**Key Fields for OTP Flow**: +- `orderAttributes.userAuth.authMethod`: Set to `"OTP"` +- `orderAttributes.userAuth.mobile`: User's mobile number for OTP delivery + +#### 18.1.2. Example: OAuth2/OIDC-Based Init Request + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:00Z", + "message_id": "msg-init-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEyMzQ1IiwiYXVkIjoicHJvZ3JhbS1vd25lci1icHAiLCJpc3MiOiJodHRwczovL3V0aWxpdHktaWRwLmV4YW1wbGUuY29tIiwiaWF0IjoxNzI5MDAwMDAwLCJleHAiOjE3MjkwMDM2MDB9.signature", + "idToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEyMzQ1IiwibmFtZSI6IlJhamVzaCBLdW1hciIsImVtYWlsIjoicmFqZXNoQGV4YW1wbGUuY29tIiwiaXNzIjoiaHR0cHM6Ly91dGlsaXR5LWlkcC5leGFtcGxlLmNvbSIsImlhdCI6MTcyOTAwMDAwMCwiZXhwIjoxNzI5MDAzNjAwfQ.signature" + }, + "customer": { + "name": "Rajesh Kumar" + } + } + } + } +} + +``` +
+ +**Key Fields for OAuth2 Flow**: +- `orderAttributes.userAuth.authMethod`: Set to `"OIDC"` +- `orderAttributes.userAuth.accessToken`: OAuth2 access token from Utility IdP +- `orderAttributes.userAuth.idToken`: OIDC identity token (optional) + +#### 18.1.3. Example: Simple Consumer with Single Meter + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:00Z", + "message_id": "msg-init-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING", + "beckn:deliveryAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "customer": { + "name": "Rajesh Kumar", + "email": "rajesh.kumar@example.com" + }, + "meters": [ + { + "meterId": "umid-001", + "utilityId": "utility-example-001" + } + ], + "ders": [] + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "meterOwnershipCredential": { + "credentialId": "vc-meter-ownership-001", + "type": "MeterOwnershipCredential", + "format": "VC-JWT", + "credentialData": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiTWV0ZXJPd25lcnNoaXBDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmV4YW1wbGU6dXNlci0xMjM0NSIsIm1ldGVySWQiOiJ1bWlkLTAwMSIsInV0aWxpdHlJZCI6InV0aWxpdHktZXhhbXBsZS0wMDEiLCJvd25lcnNoaXBTdGF0dXMiOiJPV05FUiIsInZhbGlkRnJvbSI6IjIwMjQtMDEtMDFUMDA6MDA6MDBaIiwidmFsaWRVbnRpbCI6IjIwMjUtMTItMzFUMjM6NTk6NTlaIn19LCJpc3MiOiJkaWQ6ZXhhbXBsZTp1dGlsaXR5LWNyZWRlbnRpYWwtaXNzdWVyIiwiaWF0IjoxNzA0MDY3MjAwfQ.signature", + "verificationUrl": "https://utility-example-001.com/verify/vc-meter-ownership-001" + } + } + } + } +} + +``` +
+ +**Key Fields**: +- `order.orderAttributes.meterOwnershipCredential`: Meter ownership credential (single object) proving ownership of the meter/CA, verified through OTP flow with Utility IdP + - The credential's `verificationUrl` points to the utility's verification endpoint +- `fulfillment.fulfillmentAttributes.credentials[]`: Array of VCs proving program eligibility, DER certifications, etc. +- `fulfillment.fulfillmentAttributes.existingEnrollments[]`: Array of existing enrollment credentials for conflict checking +- Program Owner BPP verifies these credentials and checks for conflicts + +**Note**: Meter ownership credentials are placed in `orderAttributes` because they are meter-specific attributes tied to the order. Program eligibility and DER certification credentials remain in `fulfillmentAttributes.credentials[]` as they relate to fulfillment requirements. + +#### 18.1.4. Example: Prosumer with Solar and Battery + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T11:00:00Z", + "message_id": "msg-init-prosumer-001", + "transaction_id": "txn-onboard-prosumer-001", + "bap_id": "ea-portal.example.com", + "bap_uri": "https://ea-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-prosumer-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-p2p-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:prosumer-789" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-vpp-p2p-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-prosumer-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING", + "beckn:deliveryAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "meters": [ + { + "meterId": "umid-002", + "utilityId": "utility-example-001" + } + ], + "ders": [ + { + "derId": "der-solar-001", + "type": "SOLAR_PV", + "capacityValue": 10.0, + "capacityUnit": "kW" + }, + { + "derId": "der-battery-001", + "type": "BATTERY_STORAGE", + "capacityValue": 15.0, + "capacityUnit": "kWh" + } + ] + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "mobile": "+919876543210", + "userType": "PROSUMER" + }, + "meterOwnershipCredential": { + "credentialId": "vc-meter-ownership-002", + "type": "MeterOwnershipCredential", + "format": "VC-JWT", + "credentialData": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", + "verificationUrl": "https://utility-example-001.com/verify/vc-meter-ownership-002" + } + } + } + } +} + +``` +
+ +### 18.2. On_Init Response + +The BPP verifies the provided credentials and checks for conflicts with existing enrollments. The response includes: + +* **`credentialVerification`**: Results of credential verification (status and verified credentials) +* **`conflictCheck`**: Results of conflict checking with existing enrollments +* **`requiredCredentials`**: List of credential types that are required for enrollment (with status indicating if provided) +* **`requiredConsents`**: List of consent types that are required for enrollment (with indication of which are required vs optional) + +The BPP returns either a rejection (with error) or proceeds to confirm. The `requiredCredentials` and `requiredConsents` inform the BAP/Portal what must be collected before the `confirm` request. + +#### 18.2.1. Example: OTP-Based On_Init Response + +When using OTP authentication, the BPP returns an `nguid` (session token) and expiration time. The user must enter the OTP received via SMS. + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "nguid": "LQUejkRbBL9nJGQiqbComfQ242AHnbG3hnwWdHJut59jqmdJygnVHoiyDcnAUrKm", + "message": "OTP sent to +91XXXXXX9999. Valid for 5 minutes.", + "expiresAt": "2024-10-15T10:35:00Z", + "utilityCustomerId": "CUST-123456" + } + } + } + } +} + +``` +
+ +**Key Fields**: +- `orderAttributes.userAuth.nguid`: Session token for OTP verification +- `orderAttributes.userAuth.message`: Human-readable message about OTP delivery +- `orderAttributes.userAuth.expiresAt`: When the OTP expires + +#### 18.2.2. Example: OAuth2/OIDC-Based On_Init Response + +When using OAuth2/OIDC, the BPP validates the token and returns the user's available meters for selection. + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "verified": true, + "verifiedAt": "2024-10-15T10:30:05Z", + "subject": "user-12345", + "issuer": "https://utility-idp.example.com", + "scope": "openid profile email meter:read", + "expiresAt": "2024-10-15T11:30:00Z", + "message": "Token verified successfully" + }, + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "sanctionedLoad": 5.0, + "connectionType": "residential", + "utilityId": "utility-example-001" + }, + { + "meterId": "umid-002", + "meterNumber": "MTR-987654322", + "sanctionedLoad": 10.0, + "connectionType": "commercial", + "utilityId": "utility-example-001" + } + ], + "requiredConsents": [ + { + "type": "DATA_COLLECTION", + "description": "Consent to collect and share meter data for program participation", + "required": true + }, + { + "type": "DER_CONTROL", + "description": "Consent to control DER devices for demand response (if applicable)", + "required": false + } + ] + } + } + } +} + +``` +
+ +**Key Fields**: +- `orderAttributes.userAuth.verified`: Token validation result +- `orderAttributes.userAuth.subject`: User identifier from token +- `orderAttributes.meters[]`: List of meters belonging to the user for selection + +#### 18.2.3. Example: Successful Verification, No Conflicts + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "credentialVerification": { + "status": "VERIFIED", + "verifiedCredentials": [ + { + "credentialId": "vc-meter-ownership-001", + "status": "VERIFIED", + "verifiedAt": "2024-10-15T10:30:05Z" + }, + { + "credentialId": "vc-program-eligibility-001", + "status": "VERIFIED", + "verifiedAt": "2024-10-15T10:30:05Z" + } + ] + }, + "conflictCheck": { + "hasConflict": false, + "checkedAt": "2024-10-15T10:30:05Z", + "message": "No conflicts found with existing enrollments" + }, + "requiredCredentials": [ + { + "type": "MeterOwnershipCredential", + "description": "Proof of meter ownership verified through utility OTP verification", + "status": "PROVIDED" + }, + { + "type": "ProgramEligibilityCredential", + "description": "Proof of program eligibility based on meter type and location", + "status": "PROVIDED" + } + ], + "requiredConsents": [ + { + "type": "DATA_COLLECTION", + "description": "Consent to collect and share meter data for program participation", + "required": true + }, + { + "type": "DER_CONTROL", + "description": "Consent to control DER devices for demand response (if applicable)", + "required": false + }, + { + "type": "CROSS_UTILITY_SHARING", + "description": "Consent to share data across utilities (if applicable)", + "required": false + } + ] + } + } + } +} + +``` +
+ +#### 18.2.4. Example: Enrollment Conflict Detected + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-conflict-001", + "transaction_id": "txn-onboard-conflict-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-conflict-001", + "beckn:orderStatus": "REJECTED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "credentialVerification": { + "status": "VERIFIED" + }, + "conflictCheck": { + "hasConflict": true, + "conflictingEnrollments": [ + { + "enrollmentId": "enrollment-existing-001", + "programId": "program-flex-other-001", + "conflictReason": "Meter umid-001 is already enrolled in program-flex-other-001 from 2024-09-01 to 2025-09-01", + "conflictType": "METER_ALREADY_ENROLLED" + } + ], + "checkedAt": "2024-10-15T10:30:05Z" + } + } + } + }, + "error": { + "code": "BIZ_ENROLLMENT_CONFLICT", + "message": "Enrollment conflicts with existing enrollment. Meter umid-001 is already enrolled in another program.", + "details": { + "path": "$.message.order.orderAttributes.conflictCheck", + "conflictingEnrollmentId": "enrollment-existing-001", + "conflictEndDate": "2025-09-01T00:00:00Z" + } + } +} + +``` +
+ +### 18.3. Confirm Request + +The confirm request includes the desired enrollment start and end dates, along with any required consents. + +The consents should match the `requiredConsents` specified in the `on_init` response. Each consent indicates: +* `type`: The type of consent (DATA_COLLECTION, DER_CONTROL, CROSS_UTILITY_SHARING) +* `granted`: Boolean indicating if consent was granted +* `grantedAt`: Timestamp when consent was granted +* `description`: Human-readable description of what the consent covers + +#### 18.3.1. Example: OTP-Based Confirm Request + +The confirm request includes the OTP for verification along with the selected meters. + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:33:00Z", + "message_id": "msg-confirm-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "mobile": "+919999999999", + "nguid": "LQUejkRbBL9nJGQiqbComfQ242AHnbG3hnwWdHJut59jqmdJygnVHoiyDcnAUrKm", + "otp": "123456", + "utilityCustomerId": "CUST-123456", + "userType": "CONSUMER" + }, + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z" + } + } + } +} + +``` +
+ +**Key Fields for OTP Flow**: +- `orderAttributes.userAuth.otp`: The OTP entered by the user +- `orderAttributes.userAuth.nguid`: Session token from on_init response +- `orderAttributes.meters[]`: Selected meters for enrollment + +#### 18.3.2. Example: OAuth2/OIDC-Based Confirm Request + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:00Z", + "message_id": "msg-confirm-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEyMzQ1IiwiYXVkIjoicHJvZ3JhbS1vd25lci1icHAiLCJpc3MiOiJodHRwczovL3V0aWxpdHktaWRwLmV4YW1wbGUuY29tIiwiaWF0IjoxNzI5MDAwMDAwLCJleHAiOjE3MjkwMDM2MDB9.signature" + }, + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z" + } + } + } +} + +``` +
+ +**Key Fields for OAuth2 Flow**: +- `orderAttributes.userAuth.accessToken`: OAuth2 access token (for re-validation) +- `orderAttributes.meters[]`: Selected meters from the on_init response + +#### 18.3.3. Example: Confirm with Enrollment Dates + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:00Z", + "message_id": "msg-confirm-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "consents": [ + { + "type": "DATA_COLLECTION", + "granted": true, + "grantedAt": "2024-10-15T10:33:00Z", + "description": "Consent to collect and share meter data for program participation" + }, + { + "type": "DER_CONTROL", + "granted": false, + "description": "Consent to control DER devices for demand response (not applicable for this enrollment)" + } + ] + } + } + } +} + +``` +
+ +### 18.4. On_Confirm Response + +The Program Owner BPP returns a signed Program Enrollment Credential as a Verifiable Credential. **The credential is placed in `fulfillmentAttributes.credential`**, not in `orderAttributes`. The `orderAttributes` contains enrollment metadata (enrollmentId, status, dates, audit logs). + +#### 18.4.1. Example: OTP-Based On_Confirm Response (Success) + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:33:05Z", + "message_id": "msg-on-confirm-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:orderNumber": "ENR-2024-OTP-001234", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "verified": true, + "verifiedAt": "2024-10-15T10:33:05Z", + "message": "OTP verification successful", + "utilityCustomerId": "CUST-123456" + }, + "enrollmentId": "enrollment-otp-001", + "status": "ACTIVE", + "programId": "program-p2p-trading-001", + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "sanctionedLoad": 5.0, + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "enrolledAt": "2024-10-15T10:33:05Z", + "loggedAt": "2024-10-15T10:33:05Z", + "logReference": "log-enrollment-otp-001", + "credential": { + "credentialId": "vc:enrollment:otp-001", + "type": "ProgramEnrollmentCredential", + "format": "VC-JWT", + "credentialUrl": "https://vpp-program-owner.example.com/credentials/vc:enrollment:otp-001", + "verificationUrl": "https://vpp-program-owner.example.com/verify/vc:enrollment:otp-001", + "issuedAt": "2024-10-15T10:33:05Z" + }, + "p2pdetails": { + "usertype": "prosumer", + "isp2pactive": true, + "iscaactive": false, + "meternumber": "MTR-987654321", + "sdload": "5.0", + "cuflimit": "10.0" + } + } + } + } +} + +``` +
+ +**Key Fields**: +- `orderAttributes.userAuth.verified`: Indicates OTP was verified successfully +- `orderAttributes.credential`: The issued Program Enrollment Credential +- `orderAttributes.p2pdetails`: Additional utility-specific details (additionalAttributes) + +#### 18.4.2. Example: OAuth2/OIDC-Based On_Confirm Response (Success) + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:05Z", + "message_id": "msg-on-confirm-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:orderNumber": "ENR-2024-OAUTH-001234", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "verified": true, + "verifiedAt": "2024-10-15T10:35:05Z", + "subject": "user-12345", + "issuer": "https://utility-idp.example.com", + "message": "Token verified successfully" + }, + "enrollmentId": "enrollment-oauth2-001", + "status": "ACTIVE", + "programId": "program-p2p-trading-001", + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "sanctionedLoad": 5.0, + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "enrolledAt": "2024-10-15T10:35:05Z", + "loggedAt": "2024-10-15T10:35:05Z", + "logReference": "log-enrollment-oauth2-001", + "credential": { + "credentialId": "vc:enrollment:oauth2-001", + "type": "ProgramEnrollmentCredential", + "format": "VC-JWT", + "credentialUrl": "https://vpp-program-owner.example.com/credentials/vc:enrollment:oauth2-001", + "verificationUrl": "https://vpp-program-owner.example.com/verify/vc:enrollment:oauth2-001", + "issuedAt": "2024-10-15T10:35:05Z" + }, + "p2pdetails": { + "usertype": "consumer", + "isp2pactive": true, + "iscaactive": false, + "meternumber": "MTR-987654321", + "sdload": "5.0", + "cuflimit": "10.0" + } + } + } + } +} + +``` +
+ +#### 18.4.3. Example: No Meter Specified Error + +When authentication succeeds but no meter is selected, the BPP returns available meters for the user to choose from. + +
Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:05Z", + "message_id": "msg-on-confirm-no-meter-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "FAILED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + } + } + }, + "error": { + "code": "BIZ_NO_METER_SPECIFIED", + "message": "No meter specified for enrollment. Please select from available meters.", + "details": { + "path": "$.message.order.orderAttributes.meters", + "availableMeters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "address": "123 Main Street, Bangalore", + "sanctionedLoad": 5.0, + "connectionType": "residential" + }, + { + "meterId": "umid-002", + "meterNumber": "MTR-987654322", + "address": "456 Oak Avenue, Bangalore", + "sanctionedLoad": 10.0, + "connectionType": "commercial" + } + ] + } + } +} + +``` +
+ +**Key Fields**: +- `error.code`: `BIZ_NO_METER_SPECIFIED` +- `error.details.availableMeters[]`: List of meters the user can select from + +#### 18.4.4. Example: Successful Enrollment with Credential + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:05Z", + "message_id": "msg-on-confirm-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:orderNumber": "ENR-2024-001234", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED", + "beckn:deliveryAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "credential": { + "credentialId": "vc:enrollment:consumer-001", + "type": "ProgramEnrollmentCredential", + "format": "VC-JWT", + "credentialUrl": "https://vpp-program-owner.example.com/credentials/vc:enrollment:consumer-001", + "verificationUrl": "https://vpp-program-owner.example.com/verify/vc:enrollment:consumer-001", + "issuedAt": "2024-10-15T10:35:05Z", + "credentialData": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZ3JhbUVucm9sbG1lbnRDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmV4YW1wbGU6dXNlci0xMjM0NSIsImVucm9sbG1lbnRJZCI6ImVucm9sbG1lbnQtY29uc3VtZXItMDAxIiwicHJvZ3JhbUlkIjoicHJvZ3JhbS1mbGV4LWRlbWFuZC1yZXNwb25zZS0wMDEiLCJtZXRlcnMiOlsidW1pZC0wMDEiXSwic3RhdHVzIjoiQUNUSVZFIiwic3RhcnREYXRlIjoiMjAyNC0xMS0wMVQwMDowMDowMFoiLCJlbmREYXRlIjoiMjAyNS0xMC0zMVQyMzo1OTo1OVoifSwiaXNzdWFuY2VEYXRlIjoiMjAyNC0xMC0xNVQxMDozNTowNVoiLCJleHBpcmF0aW9uRGF0ZSI6IjIwMjUtMTAtMzFUMjM6NTk6NTlaIn0sImlzcyI6ImRpZDpleGFtcGxlOnZwcC1wcm9ncmFtLW93bmVyIiwiaWF0IjoxNzI5MDk3NzA1fQ.signature" + } + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "enrollmentId": "enrollment-consumer-001", + "status": "ACTIVE", + "programId": "program-flex-demand-response-001", + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "enrolledAt": "2024-10-15T10:35:05Z", + "loggedAt": "2024-10-15T10:35:05Z", + "logReference": "log-enrollment-consumer-001" + } + } + } +} + +``` +
+ +**Key Fields**: +- `orderAttributes.startDate`: When enrollment becomes active +- `orderAttributes.endDate`: When enrollment expires +- `orderAttributes.credential`: Signed Verifiable Credential proving enrollment +- `orderAttributes.loggedAt`: Timestamp when enrollment was logged +- `orderAttributes.logReference`: Reference to enrollment log entry + +### 18.5. Error Response Example + +#### 18.5.1. Example: Credential Verification Failed + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-error-001", + "transaction_id": "txn-onboard-error-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-error-001", + "beckn:orderStatus": "REJECTED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + } + } + }, + "error": { + "code": "SEC_CREDENTIAL_VERIFICATION_FAILED", + "message": "Meter ownership credential could not be verified", + "details": { + "path": "$.message.order.orderAttributes.meterOwnershipCredential", + "credentialId": "vc-meter-ownership-001", + "reason": "Invalid signature or expired credential" + } + } +} + +``` +
+ +**Note**: For vocabulary definitions of new terms and slotted attributes, see `outputs_onboarding_guide/Vocabulary_Definitions.md`. + +### 18.6. Consent Revocation + +Users can revoke consent at any time after enrollment. The revocation uses the Beckn `update` action and updates the W3C VC status list to mark the consent credential as revoked. + +#### 18.6.1. Example: Consent Revocation Request + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T14:30:00Z", + "message_id": "msg-update-consent-revoke-001", + "transaction_id": "txn-revoke-consent-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "updateType": "CONSENT_REVOCATION", + "consentRevocation": { + "consentCredentialId": "https://vpp-program-owner.example.com/credentials/vc:consent:consumer-001", + "consentType": "DATA_COLLECTION", + "reason": "USER_REQUESTED", + "revokedAt": "2024-11-20T14:30:00Z", + "effectiveDate": "2024-11-20T14:30:00Z" + } + } + } + } +} + +``` +
+ +**Key Fields**: +- `orderAttributes.updateType`: Set to `CONSENT_REVOCATION` +- `orderAttributes.consentRevocation.consentCredentialId`: ID of the consent VC to revoke +- `orderAttributes.consentRevocation.consentType`: Type of consent being revoked +- `orderAttributes.consentRevocation.reason`: Reason for revocation + +#### 18.6.2. Example: Consent Revocation Response + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T14:30:05Z", + "message_id": "msg-on-update-consent-revoke-001", + "transaction_id": "txn-revoke-consent-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "enrollmentId": "enrollment-consumer-001", + "status": "ACTIVE", + "updateType": "CONSENT_REVOCATION", + "consentRevocation": { + "consentCredentialId": "https://vpp-program-owner.example.com/credentials/vc:consent:consumer-001", + "status": "REVOKED", + "revokedAt": "2024-11-20T14:30:05Z", + "statusListUrl": "https://vpp-program-owner.example.com/status/consent-list", + "statusListIndex": "94567", + "message": "Consent has been revoked and added to revocation status list. Future verifications will fail." + } + } + } + } +} + +``` +
+ +**Key Fields**: +- `orderAttributes.consentRevocation.status`: `REVOKED` when processed +- `orderAttributes.consentRevocation.statusListUrl`: URL of the W3C VC status list +- `orderAttributes.consentRevocation.statusListIndex`: Index in the status list +- Verifiers check this status list to verify if consent is still valid + +### 18.7. Unenrollment + +Users can unenroll from a program at any time. Unenrollment revokes the enrollment credential and optionally all associated consent credentials. + +#### 18.7.1. Example: Unenrollment Request + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T15:00:00Z", + "message_id": "msg-update-unenroll-001", + "transaction_id": "txn-unenroll-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "updateType": "UNENROLLMENT", + "unenrollment": { + "enrollmentId": "enrollment-consumer-001", + "reason": "USER_REQUESTED", + "effectiveDate": "2024-11-20T15:00:00Z", + "revokeAllConsents": true + } + } + } + } +} + +``` +
+ +**Key Fields**: +- `orderAttributes.updateType`: Set to `UNENROLLMENT` +- `orderAttributes.unenrollment.enrollmentId`: ID of the enrollment to cancel +- `orderAttributes.unenrollment.revokeAllConsents`: Whether to revoke all associated consents +- `orderAttributes.unenrollment.effectiveDate`: When the unenrollment becomes effective + +#### 18.7.2. Example: Unenrollment Response + +
+Example json :rocket: + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T15:00:05Z", + "message_id": "msg-on-update-unenroll-001", + "transaction_id": "txn-unenroll-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CANCELLED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CANCELLED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "enrollmentId": "enrollment-consumer-001", + "status": "CANCELLED", + "updateType": "UNENROLLMENT", + "unenrollment": { + "enrollmentId": "enrollment-consumer-001", + "status": "CANCELLED", + "cancelledAt": "2024-11-20T15:00:05Z", + "enrollmentCredentialStatus": { + "statusListUrl": "https://vpp-program-owner.example.com/status/enrollment-list", + "statusListIndex": "12345", + "revoked": true + }, + "consentsRevoked": [ + { + "consentCredentialId": "https://vpp-program-owner.example.com/credentials/vc:consent:consumer-001", + "statusListUrl": "https://vpp-program-owner.example.com/status/consent-list", + "statusListIndex": "94567", + "revoked": true + } + ], + "message": "Enrollment and all associated consents have been revoked. Enrollment credential and consent credentials have been added to revocation status lists." + }, + "loggedAt": "2024-11-20T15:00:05Z", + "logReference": "log-unenrollment-consumer-001" + } + } + } +} + +``` +
+ +**Key Fields**: +- `order.status`: Set to `CANCELLED` +- `orderAttributes.status`: Set to `CANCELLED` +- `orderAttributes.unenrollment.enrollmentCredentialStatus`: Status list details for enrollment VC revocation +- `orderAttributes.unenrollment.consentsRevoked[]`: Array of revoked consent credentials with their status list details +- All credentials are added to W3C VC status lists for verification + +**Revocation Mechanism**: +- BPP updates W3C VC status lists (BitstringStatusList) to mark credentials as revoked +- Verifiers check status lists before accepting credentials +- Status lists use bitstrings for efficient and privacy-preserving revocation checks + +--- + +## 19. Appendix B – Multi-Utility Interaction Patterns + +For cross-utility enrollments (e.g., BTM devices connected to a different utility), the BPP orchestrates authentication with multiple Utility IdPs: + +```mermaid +sequenceDiagram + participant User + participant BAP as UtilityPortal/BAP + participant BPP as Program Owner BPP + participant IDP_A as Utility A IdP + participant IDP_B as Utility B IdP + + Note over User,IDP_B: Cross-Utility OTP Authentication + User->>BAP: Start cross-utility onboarding
(mobile A, mobile B) + + BAP->>BPP: POST /init
orderAttributes.userAuth: {
authMethod: "OTP",
mobile: "+91-A-number"
} + + BPP->>IDP_A: generateOTP(mobile A) + IDP_A->>User: SMS OTP to mobile A + IDP_A-->>BPP: { nguid_A } + + BPP-->>BAP: /on_init { nguid_A, message: "OTP sent to Utility A" } + + User->>BAP: Enter OTP A + BAP->>BPP: POST /confirm (partial)
{ userAuth: { otp_A }, secondaryAuth: { mobile_B } } + + BPP->>IDP_A: verifyOTP(mobile A, otp A) + IDP_A-->>BPP: { verified, meters_A, p2pdetails_A } + + BPP->>IDP_B: generateOTP(mobile B) + IDP_B->>User: SMS OTP to mobile B + IDP_B-->>BPP: { nguid_B } + + BPP-->>BAP: /on_confirm (partial)
{ userAuth_A: verified, nguid_B } + + User->>BAP: Enter OTP B + BAP->>BPP: POST /confirm (final)
{ meters: [...], otp_B } + + BPP->>IDP_B: verifyOTP(mobile B, otp B) + IDP_B-->>BPP: { verified, meters_B, p2pdetails_B } + + BPP->>BPP: Create cross-utility enrollment + BPP-->>BAP: /on_confirm
{ enrollmentId, credential,
additionalAttributes: { p2pdetails_A, p2pdetails_B } } + + BAP-->>User: Cross-utility enrollment successful +``` + +**Note:** The exact multi-utility flow may vary based on implementation. Some utilities may support OAuth2/OIDC tokens instead of OTP. The BPP is responsible for orchestrating authentication with each utility's IdP. + +--- + +## 20. Appendix C – Error Handling Patterns + +Error codes use a three-letter prefix to indicate the error layer: + +| Prefix | Layer | Description | +|--------|-------|-------------| +| `SEC_` | Security | Authentication/authorization failures | +| `BIZ_` | Business | Business rule violations | +| `NET_` | Network | Communication/connectivity issues | +| `SYS_` | System | Internal system errors | + +**Authentication Errors (SEC_):** +* `SEC_OTP_INVALID` - OTP verification failed +* `SEC_OTP_EXPIRED` - OTP/nguid has expired +* `SEC_TOKEN_INVALID` - OAuth2/OIDC token validation failed +* `SEC_TOKEN_EXPIRED` - OAuth2/OIDC token has expired +* `SEC_CREDENTIAL_VERIFICATION_FAILED` - Verifiable Credential validation failed + +**Business Errors (BIZ_):** +* `BIZ_NO_METER_SPECIFIED` - No meter provided in confirm request +* `BIZ_METER_NOT_FOUND` - Specified meter not found in utility system +* `BIZ_ENROLLMENT_CONFLICT` - Meter already enrolled in conflicting program +* `BIZ_DER_NOT_CERTIFIED` - DER certification missing or invalid +* `BIZ_PROGRAM_NOT_AVAILABLE` - Program not available for this meter/utility +* `BIZ_CROSS_UTILITY_CONSENT_REQUIRED` - Cross-utility consent needed +* `BIZ_EA_NOT_CERTIFIED` - Enrollment Agency not certified + +**Example Error Responses:** + +```json +// Authentication Error +{ + "error": { + "code": "SEC_OTP_INVALID", + "message": "OTP verification failed. Please check the OTP and try again.", + "details": { + "path": "$.message.order.orderAttributes.userAuth.otp" + } + } +} +``` + +```json +// No Meter Specified - includes available meters for selection +{ + "error": { + "code": "BIZ_NO_METER_SPECIFIED", + "message": "No meter specified for enrollment. Please select from available meters.", + "details": { + "path": "$.message.order.orderAttributes.meters", + "availableMeters": [ + { "meterId": "umid-001", "meterNumber": "MTR-001", "sanctionedLoad": 5.0 }, + { "meterId": "umid-002", "meterNumber": "MTR-002", "sanctionedLoad": 10.0 } + ] + } + } +} +``` + +Each error must follow Beckn's standard error object structure with `code`, `message`, and optional `details`. The `details.availableMeters` field allows BAP to display user's meters for selection on retry. diff --git a/docs/implementation-guides/v2/P2P_Trading/P2P_Trading_implementation_guide_DRAFT.md b/docs/implementation-guides/v2/P2P_Trading/P2P_Trading_implementation_guide_DRAFT.md index 0a96512c..032a5d32 100644 --- a/docs/implementation-guides/v2/P2P_Trading/P2P_Trading_implementation_guide_DRAFT.md +++ b/docs/implementation-guides/v2/P2P_Trading/P2P_Trading_implementation_guide_DRAFT.md @@ -1,8 +1,6 @@ # P2P Energy Trading Implementation Guide -## Overview - -This implementation guide provides comprehensive instructions for implementing Peer-to-Peer (P2P) Energy Trading using Beckn Protocol v2 with composable schemas. This guide covers all transaction flows, field mappings, best practices, and migration from v1. +Version 0.1 (Non-Normative) ## Table of Contents @@ -11,24 +9,11 @@ This implementation guide provides comprehensive instructions for implementing P - [3. Intended Audience](#3-intended-audience) - [4. Conventions and Terminology](#4-conventions-and-terminology) - [5. Terminology](#5-terminology) -- [6. Mechanics of a P2P energy transaction flow](#6-mechanics-of-a-p2p-energy-transaction-flow) +- [6. Example User Journey](#6-example-user-journey) + - [6.1. Sequence diagram of a P2P transaction](#61-sequence-diagram-of-a-p2p-transaction) - [7. Reference Architecture](#7-reference-architecture) - [7.1. Architecture Diagram](#71-architecture-diagram) - [7.2. Actors](#72-actors) - - [7.3. Beckn Protocol v2 for Energy Trading](#73-beckn-protocol-v2-for-energy-trading) - - [7.4. Schema Overview](#74-schema-overview) - - [7.4.1. EnergyResource (Item.itemAttributes)](#741-energyresource-itemitemattributes) - - [7.4.2. EnergyTradeOffer (Offer.offerAttributes)](#742-energytradeoffer-offerofferattributes) - - [7.4.3. EnergyTradeContract (Order.orderAttributes)](#743-energytradecontract-orderorderattributes) - - [7.4.4. EnergyTradeDelivery (Fulfillment.attributes)](#744-energytradedelivery-fulfillmentattributes) - - [7.5. v2 Composable Schema Architecture](#75-v2-composable-schema-architecture) - - [7.5.1. Schema Composition Points](#751-schema-composition-points) - - [7.6. Implementation Notes](#76-implementation-notes) - - [7.6.1. Key Differences from v1](#761-key-differences-from-v1) - - [7.6.1.1. Discover/Search Request](#7611-discoversearch-request) - - [7.6.1.2. Item Attributes](#7612-item-attributes) - - [7.6.1.3. Order Attributes](#7613-order-attributes) - - [7.6.1.4. Fulfillment Stops](#7614-fulfillment-stops) - [8. Creating an Open Network for Peer to Peer Energy Trading](#8-creating-an-open-network-for-peer-to-peer-energy-trading) - [8.1. Setting up a Registry](#81-setting-up-a-registry) - [8.1.1. For a Network Participant](#811-for-a-network-participant) @@ -45,38 +30,34 @@ This implementation guide provides comprehensive instructions for implementing P - [8.2.1. Installing Beckn ONIX](#821-installing-beckn-onix) - [8.2.2. Configuring Beckn ONIX for Peer to Peer Energy Trading](#822-configuring-beckn-onix-for-peer-to-peer-energy-trading) - [8.2.3. 10.2.3 Performing a test transaction](#823-1023-performing-a-test-transaction) -- [9. Transaction Flows](#9-transaction-flows) - - [9.1. Discover Flow](#91-discover-flow) - - [9.2. Select Flow](#92-select-flow) - - [9.3. Init Flow](#93-init-flow) - - [9.4. Confirm Flow](#94-confirm-flow) - - [9.4.1. Cascaded Init Example (Utility Registration)](#941-cascaded-init-example-utility-registration) - - [9.5. Confirm Flow](#95-confirm-flow) - - [9.6. Status Flow](#96-status-flow) -- [10. Field Mapping Reference](#10-field-mapping-reference) - - [10.1. v1 to v2 Field Mapping](#101-v1-to-v2-field-mapping) - - [10.2. Meter ID Format Migration](#102-meter-id-format-migration) -- [11. Integration Patterns](#11-integration-patterns) - - [11.1. Attaching Attributes to Core Objects](#111-attaching-attributes-to-core-objects) - - [11.2. JSON-LD Context Usage](#112-json-ld-context-usage) - - [11.3. Discovery Filtering](#113-discovery-filtering) -- [12. Best Practices](#12-best-practices) - - [12.1. Discovery Optimization](#121-discovery-optimization) - - [12.2. Meter ID Handling](#122-meter-id-handling) - - [12.3. Settlement Cycle Management](#123-settlement-cycle-management) - - [12.4. Meter Readings](#124-meter-readings) - - [12.5. Telemetry Data](#125-telemetry-data) - - [12.6. Error Handling](#126-error-handling) -- [13. Migration from v1](#13-migration-from-v1) - - [13.1. Key Changes](#131-key-changes) - - [13.2. Migration Checklist](#132-migration-checklist) - - [13.3. Example Migration](#133-example-migration) -- [14. Examples](#14-examples) - - [14.1. Complete Examples](#141-complete-examples) - - [14.2. Example Scenarios](#142-example-scenarios) - - [14.3. Inter energy retailer P2P trading](#143-inter-energy-retailer-p2p-trading) -- [15. Additional Resources](#15-additional-resources) -- [16. Support](#16-support) +- [9. Schema overview](#9-schema-overview) + - [9.1. v2 Composable Schema Architecture](#91-v2-composable-schema-architecture) + - [9.2. Schema Composition Points](#92-schema-composition-points) + - [9.3. EnergyResource (Item.itemAttributes)](#93-energyresource-itemitemattributes) + - [9.4. EnergyTradeOffer (Offer.offerAttributes)](#94-energytradeoffer-offerofferattributes) + - [9.5. EnergyTradeContract (Order.orderAttributes)](#95-energytradecontract-orderorderattributes) + - [9.6. EnergyOrderItem (OrderItem.orderItemAttributes)](#96-energyorderitem-orderitemorderitemattributes) + - [9.7. EnergyTradeDelivery (EnergyOrderItem.fulfillmentAttributes)](#97-energytradedelivery-energyorderitemfulfillmentattributes) +- [10. API Reference \& examples](#10-api-reference--examples) + - [10.1. Discover flow](#101-discover-flow) + - [10.2. Select Flow](#102-select-flow) + - [10.3. Init Flow](#103-init-flow) + - [10.4. Confirm Flow](#104-confirm-flow) + - [10.4.1. Cascaded Init Example (Utility Registration)](#1041-cascaded-init-example-utility-registration) + - [10.5. Confirm Flow](#105-confirm-flow) + - [10.5.1. Cascaded Confirm Example (Utility Trade Logging)](#1051-cascaded-confirm-example-utility-trade-logging) + - [10.6. Status Flow](#106-status-flow) + - [10.6.1. Curtailed Trade Status](#1061-curtailed-trade-status) + - [10.7. Update Flow (Provider-Initiated)](#107-update-flow-provider-initiated) + - [10.7.1. Utility-Initiated Trade Curtailment](#1071-utility-initiated-trade-curtailment) +- [11. Additional Resources](#11-additional-resources) + - [11.1. Inter energy retailer P2P trading](#111-inter-energy-retailer-p2p-trading) +- [12. Additional Resources](#12-additional-resources) + - [12.0.1. **Integrating with your software**](#1201-integrating-with-your-software) + - [12.0.1.1. **Integrating the BAP**](#12011-integrating-the-bap) + - [12.0.1.2. **Integrating the BPP**](#12012-integrating-the-bpp) + - [12.1. FAQs](#121-faqs) + - [12.2. References](#122-references) Table of contents and section auto-numbering was done using [Markdown-All-In-One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one) vscode extension. Specifically `Markdown All in One: Create Table of Contents` and `Markdown All in One: Add/Update section numbers` commands accessible via vs code command pallete. @@ -96,32 +77,9 @@ This document provides an implementation guidance for deploying peer to peer (P2 services using the Beckn Protocol ecosystem. Peer to peer energy trading enables energy producers (prosumers) to directly sell excess energy to consumers. -- Utilities enable such decentralized energy exchange in order to encourage local balancing of - supply & demand, reduce transmission losses, congestion and promote the green energy. -- It can boost the demand when the supply is abundent, say during mid-day solar or nightly wind, - because consumers may find a lower price in a marketplace than the price of importing from utility. -- It could also boost renewable energy supply if producers discover a higher price for it than the utility - export price. -- It can reduce losses for the grid operator if they are obligated to buy back the surplus energy - at a fixed rate which could be higher than the spot price, during solar hours. It also unlocks - new revenue streams for the grid operator as they have full visibility to and can charge - wheeling charges for any peer to peer energy trade happening on their transmission lines. -- Finally, it can increase the cash in-flows for a large prosumer who has accumulated large - credit with the utility due to net-metering policies, but cannot redeem it for cash. -- This achieves beneficial outcomes for producer, consumer and the utility (and in turn redces bills - for other consumers not participating in the trade.) -- Such P2P trade is virtual (non-binding) in the sense that it is made before the delivery hour and is - based on best estimate of load & generation, but the real energy flows may deviate - from the trade contract. But the incentive of a better revenue by - adhereing to the contracted energy flows as well as the cost of deviation cited in contract, - naturally aligns incentives of consumers & producers to deliver the contracted energy flows. -- Each P2P trade contract references a real or a virtual meter, against which the deviations are measured post-facto. - Utility may keep track of the sanctioned (maximum allowed) load or generation at each meter and can limit - the amount of energy trades via a network policy. Physical meters belong to prosumers. - Virtual meters may belong to aggregators and have zero power flows during delivery. - Such aggregators can establish peer to peer relationship - with many producers and consumers and balance pre-delivery supply & demand, since any deviation of net trade - flow away from zero (real power flowing through virtual meter) will be penalized. +Peer-to-peer (P2P) energy trading enables decentralized energy exchange that benefits all participants while strengthening the grid. For consumers, P2P markets offer lower prices during periods of abundant renewable supply (such as mid-day solar or nightly wind), creating demand for supply that might otherwise be curtailed. For producers, these markets may provide higher prices incentivizing the renewable energy generation. Grid operators benefit through reduced transmission losses, local supply-demand balancing, and new revenue streams from wheeling charges on P2P transactions. Additionally, prosumers with accumulated net-metering credits can monetize them through P2P trades, converting credits into cash. These benefits extend beyond direct participants, as reduced grid congestion and improved efficiency ultimately lower costs for all ratepayers. + +P2P trades are executed virtually before the delivery hour based on estimated load and generation, with actual energy flows potentially deviating from contracts. However, the economic incentives, namely better revenue for adhering to contracts and penalties for deviations, naturally align producer and consumer behavior toward delivering contracted energy. Each trade contract references a real or virtual meter for post-delivery deviation measurement, with utilities maintaining visibility and control through network policies that limit trade volumes based on sanctioned load or generation at each meter. Virtual meters enable aggregators to balance supply and demand across multiple participants, as any net deviation from zero flow through these virtual meters incurs penalties, creating a self-regulating mechanism for grid stability. --- @@ -131,7 +89,7 @@ services using the Beckn Protocol ecosystem. Peer to peer energy trading enables * Discovery of energy trading partners. * Some recommendations for BAPs, BPPs and NFOs on how to map protocol API calls to internal systems (or vice-versa). -* Session management and billing coordination between Beckn and OCPI protocols +* Session management and billing coordination between BAP, BPP and the utility BPP. This document does NOT cover: @@ -141,14 +99,15 @@ This document does NOT cover: and apportion the shortfall against it. * Cyber-security and best practices to ensure privacy of market participants by guarding of personally identifiable information data. -* Escrow services to cover the cost trade participant reneging or defaulting on payment. +* Payment guarantees or ACH hold until fulfillment to cover the cost trade participant reneging or defaulting on payment. # 3. Intended Audience -* Consumer Application Developers (BAPs). -* Technology Integrators: Building bridges between existing beckn v1 P2P trading infrastructure and new Beckn v2 based marketplaces -* Business Stakeholders: Understanding technical capabilities and implementation requirements for peer to pee trading strategies -* Standards Organizations: Evaluating interoperability approaches for future energy trading standards development +* Energy Trading Platforms: Platforms that want to participate in P2P trading on behalf of prosumers and consumers +* Technology Integrators: Technology providers building adaptors between existing DERs and applications +* System Architects: Designing scalable, interoperable P2P trading ecosystems +* Business Stakeholders: Understanding technical capabilities and implementation requirements for P2P marketplace strategies +* Standards Organizations: Evaluating interoperability approaches for future P2P standards development # 4. Conventions and Terminology @@ -161,63 +120,99 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S | BAP | Beckn Application Platform | Consumer-facing application that initiates transactions. | | BPP | Beckn Provider Platform | Service provider platform that responds to BAP requests. | | NFO | Network Facilitator Organization | Organization responsible for the adoption and growth of the network. Usually the custodian of the network’s registry. | -| CDS | Catalog Discovery Service | Enables discovery of energy services from BPPs in the network. | +| CDS | Catalog Discovery Service | Enables discovery of energy services from BPPs in the network by providing a cache service for catalogs. | +| MDMS | Meter Data Management System | Platform that enables collection, storage and processing of smart meter data | +| RMS | Revenue Management System | Platform that enables money flows throughout the transaction and post fulfillment | + + +# 6. Example User Journey + +This walkthrough demonstrates a complete P2P energy trading transaction: + +Nisha, who has a large rooftop solar is hoping to get better returns than 3 INR/kwh for the surplus energy mid-day and wants to sell it at 6 INR/kwh. She is eligible to participate and is enrolled as a prosumer in a peer to peer trading app (BPP), which publishes the offer to catalog discovery service (CDS). + +In parallel, nearby, Swati runs a small mill which has a sanctioned load of 20kw. Anticipating large seasonal demand, she is looking to purchase cheaper energy than the utility import price of of 10 INR/kwh between 10am to 6pm for next week. Swati is eligible to participate and is already enrolled as a consumer on a *different* peer to peer energy trading app (BAP), and declares her intent to buy with above price and time of day filters. + +To her delight, the Beckn network helps her *discovers* Nisha's offer of renewable energy at 6 INR/kwh between 12am to 4pm on all days in that week. With wheeling charges of 1 INR/kwh, the total 8 INR/kwh is still 20% cheaper than importing. -> Note: -> This document does not detail the mapping between Beckn Protocol and OCPI. Please refer to [this](../../v1-EOS/DEG00x_Mapping-OCPI-and-Beckn-Protocol-for-EV-Charging-Interoperability.md) document for the same. -> BPPs are NOT aggregators. Any CPO that has implemented a Beckn Protocol endpoint is a BPP. -> For all sense and purposes, CPOs are essentially BPPs and eMSPs are essentially BAPs. +She *initiates* in an order of 20kw. The (BAP) app knows and shares her meter number with the seller's app (BPP), which in turn shares both with the utility BPP which knows the sanctioned import & export for each meter and existing trades. Utility BPP applies a 50% cap policy and replies back saying that upto 10kw of trade is allowed and adds wheeling charges to the quote. It also adds terms & conditions that specify that any underconsumption by Swati will be treated as a spot export by her reimbursed at 3 INR/kwh and any underproduction by solar farm by the farm is treated as a spot import at 10$/kwh. After this Swati *confirms* the 8 INR/kwh final order with her BAP, solar farm BPP in turn cascaded it to utility BPP and utility BPP acknowledges, locks and logs the trade and deducts it from the further trading allowance in those hours for both Swati & Nisha. -# 6. Mechanics of a P2P energy transaction flow +On the delivery day, the floor mill is busy and consumes 400 kwh from the rooftop solar and saves on its +in energy costs. The solar farm gains additional revenue, and utility gets revenue for the upkeep of transmission & to cover the administration cost. Utility BPP sends the final settlement including the wheeling and deviation charges to Swati & the solar farm. Swati pays the solar farm BPP +for the trade itself via her BAP. -This walkthrough demonstrates a complete P2P energy trading transaction: a consumer purchases -10 kWh of solar energy from a producer for grid injection delivery. +## 6.1. Sequence diagram of a P2P transaction + +**Scenario**: Consumer (BAP: `bap.energy-consumer.com`) buys 10 kWh from Producer (BPP: `bpp.energy-provider.com`) on Oct 4, 2025, 10:00 AM - 6:00 PM. Source meter: `100200300`, Target meter: `98765456`. Transaction ID: `txn-energy-001`. -**Scenario**: Consumer (BAP: `bap.energy-consumer.com`) buys 10 kWh from Producer (BPP: `bpp.energy-provider.com`) on Oct 4, 2024, 10:00 AM - 6:00 PM. Source meter: `100200300`, Target meter: `98765456`. Transaction ID: `txn-energy-001`. ```mermaid sequenceDiagram - participant BAP as P2P Trading BAP - participant BPP as P2P Trading BPP - participant Utility as Transmission BPP (Utility) - - Note over BAP, BPP: Standard Init Flow - BAP->>BPP: /init (Initialize Order) - - Note over BPP, Utility: Cascaded Init to Utility - BPP->>Utility: /init (Register Trade & Check Load) - - Note right of Utility: 1. Verify Sanctioned Load
2. Calculate Wheeling Charges - - Utility->>BPP: /on_init (Quote with Wheeling Charges) - - BAP->>BPP: 6. /status (Final check) - BPP-->>BAP: Delivery COMPLETED, 10.0 kWh, SETTLED + participant P2P Trading BAP + participant CDS + participant P2P Trading BPP + participant Utility Company + P2P Trading BPP-->>CDS: upload(Item/Offer changes) + Note over P2P Trading BAP, Utility Company: Opening Bell + P2P Trading BAP->>+CDS: discover + CDS-->>-P2P Trading BAP: on_discover + Note over P2P Trading BAP, P2P Trading BPP: Post-discovery, BAP calls BPP directly for transaction APIs + P2P Trading BAP->>+P2P Trading BPP: select + P2P Trading BPP-->>-P2P Trading BAP: on_select + + P2P Trading BAP->>+P2P Trading BPP: init (Trading Order) + P2P Trading BPP->>+Utility Company: cascaded init (Initialze a delivery order) + Note right of Utility Company: 1. Calculate wheeling charges
2. remaining trading limit + Utility Company-->>-P2P Trading BPP: on_init (Wheeling charges, remaining trading limit etc. ) + P2P Trading BPP-->>-P2P Trading BAP: cascaded_on_init + + P2P Trading BAP->>+P2P Trading BPP: confirm (Trading Order) + P2P Trading BPP->>+Utility Company: cascaded confirm (Initialize a delivery order) + Note right of Utility Company: 1. Log trade
2. Deduct from trading limits. + Utility Company-->>-P2P Trading BPP: on_confirm (remaining trading limit etc. ) + P2P Trading BPP-->>-P2P Trading BAP: on_confirm (Trading Order) + Note over P2P Trading BAP, Utility Company: Closing Bell + + Note over P2P Trading BAP, Utility Company: Fulfillment + Utility Company->> Utility Company: Calculate total actual energy
surplus produced by provider + alt if total produced energy is less than total traded + Utility Company->> Utility Company: Calculate penalty charges
(Will be adjusted in the provider's monthly bill) + else if total produced energy is more than total traded + Utility Company->> Utility Company: Calculate amount to be paid to provider
(Total Surplus - Total Traded ) X Grid buying rate" + end + Utility Company->> Utility Company: Apportion total actual energy
produced in proportion to
energy promised across all trades
on that day before closing bell + loop Send on_update to each consumer(P2P Trading BPP) containing updated order details + Utility Company->>+P2P Trading BPP: on_update (updated Delivery Order details) + end + loop Send cascaded on_update to each P2P Trading BAP containing updated order details + P2P Trading BPP->>+P2P Trading BAP: cascaded on_update (updated Delivery Order details) + end ``` **1. Discover** - Consumer searches for solar energy with JSONPath filters (`sourceType == 'SOLAR'`, `deliveryMode == 'GRID_INJECTION'`, `availableQuantity >= 10.0`). -Request: [discover-request.json](../../../../examples/v2/P2P_Trading/discover-request.json) | Response: [discover-response.json](../../../../examples/v2/P2P_Trading/discover-response.json) +Request: [discover-request.json](../../../../examples/p2p-trading/v2/discover-request.json) | Response: [discover-response.json](../../../../examples/p2p-trading/v2/discover-response.json) *Result: Found `energy-resource-solar-001` at $0.15/kWh, 30.5 kWh available* **2. Select** - Consumer selects item and receives quote breakdown. -Request: [select-request.json](../../../../examples/v2/P2P_Trading/select-request.json) | Response: [select-response.json](../../../../examples/v2/P2P_Trading/select-response.json) +Request: [select-request.json](../../../../examples/p2p-trading/v2/select-request.json) | Response: [select-response.json](../../../../examples/p2p-trading/v2/select-response.json) *Result: Quote $4.00 ($1.50 energy + $2.50 wheeling)* **3. Init** - Consumer provides meter IDs (`100200300` → `98765456`), time window, and payment details. BPP may cascade to Utility for load verification and wheeling charges. -Request: [init-request.json](../../../../examples/v2/P2P_Trading/init-request.json) | Response: [init-response.json](../../../../examples/v2/P2P_Trading/init-response.json) -Cascaded Flow: [cascaded-init-request.json](../../../../examples/v2/P2P_Trading/cascaded-init-request.json) | [cascaded-on-init-response.json](../../../../examples/v2/P2P_Trading/cascaded-on-init-response.json) -*Result: Order initialized, contract PENDING* +Request: [init-request.json](../../../../examples/p2p-trading/v2/init-request.json) | Response: [init-response.json](../../../../examples/p2p-trading/v2/init-response.json) +Cascaded Flow: [cascaded-init-request.json](../../../../examples/p2p-trading/v2/cascaded-init-request.json) | [cascaded-on-init-response.json](../../../../examples/p2p-trading/v2/cascaded-on-init-response.json) +*Result: Order initialized, contract PENDING. Utility BPP responds with wheeling charges in `orderValue.components` and remaining trading limits in `orderAttributes.remainingTradingLimit`.* -**4. Confirm** - Consumer confirms order to activate contract. -Request: [confirm-request.json](../../../../examples/v2/P2P_Trading/confirm-request.json) | Response: [confirm-response.json](../../../../examples/v2/P2P_Trading/confirm-response.json) -*Result: Contract ACTIVE, settlement cycle `settle-2024-10-04-001` created* +**4. Confirm** - Consumer confirms order to activate contract. BPP may cascade to Utility to log the trade and deduct from trading limits. +Request: [confirm-request.json](../../../../examples/p2p-trading/v2/confirm-request.json) | Response: [confirm-response.json](../../../../examples/p2p-trading/v2/confirm-response.json) +Cascaded Flow: [cascaded-confirm-request.json](../../../../examples/p2p-trading/v2/cascaded-confirm-request.json) | [cascaded-on-confirm-response.json](../../../../examples/p2p-trading/v2/cascaded-on-confirm-response.json) +*Result: Contract ACTIVE, settlement cycle `settle-2024-10-04-001` created. Utility BPP logs trade and responds with updated remaining trading limits in `orderAttributes.remainingTradingLimit`.* **5. Status (In Progress)** - Consumer monitors delivery progress. BPP updates meter readings and telemetry every 15-30 minutes. -Request: [status-request.json](../../../../examples/v2/P2P_Trading/status-request.json) | Response: [status-response.json](../../../../examples/v2/P2P_Trading/status-response.json) +Request: [status-request.json](../../../../examples/p2p-trading/v2/status-request.json) | Response: [status-response.json](../../../../examples/p2p-trading/v2/status-response.json) *Result: Delivery IN_PROGRESS, 9.8 kWh delivered (98%), real-time telemetry* **6. Status (Completed)** - Consumer checks final status after delivery completion. -Response: [status-response-completed.json](../../../../examples/v2/P2P_Trading/status-response-completed.json) +Response: [status-response-completed.json](../../../../examples/p2p-trading/v2/status-response-completed.json) *Result: Delivery COMPLETED, 10.0 kWh delivered, settlement SETTLED ($4.00)* **Summary**: Transaction completed in ~8.5 hours. 10.0 kWh delivered. Total cost $4.00. Daily settlement cycle processed. @@ -229,20 +224,138 @@ The section defines the reference ecosystem architecture that is used for buildi ## 7.1. Architecture Diagram -![](../assets/beckn-one-deg-arch.png) + +TBD ## 7.2. Actors -1. Beckn One Global Root Registry -2. Beckn One Catalog Discovery Service -3. Beckn Application Platforms -4. Beckn Provider Platforms -5. Peer to Peer trading Registry +1. Prosumers and consumers with smart meters. +2. Beckn One Global Root Registry +3. Beckn One Catalog Discovery Service +4. Beckn Application Platforms +5. Beckn Provider Platforms +6. Peer to Peer trading Registry + +TODO: Explain the role of each entity in detail for P2P trading, and whether they are required or optional and API interface to them. + + +# 8. Creating an Open Network for Peer to Peer Energy Trading + +TODO: move this section into a seperate `../core_spec/` folder, and reference from there in implementation guides of EV charging, P2P tradig etc. + +To create an open network for energy trading requires all the producers, prosumers and consumers BAPs, BPPs, to be able to discover each other and become part of a common club. This club is manifested in the form of a Registry maintained by an NFO. + +## 8.1. Setting up a Registry + +The NP Registry serves as the root of addressability and trust for all network participants. It maintains comprehensive details such as the participant’s globally unique identifier (ID), network address (Beckn API URL), public key, operational domains, and assigned role (e.g., BAP, BPP, CDS). In addition to managing participant registration, authentication, authorization, and permission control, the Registry oversees participant verification, activation, and overall lifecycle management, ensuring that only validated and authorized entities can operate within the network. + +![](../assets/registry-arch.png) + +You can publish your registries at [DeDi.global](https://publish.dedi.global/). + +### 8.1.1. For a Network Participant + +#### 8.1.1.1. Step 1 : Claiming a Namespace + +To get started, any platform that has implemented Beckn Protocol MUST create a globally unique namespace for themselves. +All NPs (BAPs, BPPs, CDS’es) **MUST** register as a user on dedi.global and claim a unique namespace against their FQDN to become globally addressable. As part of the claiming process, the user must prove ownership of the namespace by verifying the ownership of their domain. Namespace would be at an organisation level. You can put your organisation name as the name of the namespace. + +#### 8.1.1.2. Step 2 : Setting up a Registry + +Once the namespace is claimed, each NP **MUST** create a Beckn NP registry in the namespace to list their subscriber details. While creating the registry, the user **MUST** configure it with the [subscriber schema](https://gist.githubusercontent.com/nirmalnr/a6e5b17522169ecea4f3ccdd831af7e4/raw/7744f2542034db9675901b61b41c8228ea239074/beckn-subscriber-no-refs.schema.json). Example of a registry name can be `subscription-details`. + +#### 8.1.1.3. Step 3 : Publishing subscriber details + +In the registry that is created, NPs **MUST** publish their subscription details including their ID, network endpoints, public keys, operational domains and assigned roles (BAP, BPP) as records. + +*Detailed steps to create namespaces and registries in dedi.global can be found [here](https://github.com/dedi-global/docs/blob/0976607aabc6641d330a3d41a3bd89ab8790ea09/user-guides/namespace%20and%20registry%20creation.md).* + +### 8.1.2. Step 4 : Share details of the registry created with the Beckn One team + +Once the registry is created and details are published, the namespace and the registry name of the newly created registry should be shared with the beckn one team. + +### 8.1.3. For a Network facilitator organization + +#### 8.1.3.1. Step 1 : Claiming a Namespace + +An NFO **MAY** register as a user on dedi.global and claim a unique namespace against their FQDN. As part of the claiming process, the user must prove ownership of that namespace by verifying the ownership of that domain. The NFO name can be set as the name of the namespace. +*Note: A calibrated roll out of this infrastructure is planned and hence before it is open to the general public NFOs are advised to share their own domain and the domains of their NPs to the Beckn One team so that they can be whitelisted which will allow the NPs to verify the same using TXT records in their DNS.* + +#### 8.1.3.2. Step 2 : Setting up a Registry + +Network facilitators **MAY** create registries under their own namespace using the [subscriber reference schema](https://gist.githubusercontent.com/nirmalnr/a6e5b17522169ecea4f3ccdd831af7e4/raw/b7cf8a47e6531ef22744b43e6305b8d8cc106e7b/beckn-subscriber-reference.schema.json) to point to either whole registries or records created by the NPs in their own namespaces. Example of a registry name can be `subscription-details`. + +#### 8.1.3.3. Step 3 : Publishing subscriber details + +In the registry that is created, NFOs **MAY** publish records which act as pointers to either whole registries or records created by the NPs records. The URL field in the record would be the lookup URL for a registry or a record as per DeDi protocol. + +Example: For referencing another registry created by an NP, the record details created would be: + +```json +{ + "url": "https://.dedi.global/dedi/lookup/example-company/subscription-details", + "type": "Registry", + "subscriber_id": "example-company.com" +} +``` + +Here `example-company` is the namespace of the NP, and all records added in the registry is referenced here. + +If only one record in the registry needs to be referenced, then the record details created would be: + +```json +{ + "url": "https://.dedi.global/dedi/lookup/example-company/subscription-details/energy-bap", + "type": "Record", + "subscriber_id": "example-company.com" +} +``` + +Here `energy-bap` is the name of the record created by the NP in this registry. Only that record is referenced here. + +*Detailed steps to create namespaces and registries in dedi.global can be found [here](https://github.com/dedi-global/docs/blob/0976607aabc6641d330a3d41a3bd89ab8790ea09/user-guides/namespace%20and%20registry%20creation.md).* + +#### 8.1.3.4. Step 4 : Share details of the registry created with the Beckn One team + +Once the registry is created and details are published, the namespace and the registry name of the newly created registry should be shared with the beckn one team. + +## 8.2. Setting up the Protocol Endpoints + +This section contains instructions to set up and test the protocol stack for transactions. + +### 8.2.1. Installing Beckn ONIX + +All NPs SHOULD install the Beckn ONIX adapter to quickly get set up and become Beckn Protocol compliant. Click [here](https://github.com/Beckn-One/beckn-onix?tab=readme-ov-file#automated-setup-recommended)) to learn how to set up Beckn ONIX. + +### 8.2.2. Configuring Beckn ONIX for Peer to Peer Energy Trading + +A detailed Configuration Guide is available [here](https://github.com/Beckn-One/beckn-onix/blob/main/CONFIG.md). A quick read of key concepts from the link is recommended. + +Specifically, please use the following configuration: +1. Configure dediregistry plugin instead of registry plugin. Read more [here](https://github.com/Beckn-One/beckn-onix/tree/main/pkg/plugin/implementation/dediregistry). +2. Start with using Simplekeymanager plugin during development, read more [here](https://github.com/Beckn-One/beckn-onix/tree/main/pkg/plugin/implementation/simplekeymanager). For production deployment, you may setup vault. +3. For routing calls to Catalog Discovery Service, refer to routing configuration [here](https://github.com/Beckn-One/beckn-onix/blob/main/config/local-simple-routing-BAPCaller.yaml). + +### 8.2.3. 10.2.3 Performing a test transaction + +Step 1 : Download the postman collection, from [here](/testnet/p2p-trading-devkit/postman). + +Step 2 : Run API calls + +If you are a BAP + +1. Configure the collection/environment variables to the newly installed Beckn ONIX adapter URL and other variables in the collection. +2. Select the discover example and hit send +3. You should see the service catalog response + +If you are a BPP ----- +1. Configure the collection/environment variables to the newly installed Beckn ONIX adapter URL and other variables in the collection. +2. Select the on_status example and hit send +3. You should see the response in your console -## 7.3. Beckn Protocol v2 for Energy Trading +# 9. Schema overview Beckn Protocol v2 provides a composable schema architecture that enables: - **Modular Attribute Bundles**: Energy-specific attributes attached to core Beckn objects @@ -250,9 +363,35 @@ Beckn Protocol v2 provides a composable schema architecture that enables: - **Standards Alignment**: Integration with IEEE 2030.5 (mRID), OCPP, OCPI - **Flexible Discovery**: Meter-based discovery and filtering -## 7.4. Schema Overview +## 9.1. v2 Composable Schema Architecture + +``` +┌─────────────────────────────────────────────────────────┐ +│ Core Beckn Objects │ +│ Item | Offer | Order | Fulfillment | Provider │ +└─────────────────────────────────────────────────────────┘ + │ + │ Attach Attributes + ▼ +┌─────────────────────────────────────────────────────────┐ +│ Energy* Attribute Bundles │ +│ EnergyResource | EnergyTradeOffer | EnergyTradeContract │ +│ EnergyTradeDelivery │ +└─────────────────────────────────────────────────────────┘ +``` + +## 9.2. Schema Composition Points + +| Attribute Bundle | Attach To | Purpose | +| ----------------------- | ------------------------ | ---------------------------------------------------------------------------------- | +| **EnergyResource** | `Item.itemAttributes` | Energy source characteristics (source type, delivery mode, meter ID, availability) | +| **EnergyTradeOffer** | `Offer.offerAttributes` | Pricing models, settlement types, wheeling charges, validity windows | +| **EnergyTradeContract** | `Order.orderAttributes` | Contract status, meter IDs, settlement cycles, billing cycles | +| **EnergyOrderItem** | `OrderItem.orderItemAttributes` | Wrapper containing customerAttributes and optional fulfillmentAttributes | +| **EnergyTradeDelivery** | `EnergyOrderItem.fulfillmentAttributes` | Per-orderItem delivery status, meter readings with time windows, energy allocation | + -### 7.4.1. EnergyResource (Item.itemAttributes) +## 9.3. EnergyResource (Item.itemAttributes) **Purpose**: Describes tradable energy resources @@ -267,7 +406,7 @@ Beckn Protocol v2 provides a composable schema architecture that enables: **Example**: ```json { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyResource/v0.2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/EnergyResource/v0.2/context.jsonld", "@type": "EnergyResource", "sourceType": "SOLAR", "deliveryMode": "GRID_INJECTION", @@ -280,7 +419,7 @@ Beckn Protocol v2 provides a composable schema architecture that enables: } ``` -### 7.4.2. EnergyTradeOffer (Offer.offerAttributes) +## 9.4. EnergyTradeOffer (Offer.offerAttributes) **Purpose**: Defines pricing and settlement terms for energy trades @@ -295,7 +434,7 @@ Beckn Protocol v2 provides a composable schema architecture that enables: **Example**: ```json { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/EnergyTradeOffer/v0.2/context.jsonld", "@type": "EnergyTradeOffer", "pricingModel": "PER_KWH", "settlementType": "DAILY", @@ -309,7 +448,7 @@ Beckn Protocol v2 provides a composable schema architecture that enables: } ``` -### 7.4.3. EnergyTradeContract (Order.orderAttributes) +## 9.5. EnergyTradeContract (Order.orderAttributes) **Purpose**: Tracks commercial agreements and contract lifecycle @@ -325,7 +464,7 @@ Beckn Protocol v2 provides a composable schema architecture that enables: **Example**: ```json { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/EnergyTradeContract/v0.2/context.jsonld", "@type": "EnergyTradeContract", "contractStatus": "ACTIVE", "sourceMeterId": "100200300", @@ -336,447 +475,183 @@ Beckn Protocol v2 provides a composable schema architecture that enables: } ``` -### 7.4.4. EnergyTradeDelivery (Fulfillment.attributes) +## 9.6. EnergyOrderItem (OrderItem.orderItemAttributes) -**Purpose**: Tracks physical energy transfer and delivery status +**Purpose**: Wrapper schema for per-orderItem attributes containing customer information and optional fulfillment tracking + +**Location**: `beckn:orderItemAttributes` **Key Attributes**: -- `deliveryStatus`: PENDING, IN_PROGRESS, COMPLETED, FAILED -- `deliveryMode`: EV_CHARGING, BATTERY_SWAP, V2G, GRID_INJECTION -- `deliveredQuantity`: Quantity delivered in kWh -- `meterReadings`: Array of meter readings (source, target, energy flow) -- `telemetry`: Energy flow telemetry (ENERGY, POWER, VOLTAGE, etc.) -- `settlementCycleId`: Link to settlement cycle +- `customerAttributes`: Contains EnergyCustomer schema with customer meter and utility info (always required) +- `fulfillmentAttributes`: Contains EnergyTradeDelivery schema with delivery tracking (only in on_status/on_update) **Example**: ```json { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeDelivery/v0.2/context.jsonld", - "@type": "EnergyTradeDelivery", - "deliveryStatus": "IN_PROGRESS", - "deliveryMode": "GRID_INJECTION", - "deliveredQuantity": 9.8, - "meterReadings": [ - { - "timestamp": "2024-10-04T12:00:00Z", - "sourceReading": 1000.5, - "targetReading": 990.3, - "energyFlow": 10.2 + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "customerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 7.5, + "meterReadings": [...], + "lastUpdated": "2024-10-04T15:00:00Z" } - ], - "telemetry": [...] + } } ``` +## 9.7. EnergyTradeDelivery (EnergyOrderItem.fulfillmentAttributes) -## 7.5. v2 Composable Schema Architecture +**Purpose**: Tracks physical energy transfer and delivery status per orderItem -``` -┌─────────────────────────────────────────────────────────┐ -│ Core Beckn Objects │ -│ Item | Offer | Order | Fulfillment | Provider │ -└─────────────────────────────────────────────────────────┘ - │ - │ Attach Attributes - ▼ -┌─────────────────────────────────────────────────────────┐ -│ Energy* Attribute Bundles │ -│ EnergyResource | EnergyTradeOffer | EnergyTradeContract │ -│ EnergyTradeDelivery │ -└─────────────────────────────────────────────────────────┘ -``` +**Location**: Nested within `beckn:orderItemAttributes.fulfillmentAttributes` (not at top-level Order) -### 7.5.1. Schema Composition Points +**When Populated**: Only in `on_status` and `on_update` responses. NOT present in init/confirm flows. -| Attribute Bundle | Attach To | Purpose | -| ----------------------- | ------------------------ | ---------------------------------------------------------------------------------- | -| **EnergyResource** | `Item.itemAttributes` | Energy source characteristics (source type, delivery mode, meter ID, availability) | -| **EnergyTradeOffer** | `Offer.offerAttributes` | Pricing models, settlement types, wheeling charges, validity windows | -| **EnergyTradeContract** | `Order.orderAttributes` | Contract status, meter IDs, settlement cycles, billing cycles | -| **EnergyTradeDelivery** | `Fulfillment.attributes` | Delivery status, meter readings, telemetry, settlement linkage | +**Key Attributes**: +- `deliveryStatus`: PENDING, IN_PROGRESS, COMPLETED, FAILED +- `deliveryMode`: EV_CHARGING, BATTERY_SWAP, V2G, GRID_INJECTION +- `deliveredQuantity`: Total quantity delivered so far in kWh +- `meterReadings`: Array of meter readings with time windows (see below) +- `curtailedQuantity`: Optional, quantity curtailed from contract (kWh) +- `curtailmentReason`: Optional, reason code (GRID_OUTAGE, EMERGENCY, CONGESTION, MAINTENANCE, OTHER) +- `lastUpdated`: UTC timestamp of last update -## 7.6. Implementation Notes +**Meter Readings Structure** (IEC 61968/ESPI compliant): +```json +{ + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "deliveredEnergy": 0.0, // Energy TO customer (imported from grid) - ESPI flowDirection=1 + "receivedEnergy": 7.5, // Energy FROM customer (exported to grid) - ESPI flowDirection=19 + "allocatedEnergy": 7.5, // Net energy allocated for this trade + "unit": "kWh" +} +``` -**For BAP Implementers**: -1. **Discovery**: Use JSONPath filters to search by energy attributes (sourceType, deliveryMode, availableQuantity, productionWindow) -2. **Order Management**: Track order state through PENDING → ACTIVE → COMPLETED -3. **Status Polling**: Poll status endpoint every 15-30 minutes during active delivery -4. **Error Handling**: Handle cases where delivery fails or quantities don't match -5. **Settlement**: Monitor settlement cycle status for payment processing +**Example** (within EnergyOrderItem.fulfillmentAttributes): +```json +{ + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "customerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 7.5, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "deliveredEnergy": 0.0, + "receivedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T15:00:00Z" + } + } +} +``` -**For BPP Implementers**: -1. **Catalog Management**: Keep catalog updated with available energy and accurate production windows -2. **Meter Readings**: Update meter readings regularly during delivery (every 15-30 minutes) -3. **Telemetry**: Provide real-time telemetry data for monitoring -4. **Settlement**: Calculate settlement amounts based on delivered quantity and pricing model -5. **State Management**: Properly transition contract and delivery statuses +**Note**: Top-level `beckn:fulfillment` is no longer used for energy delivery tracking. Each orderItem tracks its own fulfillment independently via `fulfillmentAttributes`. -**Common Patterns**: -- **Idempotency**: Use transaction_id consistently across all requests -- **Time Windows**: Validate production windows and trade time windows -- **Meter IDs**: Always use IEEE mRID format (plain numeric ID, not `der://` format) -- **Quantity Validation**: Ensure delivered quantity matches contracted quantity (within tolerance) +# 10. API Reference & examples -### 7.6.1. Key Differences from v1 +## 10.1. Discover flow -| Aspect | v1 (Layer2) | v2 (Composable) | -| ---------------------- | ------------------- | ---------------------------- | -| **Schema Extension** | `allOf` in paths | Composable attribute bundles | -| **Attribute Location** | `Item.attributes.*` | `Item.itemAttributes.*` | -| **Meter Format** | `der://meter/{id}` | IEEE 2030.5 mRID `{id}` | -| **JSON-LD** | Not used | Full JSON-LD support | -| **Modularity** | Monolithic | Modular bundles | +**Purpose**: Search for available energy resources +**Endpoint**: `POST /discover` -For developers familiar with v1, here's a quick mapping guide: +**v1 to v2 Mapping**: +- v1 `message.intent.item.quantity.selected.measure` → v2 `message.filters.expression` (JSONPath filter on `availableQuantity`) +- v1 `message.intent.fulfillment.stops[].time.range.start` → v2 `message.filters.expression` (JSONPath filter on `productionWindow.start`) +- v1 `message.intent.fulfillment.stops[].time.range.end` → v2 `message.filters.expression` (JSONPath filter on `productionWindow.end`) +- **Note**: v2 does not support `intent` object. All search parameters are expressed via JSONPath filters. -#### 7.6.1.1. Discover/Search Request +
+Request Example -**v1 Format**: ```json { - "message": { - "intent": { - "item": { - "quantity": { - "selected": { - "measure": { - "value": "10", - "unit": "kWH" - } - } - } + "context": { + "version": "2.0.0", + "action": "discover", + "timestamp": "2024-10-04T10:00:00Z", + "message_id": "msg-discover-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0", + "location": { + "city": { + "code": "BLR", + "name": "Bangalore" }, - "fulfillment": { - "stops": [{ - "type": "end", - "location": { - "address": "der://uppcl.meter/98765456" - }, - "time": { - "range": { - "start": "2024-10-04T10:00:00", - "end": "2024-10-04T18:00:00" - } - } - }] + "country": { + "code": "IND", + "name": "India" } - } - } -} -``` - -**v2 Format** (No intent object - uses JSONPath filters): -```json -{ + }, + "schema_context": [ + "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyResource/v0.2/context.jsonld" + ] + }, "message": { - "text_search": "solar energy grid injection", "filters": { "type": "jsonpath", - "expression": "$[?(@.itemAttributes.sourceType == 'SOLAR' && @.itemAttributes.deliveryMode == 'GRID_INJECTION' && @.itemAttributes.availableQuantity >= 10.0 && @.itemAttributes.productionWindow.start <= '2024-10-04T10:00:00Z' && @.itemAttributes.productionWindow.end >= '2024-10-04T18:00:00Z')]" + "expression": "$[?('p2p-trading-pilot-network' == @.beckn:networkId && @.beckn:itemAttributes.sourceType == 'SOLAR' && @.beckn:itemAttributes.deliveryMode == 'GRID_INJECTION' && @.beckn:itemAttributes.availableQuantity >= 10.0 )]" } } } -``` -**Changes**: -- ❌ **Removed**: `intent` object is not supported in v2 discover API -- ✅ **Quantity**: v1 `intent.item.quantity.selected.measure.value` → v2 `filters.expression` with `availableQuantity >= 10.0` -- ✅ **Time Range**: v1 `intent.fulfillment.stops[].time.range` → v2 `filters.expression` with `productionWindow.start <= '...' && productionWindow.end >= '...'` -- ✅ **All Parameters**: Expressed via JSONPath filters in v2 +``` +
-#### 7.6.1.2. Item Attributes +
Immediate successful Response -**v1 Format**: ```json { - "Item": { - "attributes": { - "sourceType": "SOLAR", - "meterId": "der://meter/100200300", - "availableQuantity": 30.5 - } - } + "ack_status": "ACK", + "timestamp": "2025-10-14T07:31:05Z" } ``` +
+ + +
+Async Response Example: `on_discover` -**v2 Format**: -```json -{ - "@type": "beckn:Item", - "beckn:itemAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyResource/v0.2/context.jsonld", - "@type": "EnergyResource", - "sourceType": "SOLAR", - "meterId": "100200300", - "availableQuantity": 30.5 - } -} -``` - -**Changes**: -- ⚠️ Path: `Item.attributes.*` → `beckn:itemAttributes.*` -- ⚠️ Meter format: `der://meter/100200300` → `100200300` -- ➕ Add `@context` and `@type` for JSON-LD - -#### 7.6.1.3. Order Attributes - -**v1 Format**: -```json -{ - "Order": { - "attributes": { - "sourceMeterId": "der://pge.meter/100200300", - "targetMeterId": "der://ssf.meter/98765456", - "contractStatus": "ACTIVE" - } - } -} -``` - -**v2 Format**: -```json -{ - "@type": "beckn:Order", - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "contractStatus": "ACTIVE" - } -} -``` - -**Changes**: -- ⚠️ Path: `Order.attributes.*` → `beckn:orderAttributes.*` -- ⚠️ Meter format: `der://pge.meter/100200300` → `100200300` -- ➕ Add `@context` and `@type` for JSON-LD - -#### 7.6.1.4. Fulfillment Stops - -**v1 Format**: -```json -{ - "Fulfillment": { - "stops": [{ - "type": "start", - "location": { - "address": "der://uppcl.meter/92982739" - } - }, { - "type": "end", - "location": { - "address": "der://uppcl.meter/98765456" - } - }] - } -} -``` - -**v2 Format**: -```json -{ - "@type": "beckn:Fulfillment", - "beckn:stops": [{ - "@type": "beckn:Stop", - "beckn:type": "START", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "92982739" - } - }, { - "@type": "beckn:Stop", - "beckn:type": "END", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "98765456" - } - }] -} -``` - -**Changes**: -- ⚠️ Meter format: `der://uppcl.meter/92982739` → `92982739` -- ⚠️ Type case: `"start"` → `"START"`, `"end"` → `"END"` -- ➕ Add `@type` for JSON-LD - - - -# 8. Creating an Open Network for Peer to Peer Energy Trading - -To create an open network for energy trading requires all the producers, prosumers and consumers BAPs, BPPs, to be able to discover each other and become part of a common club. This club is manifested in the form of a Registry maintained by an NFO. - -## 8.1. Setting up a Registry - -The NP Registry serves as the root of addressability and trust for all network participants. It maintains comprehensive details such as the participant’s globally unique identifier (ID), network address (Beckn API URL), public key, operational domains, and assigned role (e.g., BAP, BPP, CDS). In addition to managing participant registration, authentication, authorization, and permission control, the Registry oversees participant verification, activation, and overall lifecycle management, ensuring that only validated and authorized entities can operate within the network. - -![](../assets/registry-arch.png) - -You can publish your registries at [DeDi.global](https://publish.dedi.global/). - -### 8.1.1. For a Network Participant - -#### 8.1.1.1. Step 1 : Claiming a Namespace - -To get started, any platform that has implemented Beckn Protocol MUST create a globally unique namespace for themselves. -All NPs (BAPs, BPPs, CDS’es) **MUST** register as a user on dedi.global and claim a unique namespace against their FQDN to become globally addressable. As part of the claiming process, the user must prove ownership of the namespace by verifying the ownership of their domain. Namespace would be at an organisation level. You can put your organisation name as the name of the namespace. - -#### 8.1.1.2. Step 2 : Setting up a Registry - -Once the namespace is claimed, each NP **MUST** create a Beckn NP registry in the namespace to list their subscriber details. While creating the registry, the user **MUST** configure it with the [subscriber schema](https://gist.githubusercontent.com/nirmalnr/a6e5b17522169ecea4f3ccdd831af7e4/raw/7744f2542034db9675901b61b41c8228ea239074/beckn-subscriber-no-refs.schema.json). Example of a registry name can be `subscription-details`. - -#### 8.1.1.3. Step 3 : Publishing subscriber details - -In the registry that is created, NPs **MUST** publish their subscription details including their ID, network endpoints, public keys, operational domains and assigned roles (BAP, BPP) as records. - -*Detailed steps to create namespaces and registries in dedi.global can be found [here](https://github.com/dedi-global/docs/blob/0976607aabc6641d330a3d41a3bd89ab8790ea09/user-guides/namespace%20and%20registry%20creation.md).* - -### 8.1.2. Step 4 : Share details of the registry created with the Beckn One team - -Once the registry is created and details are published, the namespace and the registry name of the newly created registry should be shared with the beckn one team. - -### 8.1.3. For a Network facilitator organization - -#### 8.1.3.1. Step 1 : Claiming a Namespace - -An NFO **MAY** register as a user on dedi.global and claim a unique namespace against their FQDN. As part of the claiming process, the user must prove ownership of that namespace by verifying the ownership of that domain. The NFO name can be set as the name of the namespace. -*Note: A calibrated roll out of this infrastructure is planned and hence before it is open to the general public NFOs are advised to share their own domain and the domains of their NPs to the Beckn One team so that they can be whitelisted which will allow the NPs to verify the same using TXT records in their DNS.* - -#### 8.1.3.2. Step 2 : Setting up a Registry - -Network facilitators **MAY** create registries under their own namespace using the [subscriber reference schema](https://gist.githubusercontent.com/nirmalnr/a6e5b17522169ecea4f3ccdd831af7e4/raw/b7cf8a47e6531ef22744b43e6305b8d8cc106e7b/beckn-subscriber-reference.schema.json) to point to either whole registries or records created by the NPs in their own namespaces. Example of a registry name can be `subscription-details`. - -#### 8.1.3.3. Step 3 : Publishing subscriber details - -In the registry that is created, NFOs **MAY** publish records which act as pointers to either whole registries or records created by the NPs records. The URL field in the record would be the lookup URL for a registry or a record as per DeDi protocol. - -Example: For referencing another registry created by an NP, the record details created would be: - -```json -{ - "url": "https://.dedi.global/dedi/lookup/example-company/subscription-details", - "type": "Registry", - "subscriber_id": "example-company.com" -} -``` - -Here `example-company` is the namespace of the NP, and all records added in the registry is referenced here. - -If only one record in the registry needs to be referenced, then the record details created would be: - -```json -{ - "url": "https://.dedi.global/dedi/lookup/example-company/subscription-details/energy-bap", - "type": "Record", - "subscriber_id": "example-company.com" -} -``` - -Here `energy-bap` is the name of the record created by the NP in this registry. Only that record is referenced here. - -*Detailed steps to create namespaces and registries in dedi.global can be found [here](https://github.com/dedi-global/docs/blob/0976607aabc6641d330a3d41a3bd89ab8790ea09/user-guides/namespace%20and%20registry%20creation.md).* - -#### 8.1.3.4. Step 4 : Share details of the registry created with the Beckn One team - -Once the registry is created and details are published, the namespace and the registry name of the newly created registry should be shared with the beckn one team. - -## 8.2. Setting up the Protocol Endpoints - -This section contains instructions to set up and test the protocol stack for transactions. - -### 8.2.1. Installing Beckn ONIX - -All NPs SHOULD install the Beckn ONIX adapter to quickly get set up and become Beckn Protocol compliant. Click [here](https://github.com/Beckn-One/beckn-onix?tab=readme-ov-file#automated-setup-recommended)) to learn how to set up Beckn ONIX. - -### 8.2.2. Configuring Beckn ONIX for Peer to Peer Energy Trading - -A detailed Configuration Guide is available [here](https://github.com/Beckn-One/beckn-onix/blob/main/CONFIG.md). A quick read of key concepts from the link is recommended. - -Specifically, please use the following configuration: -1. Configure dediregistry plugin instead of registry plugin. Read more [here](https://github.com/Beckn-One/beckn-onix/tree/main/pkg/plugin/implementation/dediregistry). -2. Start with using Simplekeymanager plugin during development, read more [here](https://github.com/Beckn-One/beckn-onix/tree/main/pkg/plugin/implementation/simplekeymanager). For production deployment, you may setup vault. -3. For routing calls to Catalog Discovery Service, refer to routing configuration [here](https://github.com/Beckn-One/beckn-onix/blob/main/config/local-simple-routing-BAPCaller.yaml). - -### 8.2.3. 10.2.3 Performing a test transaction - -Step 1 : Download the postman collection, from [here](/testnet/postman-collections/v2/P2P_Trading). - -Step 2 : Run API calls - -If you are a BAP - -1. Configure the collection/environment variables to the newly installed Beckn ONIX adapter URL and other variables in the collection. -2. Select the discover example and hit send -3. You should see the service catalog response - -If you are a BPP - -1. Configure the collection/environment variables to the newly installed Beckn ONIX adapter URL and other variables in the collection. -2. Select the on_status example and hit send -3. You should see the response in your console - ---- - -# 9. Transaction Flows - -## 9.1. Discover Flow - -**Purpose**: Search for available energy resources - -**Endpoint**: `POST /discover` - -**v1 to v2 Mapping**: -- v1 `message.intent.item.quantity.selected.measure` → v2 `message.filters.expression` (JSONPath filter on `availableQuantity`) -- v1 `message.intent.fulfillment.stops[].time.range.start` → v2 `message.filters.expression` (JSONPath filter on `productionWindow.start`) -- v1 `message.intent.fulfillment.stops[].time.range.end` → v2 `message.filters.expression` (JSONPath filter on `productionWindow.end`) -- **Note**: v2 does not support `intent` object. All search parameters are expressed via JSONPath filters. - -
-Request Example - -```json -{ - "context": { - "version": "2.0.0", - "action": "discover", - "timestamp": "2024-10-04T10:00:00Z", - "message_id": "msg-discover-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade", - "location": { - "city": { - "code": "BLR", - "name": "Bangalore" - }, - "country": { - "code": "IND", - "name": "India" - } - } - }, - "message": { - "text_search": "solar energy grid injection", - "filters": { - "type": "jsonpath", - "expression": "$[?(@.itemAttributes.sourceType == 'SOLAR' && @.itemAttributes.deliveryMode == 'GRID_INJECTION' && @.itemAttributes.availableQuantity >= 10.0 && @.itemAttributes.productionWindow.start <= '2024-10-04T10:00:00Z' && @.itemAttributes.productionWindow.end >= '2024-10-04T18:00:00Z')]" - } - } -} - - -``` -
- -
-Response Example - ```json { "context": { @@ -790,46 +665,53 @@ If you are a BPP "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "catalogs": [ { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Catalog", "beckn:id": "catalog-energy-001", + "beckn:bppId": "bpp.energy-provider.com", + "beckn:bppUri": "https://bpp.energy-provider.com", "beckn:descriptor": { "@type": "beckn:Descriptor", "schema:name": "Solar Energy Trading Catalog" }, "beckn:items": [ { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Item", + "beckn:networkId": ["p2p-trading-pilot-network"], + "beckn:isActive": true, "beckn:id": "energy-resource-solar-001", "beckn:descriptor": { "@type": "beckn:Descriptor", - "schema:name": "Solar Energy - 30.5 kWh", - "beckn:shortDesc": "Carbon Offset Certified Solar Energy", - "beckn:longDesc": "High-quality solar energy from verified source with carbon offset certification" + "schema:name": "Solar Energy - 30.5 kWh" }, "beckn:provider": { - "@type": "beckn:Provider", - "beckn:id": "provider-solar-farm-001" + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + } }, "beckn:itemAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyResource/v0.2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyResource/v0.2/context.jsonld", "@type": "EnergyResource", "sourceType": "SOLAR", "deliveryMode": "GRID_INJECTION", "certificationStatus": "Carbon Offset Certified", - "meterId": "100200300", - "inverterId": "inv-12345", + "meterId": "der://meter/100200300", "availableQuantity": 30.5, - "productionWindow": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - }, + "productionWindow": [ + { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + ], "sourceVerification": { "verified": true, "verificationDate": "2024-09-01T00:00:00Z", @@ -843,26 +725,70 @@ If you are a BPP ], "beckn:offers": [ { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Offer", - "beckn:id": "offer-energy-001", + "beckn:id": "offer-morning-001", "beckn:descriptor": { "@type": "beckn:Descriptor", - "schema:name": "Daily Settlement Solar Energy Offer" + "schema:name": "Morning Solar Energy Offer - 6am-12pm" }, "beckn:provider": "provider-solar-farm-001", - "beckn:items": ["energy-resource-solar-001"], - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 0.15, - "schema:priceCurrency": "USD", - "schema:unitText": "kWh" + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "wheelingCharges": { + "amount": 2.5, + "currency": "USD", + "description": "PG&E Grid Services wheeling charge" + }, + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T23:59:59Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer - 12pm-6pm" }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], "beckn:offerAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", "@type": "EnergyTradeOffer", "pricingModel": "PER_KWH", "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", "wheelingCharges": { "amount": 2.5, "currency": "USD", @@ -871,8 +797,24 @@ If you are a BPP "minimumQuantity": 1.0, "maximumQuantity": 100.0, "validityWindow": { - "start": "2024-10-04T00:00:00Z", - "end": "2024-10-04T23:59:59Z" + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T23:59:59Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" } } } @@ -882,7 +824,6 @@ If you are a BPP } } - ```
@@ -895,14 +836,14 @@ If you are a BPP - **JSONPath Filters**: Use JSONPath filters to search by `itemAttributes.sourceType`, `itemAttributes.deliveryMode`, `itemAttributes.availableQuantity`, and `itemAttributes.productionWindow` - **Response**: Includes full Item with EnergyResource attributes and Offer with EnergyTradeOffer attributes -## 9.2. Select Flow +## 10.2. Select Flow **Purpose**: Select items and offers to build an order **Endpoint**: `POST /select`
-Request Example +Request Example ```json { @@ -917,40 +858,165 @@ If you are a BPP "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - } - } - } -} - - + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } + } +} + +``` +
+ +
Immediate successful Response + +```json +{ + "ack_status": "ACK", + "timestamp": "2025-10-14T07:31:05Z" +} ```
-Response Example +Asynchronous Response Example: `on_select` ```json { @@ -965,64 +1031,150 @@ If you are a BPP "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:quote": { - "@type": "beckn:Quotation", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 1.5, - "schema:priceCurrency": "USD", - "schema:unitText": "kWh" }, - "beckn:breakup": [ - { - "@type": "beckn:Breakup", - "beckn:title": "Energy Cost (10 kWh @ $0.15/kWh)", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 1.5, - "schema:priceCurrency": "USD" + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" } }, - { - "@type": "beckn:Breakup", - "beckn:title": "Wheeling Charges", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 2.5, - "schema:priceCurrency": "USD" + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } } } - ] - } + } + ] } } } - ```
@@ -1031,7 +1183,7 @@ If you are a BPP - Select offers by `beckn:id` - Response includes priced quote with breakup -## 9.3. Init Flow +## 10.3. Init Flow **Purpose**: Initialize order with fulfillment and payment details @@ -1043,7 +1195,7 @@ If you are a BPP - v1 `Order.attributes.*` → v2 `Order.orderAttributes.*` (path change)
-Request Example +Request Example ```json { @@ -1058,96 +1210,171 @@ If you are a BPP "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" }, - "beckn:fulfillments": [ + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:stops": [ - { - "@type": "beckn:Stop", - "beckn:id": "stop-start-001", - "beckn:type": "START", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "100200300" - }, - "beckn:time": { - "@type": "beckn:Time", - "beckn:range": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - } - } + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" }, - { - "@type": "beckn:Stop", - "beckn:id": "stop-end-001", - "beckn:type": "END", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "98765456" - }, - "beckn:time": { - "@type": "beckn:Time", - "beckn:range": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - } + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" } } - ] - } - ], - "beckn:payments": [ + } + }, { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } } ], - "beckn:billing": { - "@type": "beckn:Billing", - "beckn:name": "Energy Consumer", - "beckn:email": "consumer@example.com", - "beckn:phone": "+1-555-0100" + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" } } } } +``` +
+ +
Immediate successful Response +```json +{ + "ack_status": "ACK", + "timestamp": "2025-10-14T07:31:05Z" +} ```
-Response Example +Asynchronous Response Example: `on_init` ```json { @@ -1162,89 +1389,156 @@ If you are a BPP "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 }, - "beckn:fulfillments": [ + "beckn:orderItems": [ { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:stops": [ - { - "@type": "beckn:Stop", - "beckn:id": "stop-start-001", - "beckn:type": "START", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "100200300" - } + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" }, - { - "@type": "beckn:Stop", - "beckn:id": "stop-end-001", - "beckn:type": "END", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "98765456" + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" } } - ] - } - ], - "beckn:payments": [ + } + }, { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } } ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "PENDING", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "inverterId": "inv-12345", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR", - "certification": { - "status": "Carbon Offset Certified", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - } + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" } } } } - ```
@@ -1254,237 +1548,263 @@ If you are a BPP - **Meter IDs**: Use IEEE mRID format (`"100200300"`) instead of v1's `der://` format (`"der://pge.meter/100200300"`) - **Response**: Includes EnergyTradeContract attributes with PENDING status -## 9.4. Confirm Flow +## 10.4. Confirm Flow **Purpose**: Confirm and activate the order **Endpoint**: `POST /confirm` -### 9.4.1. Cascaded Init Example (Utility Registration) +### 10.4.1. Cascaded Init Example (Utility Registration) This flow demonstrates the cascaded `/init` call from the P2P Trading BPP to the Utility Company (Transmission BPP) to register the trade and calculate wheeling charges. +**Request Flow**: P2P Trading BPP sends a cascaded `init` request to the Utility BPP with the order details (items, offers, fulfillments, payments). + +**Response Flow**: Utility BPP responds with `on_init` containing: +- **Wheeling charges**: Provided in `orderValue` with breakdown in `components` array (type: `FEE`) +- **Remaining trading limits**: Provided in `orderAttributes.remainingTradingLimit` including: + - `remainingQuantity`: Remaining tradable quantity in kWh + - `sanctionedLoad`: Breakdown of total, used, and remaining sanctioned load + - `validUntil`: Validity timestamp for the limit information +
-Cascaded Request Example +Cascaded Request Example ```json { - "context": { - "domain": "energy", - "action": "init", - "location": { - "country": { - "name": "India", - "code": "IND" - }, - "city": { - "name": "Lucknow", - "code": "std:522" - } - }, - "version": "1.1.0", - "bap_id": "p2pTrading-bpp.com", - "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v1", - "bpp_id": "example-transmission-bpp.com", - "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", - "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", - "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", - "timestamp": "2023-07-16T04:41:16Z" - }, - "message": { - "order": { - "provider": { - "descriptor": { - "name": "UPPCL" - } - }, - "fulfillments": [ - { - "customer": { - "person": { - "name": "Raj" - }, - "contact": { - "phone": "+91-1276522222" - } - }, - "stops": [ - { - "type": "start", - "location": { - "address": "der://uppcl.meter/92982739" - }, - "time": { - "range": { - "start": "2024-10-04T10:00:00", - "end": "2024-10-04T18:00:00" - } - } - }, - { - "type": "end", - "location": { - "address": "der://uppcl.meter/98765456" - }, - "time": { - "range": { - "start": "2024-10-04T10:00:00", - "end": "2024-10-04T18:00:00" - } - } - } - ], - "tags": [ - { - "descriptor": { - "name": "P2P-Trade-Draft-Contract" - }, - "list": [ - { - "Value": "https://https://dhiway.com/vc/energy/3894434.json" - } - ] - } - ] - } + "context": { + "version": "2.0.0", + "action": "init", + "timestamp": "2024-10-04T10:20:00Z", + "message_id": "msg-cascaded-init-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": 15.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" ], - "billing": { - "name": "p2p-Trading-BPP", - "email": "p2tbpp@example.com", - "phone": "+91-1276522222" + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } } + } } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } } + } +} + +``` +
+ +
Immediate successful Response + +```json +{ + "ack_status": "ACK", + "timestamp": "2025-10-14T07:31:05Z" } ```
-Cascaded Response Example +Cascaded asynchronous Response Example: `on_init` ```json { - "context": { - "domain": "energy", - "action": "on_init", - "location": { - "country": { - "name": "India", - "code": "IND" - }, - "city": { - "name": "Lucknow", - "code": "std:522" - } - }, - "version": "1.1.0", + "context": { + "version": "2.0.0", + "action": "on_init", + "timestamp": "2024-10-04T10:20:05Z", + "message_id": "msg-cascaded-on-init-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", "bap_id": "p2pTrading-bpp.com", - "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v1", "bpp_id": "example-transmission-bpp.com", - "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", - "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", - "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", - "timestamp": "2023-07-16T04:41:16Z" - }, - "message": { - "order": { - "provider": { - "descriptor": { - "name": "UPPCL" - } + "total_quantity": 15.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" }, - "fulfillments": [ - { - "customer": { - "person": { - "name": "Raj" - }, - "contact": { - "phone": "+91-1276522222" - } - }, - "stops": [ - { - "type": "start", - "location": { - "address": "der://uppcl.meter/92982739" - }, - "time": { - "range": { - "start": "2024-10-04T10:00:00", - "end": "2024-10-04T18:00:00" - } - } - }, - { - "type": "end", - "location": { - "address": "der://uppcl.meter/98765456" - }, - "time": { - "range": { - "start": "2024-10-04T10:00:00", - "end": "2024-10-04T18:00:00" - } - } - } - ], - "tags": [ - { - "descriptor": { - "name": "P2P-Trade-Draft-Contract" - }, - "list": [ - { - "Value": "https://https://dhiway.com/vc/energy/3894434.json" - } - ] - } - ] - } + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" ], - "quote": { - "price": { - "value": "2.5", - "currency": "INR" - }, - "breakup": [ - { - "title": "wheeling charge", - "price": { - "value": "2.5", - "currency": "INR" - } - } - ] - }, - "billing": { - "name": "p2p-Trading-BPP", - "email": "p2ptbpp@example.com", - "phone": "+91-1276522222" - }, - "cancellation_terms": [ - { - "external_ref": { - "mimetype": "text/html", - "url": "https://mvvnl.in/cancellation_terms.html" - } - } - ] + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } } + } } + ```
-## 9.5. Confirm Flow +## 10.5. Confirm Flow **Purpose**: Confirm and activate the order **Endpoint**: `POST /confirm`
-Request Example +Request Example ```json { @@ -1499,56 +1819,171 @@ This flow demonstrates the cascaded `/init` call from the P2P Trading BPP to the "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:fulfillments": [ + }, { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY" + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } } ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ] + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } } } } +``` +
+ +
Immediate successful Response +```json +{ + "ack_status": "ACK", + "timestamp": "2025-10-14T07:31:05Z" +} ```
-Response Example +Asynchronous Response Example: `on_confirm` ```json { @@ -1563,86 +1998,157 @@ This flow demonstrates the cascaded `/init` call from the P2P Trading BPP to the "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 }, - "beckn:fulfillments": [ + "beckn:orderItems": [ { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:state": { - "@type": "beckn:State", + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", "beckn:descriptor": { "@type": "beckn:Descriptor", - "schema:name": "PENDING" + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } } } - } - ], - "beckn:payments": [ + }, { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } } ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "ACTIVE", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "inverterId": "inv-12345", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR", - "certification": { - "status": "Carbon Offset Certified", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - }, - "settlementCycles": [ - { - "cycleId": "settle-2024-10-04-001", - "startTime": "2024-10-04T00:00:00Z", - "endTime": "2024-10-04T23:59:59Z", - "status": "PENDING", - "amount": 0.0, - "currency": "USD" - } - ] + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" } } } } - ```
@@ -1651,445 +2157,859 @@ This flow demonstrates the cascaded `/init` call from the P2P Trading BPP to the - Settlement cycle is initialized - Order is now active and ready for fulfillment -## 9.6. Status Flow +### 10.5.1. Cascaded Confirm Example (Utility Trade Logging) -**Purpose**: Query order and delivery status +This flow demonstrates the cascaded `/confirm` call from the P2P Trading BPP to the Utility Company (Transmission BPP) to log the trade and deduct from trading limits. -**Endpoint**: `POST /status` +**Request Flow**: P2P Trading BPP sends a cascaded `confirm` request to the Utility BPP with the order details to finalize the trade registration. + +**Response Flow**: Utility BPP responds with `on_confirm` containing: +- **Contract activation**: Contract status set to `ACTIVE` in `orderAttributes.contractStatus` +- **Settlement cycle**: Initialized settlement cycle in `orderAttributes.settlementCycles` +- **Updated remaining trading limits**: Provided in `orderAttributes.remainingTradingLimit` with: + - `remainingQuantity`: Updated remaining tradable quantity (reduced by the contracted quantity) + - `sanctionedLoad`: Updated breakdown showing increased `used` and reduced `remaining` values after trade is logged + - `validUntil`: Validity timestamp for the limit information
-Request Example +Cascaded Request Example ```json { "context": { "version": "2.0.0", - "action": "status", - "timestamp": "2024-10-04T15:00:00Z", - "message_id": "msg-status-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", + "action": "confirm", + "timestamp": "2024-10-04T10:25:00Z", + "message_id": "msg-cascaded-confirm-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", - "beckn:id": "order-energy-001" - } - } -} - - -``` -
- -
-Response Example - -```json -{ - "context": { - "version": "2.0.0", - "action": "on_status", - "timestamp": "2024-10-04T15:00:05Z", - "message_id": "msg-on-status-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": 15.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} + +``` +
+ +
+Cascaded asynchronous Response Example: `on_confirm` + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "timestamp": "2024-10-04T10:25:05Z", + "message_id": "msg-cascaded-on-confirm-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" + "beckn:id": "order-cascaded-utility-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": 15.0 }, - "beckn:fulfillments": [ + "beckn:orderItems": [ { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:state": { - "@type": "beckn:State", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "IN_PROGRESS" + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" } }, - "beckn:attributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeDelivery/v0.2/context.jsonld", - "@type": "EnergyTradeDelivery", - "deliveryStatus": "IN_PROGRESS", - "deliveryMode": "GRID_INJECTION", - "deliveredQuantity": 9.8, - "deliveryStartTime": "2024-10-04T10:00:00Z", - "deliveryEndTime": null, - "meterReadings": [ - { - "timestamp": "2024-10-04T10:00:00Z", - "sourceReading": 1000.0, - "targetReading": 990.0, - "energyFlow": 10.0 - }, - { - "timestamp": "2024-10-04T12:00:00Z", - "sourceReading": 1000.5, - "targetReading": 990.3, - "energyFlow": 10.2 - }, - { - "timestamp": "2024-10-04T14:00:00Z", - "sourceReading": 1001.0, - "targetReading": 990.8, - "energyFlow": 10.2 - } + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" ], - "telemetry": [ - { - "eventTime": "2024-10-04T12:00:00Z", - "metrics": [ - { - "name": "ENERGY", - "value": 5.8, - "unitCode": "KWH" - }, - { - "name": "POWER", - "value": 2.5, - "unitCode": "KW" - }, - { - "name": "VOLTAGE", - "value": 240.0, - "unitCode": "VLT" - } - ] + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" } - ], - "settlementCycleId": "settle-2024-10-04-001", - "lastUpdated": "2024-10-04T15:30:00Z" + } } } ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "ACTIVE", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "inverterId": "inv-12345", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR", - "certification": { - "status": "Carbon Offset Certified", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - }, - "settlementCycles": [ - { - "cycleId": "settle-2024-10-04-001", - "startTime": "2024-10-04T00:00:00Z", - "endTime": "2024-10-04T23:59:59Z", - "status": "PENDING", - "amount": 0.0, - "currency": "USD" - } - ], - "lastUpdated": "2024-10-04T15:30:00Z" + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" } } } } - ```
-**Key Points**: -- Response includes EnergyTradeContract attributes (contract status) -- Response includes EnergyTradeDelivery attributes (delivery status, meter readings, telemetry) -- Meter readings show energy flow from source to target -- Telemetry provides real-time energy metrics - ---- - - - -# 10. Field Mapping Reference - -## 10.1. v1 to v2 Field Mapping - -| v1 Location | v2 Location | Notes | -| --------------------------- | -------------------------------- | --------------------- | -| `Item.attributes.*` | `Item.itemAttributes.*` | Attribute path change | -| `Offer.attributes.*` | `Offer.offerAttributes.*` | Attribute path change | -| `Order.attributes.*` | `Order.orderAttributes.*` | Attribute path change | -| `Fulfillment.attributes.*` | `Fulfillment.attributes.*` | No change | -| `der://meter/{id}` | `{id}` (IEEE mRID) | Format change | -| `Tag.value` (energy source) | `itemAttributes.sourceType` | Direct attribute | -| `Tag.value` (settlement) | `offerAttributes.settlementType` | Direct attribute | - -## 10.2. Meter ID Format Migration - -**v1 Format**: `der://pge.meter/100200300` -**v2 Format**: `100200300` (IEEE 2030.5 mRID) - -**Migration Rule**: Extract the numeric ID from the `der://` URI. +## 10.6. Status Flow ---- +**Purpose**: Query order and delivery status -# 11. Integration Patterns +**Endpoint**: `POST /status` -## 11.1. Attaching Attributes to Core Objects +
+Request Example -**Item with EnergyResource**: ```json { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Item", - "beckn:id": "energy-resource-solar-001", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "Solar Energy - 30.5 kWh" + "context": { + "version": "2.0.0", + "action": "status", + "timestamp": "2024-10-04T15:00:00Z", + "message_id": "msg-status-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, - "beckn:itemAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyResource/v0.2/context.jsonld", - "@type": "EnergyResource", - "sourceType": "SOLAR", - "deliveryMode": "GRID_INJECTION", - "meterId": "100200300" + "message": { + "order": { + "beckn:id": "order-energy-001" + } } } ``` +
-**Offer with EnergyTradeOffer**: -```json -{ - "@type": "beckn:Offer", - "beckn:id": "offer-energy-001", - "beckn:offerAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeOffer/v0.2/context.jsonld", - "@type": "EnergyTradeOffer", - "pricingModel": "PER_KWH", - "settlementType": "DAILY" - } -} -``` +
Immediate successful Response -**Order with EnergyTradeContract**: ```json { - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "ACTIVE", - "sourceMeterId": "100200300", - "targetMeterId": "98765456" - } + "ack_status": "ACK", + "timestamp": "2025-10-14T07:31:05Z" } ``` +
+ +
+Asynchronous Response Example: `on_status` -**Fulfillment with EnergyTradeDelivery**: ```json { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:attributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeDelivery/v0.2/context.jsonld", - "@type": "EnergyTradeDelivery", - "deliveryStatus": "IN_PROGRESS", - "meterReadings": [...] + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T15:00:05Z", + "message_id": "msg-on-status-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 7.5, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T15:00:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "PENDING", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 0.0, + "meterReadings": [], + "lastUpdated": "2024-10-04T15:00:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } } } + ``` +
-## 11.2. JSON-LD Context Usage +**Key Points**: +- Response includes EnergyTradeContract attributes (contract status) +- Response includes EnergyTradeDelivery attributes (delivery status, meter readings, telemetry) +- Meter readings show energy flow from source to target +- Telemetry provides real-time energy metrics -All attribute bundles include `@context` and `@type`: -- `@context`: Points to the context.jsonld file for the attribute bundle -- `@type`: The schema type (EnergyResource, EnergyTradeOffer, etc.) +### 10.6.1. Curtailed Trade Status -## 11.3. Discovery Filtering +When a trade has been curtailed (e.g., due to grid outage), the status response includes curtailment information for payment reconciliation: -Use JSONPath filters to search by energy attributes: +
+Curtailed Status Response Example ```json { - "filters": { - "type": "jsonpath", - "expression": "$[?(@.itemAttributes.sourceType == 'SOLAR' && @.itemAttributes.deliveryMode == 'GRID_INJECTION' && @.itemAttributes.availableQuantity >= 10.0)]" + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T16:00:00Z", + "message_id": "msg-on-status-curtailed-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "PARTIALLYFULFILLED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "curtailedQuantity": 5.0, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T14:30:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 10.0, + "allocatedEnergy": 10.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "FAILED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 0.0, + "curtailedQuantity": 10.0, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } } } -``` - ---- - -# 12. Best Practices - -## 12.1. Discovery Optimization - -- **Index Key Fields**: Index `itemAttributes.sourceType`, `itemAttributes.deliveryMode`, `itemAttributes.meterId`, `itemAttributes.availableQuantity` -- **Use JSONPath Filters**: Leverage JSONPath for complex filtering -- **Minimal Fields**: Return minimal fields in list/search APIs (see profile.json) - -## 12.2. Meter ID Handling - -- **Use IEEE mRID Format**: Always use plain identifier (e.g., `"100200300"`), not `der://` format -- **PII Treatment**: Treat meter IDs as PII - do not index, redact in logs, encrypt at rest -- **Discovery**: Meter IDs enable meter-based discovery (provider names not required) - -## 12.3. Settlement Cycle Management - -- **Initialize on Confirm**: Create settlement cycle when order is confirmed -- **Update on Delivery**: Link deliveries to settlement cycles via `settlementCycleId` -- **Status Tracking**: Track settlement cycle status (PENDING → SETTLED → FAILED) -- **Amount Calculation**: Calculate settlement amount based on delivered quantity and pricing -## 12.4. Meter Readings - -- **Regular Updates**: Update meter readings during delivery (every 15-30 minutes) -- **Energy Flow Calculation**: Calculate `energyFlow` as difference between readings -- **Source and Target**: Track both source and target meter readings -- **Timestamp Accuracy**: Use accurate timestamps (ISO 8601 format) +``` +
-## 12.5. Telemetry Data +**Curtailment Fields for Payment Reconciliation**: +- `curtailedQuantity`: Revised trade limit (kWh) - the billable quantity +- `curtailmentReason`: Why curtailment occurred (`GRID_OUTAGE`, `EMERGENCY`, `CONGESTION`, `MAINTENANCE`, `OTHER`) +- `curtailmentTime`: When the curtailment was issued -- **Metric Selection**: Include relevant metrics (ENERGY, POWER, VOLTAGE, CURRENT, FREQUENCY) -- **Unit Codes**: Use correct unit codes (KWH, KW, VLT, AMP, HZ) -- **Update Frequency**: Update telemetry every 5-15 minutes during active delivery -- **Data Retention**: Retain telemetry data for billing and audit purposes +**Payment Calculation**: +- Original contracted: `orderItems[].quantity` +- Actually delivered: `deliveredQuantity` +- Billable amount: `min(deliveredQuantity, curtailedQuantity) × price` -## 12.6. Error Handling +## 10.7. Update Flow (Provider-Initiated) -- **Validation Errors**: Validate all required fields before processing -- **Meter ID Format**: Validate meter IDs are IEEE mRID format -- **Quantity Validation**: Ensure quantities are within min/max limits -- **Time Window Validation**: Validate production windows and validity windows +**Purpose**: Notify BAP of changes to an active order initiated by the provider (BPP) or utility ---- +**Endpoint**: `POST /on_update` (unsolicited callback from BPP to BAP) -# 13. Migration from v1 +In Beckn protocol, `on_update` can be sent **without a preceding `update` request** from BAP. This is the standard "push notification" pattern for provider-initiated changes such as: +- Trade curtailment due to grid outages +- Delivery interruptions +- Settlement adjustments -## 13.1. Key Changes +### 10.7.1. Utility-Initiated Trade Curtailment -1. **Attribute Paths**: Change `attributes.*` to `itemAttributes.*`, `offerAttributes.*`, `orderAttributes.*` -2. **Meter Format**: Convert `der://meter/{id}` to `{id}` (IEEE mRID) -3. **Tag Values**: Convert `Tag.value` to direct attribute fields -4. **JSON-LD**: Add `@context` and `@type` to all attribute objects +During active energy delivery, grid operators may need to curtail trades due to: +- **Grid outages**: Unexpected failures requiring immediate load reduction +- **Emergency conditions**: Frequency deviations, voltage issues +- **Congestion**: Transmission capacity limits +- **Scheduled maintenance**: Planned outages -## 13.2. Migration Checklist +When this happens, the Utility Company sends an unsolicited `on_update` to the BPP, which forwards it to the BAP. This enables both parties to reconcile payments based on the revised trade quantity. -- Update attribute paths (`attributes.*` → `itemAttributes.*`, etc.) -- Convert meter IDs from `der://` format to IEEE mRID -- Replace `Tag.value` with direct attribute fields -- Add JSON-LD context to all attribute objects -- Update discovery filters to use new attribute paths -- Update validation logic for new schema structure -- Test all transaction flows -- Update documentation +```mermaid +sequenceDiagram + participant Utility as Utility Grid Operator + participant BPP as P2P Trading BPP + participant BAP as P2P Trading BAP + + Note over Utility: Grid outage detected + Utility->>BPP: on_update (curtailment notification) + Note right of BPP: curtailedQuantity: 10kWh
curtailmentReason: GRID_OUTAGE + BPP->>BAP: on_update (forwarded) + Note over BAP: Update UI, adjust payment +``` -## 13.3. Example Migration +
+Curtailment Notification Example (`on_update`) -**v1 Format**: ```json { - "Item": { - "attributes": { - "sourceType": "SOLAR", - "meterId": "der://pge.meter/100200300" - } + "context": { + "version": "2.0.0", + "action": "on_update", + "timestamp": "2024-10-04T14:30:00Z", + "message_id": "msg-on-update-curtailment-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" }, - "Tag": { - "value": "SOLAR" + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "INPROGRESS", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 8.5, + "curtailedQuantity": 6.5, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 8.5, + "allocatedEnergy": 8.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + } + ] + } } } -``` -**v2 Format**: -```json -{ - "@type": "beckn:Item", - "beckn:itemAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyResource/v0.2/context.jsonld", - "@type": "EnergyResource", - "sourceType": "SOLAR", - "meterId": "100200300" - } -} ``` +
---- - -# 14. Examples - -## 14.1. Complete Examples - -All examples are available in: -- **Schema Examples**: `schema/EnergyResource/v0.2/examples/schema/` - - `item-example.json` - EnergyResource - - `offer-example.json` - EnergyTradeOffer - - `order-example.json` - EnergyTradeContract - - `fulfillment-example.json` - EnergyTradeDelivery - -- **Transaction Flow Examples**: [`/examples/v2/P2P_Trading/`](/examples/v2/P2P_Trading/) - - [`discover-request.json`](/examples/v2/P2P_Trading/discover-request.json) / [`discover-response.json`](/examples/v2/P2P_Trading/discover-response.json) - - [`select-request.json`](/examples/v2/P2P_Trading/select-request.json) / [`select-response.json`](/examples/v2/P2P_Trading/select-response.json) - - [`init-request.json`](/examples/v2/P2P_Trading/init-request.json) / [`init-response.json`](/examples/v2/P2P_Trading/init-response.json) - - [`confirm-request.json`](/examples/v2/P2P_Trading/confirm-request.json) / [`confirm-response.json`](/examples/v2/P2P_Trading/confirm-response.json) - - [`status-request.json`](/examples/v2/P2P_Trading/status-request.json) / [`status-response.json`](/examples/v2/P2P_Trading/status-response.json) +**Key Points**: +- `on_update` is **unsolicited** - no preceding `update` request needed +- Contains `curtailedQuantity` for payment reconciliation +- `curtailmentReason` provides audit trail for dispute resolution +- BAP should update UI and adjust pending payment based on revised quantity -## 14.2. Example Scenarios +# 11. Additional Resources -1. **Solar Energy Discovery**: Search for solar energy with grid injection delivery -2. **Daily Settlement**: Contract with daily settlement cycle -3. **Meter-Based Tracking**: Track energy flow using meter readings -4. **Telemetry Monitoring**: Monitor energy delivery with real-time telemetry +1. **Beckn 1.0 to 2.0 field mapping**: See `./v1_to_v2_field_mapping.md` +2. **Taxonomy Reference**: See `./taxonomy.md` +3. **Solar Energy Discovery**: Search for solar energy with grid injection delivery +4. **Daily Settlement**: Contract with daily settlement cycle +5. **Meter-Based Tracking**: Track energy flow using meter readings +6. **Telemetry Monitoring**: Monitor energy delivery with real-time telemetry --- -## 14.3. Inter energy retailer P2P trading +## 11.1. Inter energy retailer P2P trading This is a specific scenario of P2P trading where the participants come under differnet energy retailers and distribution utilities and engages in direct energy trade. Here, nuances of financial settlement, dispute resolution, energy accounting etc will have to be thought through without affecting ease of participation. More information can be found here [Inter-retailer P2P energy trading](/docs/implementation-guides/v2/P2P_Trading/Inter_energy_retailer_P2P_trading_draft.md) -# 15. Additional Resources +# 12. Additional Resources - **Field Mapping**: See `docs/v1_to_v2_field_mapping.md` - **Taxonomy Reference**: See `docs/TAXONOMY.md` @@ -2097,16 +3017,42 @@ This is a specific scenario of P2P trading where the participants come under dif - **Context Files**: See `schema/Energy*/v0.2/context.jsonld` - **Profile Configuration**: See `schema/EnergyResource/v0.2/profile.json` ---- +### 12.0.1. **Integrating with your software** -# 16. Support +This section gives a general walkthrough of how you would integrate your software with the Beckn network (say the sandbox environment). Refer to the starter kit for details on how to register with the sandbox and get credentials. -For questions or issues: -- Review the examples in `schema/EnergyResource/v0.2/examples/` -- Check the schema definitions in `schema/Energy*/v0.2/attributes.yaml` -- Refer to the Beckn Protocol v2 documentation +Beckn-ONIX is an initiative to promote easy installation and maintenance of a Beckn Network. Apart from the Registry and Gateway components that are required for a network facilitator, Beckn-ONIX provides a Beckn Adapter. A reference implementation of the Beckn-ONIX specification is available at [Beckn-ONIX repository](https://github.com/beckn/beckn-onix). The reference implementation of the Beckn Adapter is called the Protocol Server. Based on whether we are writing the seeker platform or the provider platform, we will be installing the BAP Protocol Server or the BPP Protocol Server respectively. ---- +TODO + +#### 12.0.1.1. **Integrating the BAP** + +If you are writing the seeker platform software, the following are the steps you can follow to build and integrate your application. + +1. **Discovery**: Use JSONPath filters to search by energy attributes (sourceType, deliveryMode, availableQuantity, productionWindow) +2. **Order Management**: Track order state through PENDING → ACTIVE → COMPLETED +3. **Status Polling**: Poll status endpoint every 15-30 minutes during active delivery +4. **Error Handling**: Handle cases where delivery fails or quantities don't match +5. **Settlement**: Monitor settlement cycle status for payment processing + +TODO + +#### 12.0.1.2. **Integrating the BPP** + +If you are writing the provider platform software, the following are the steps you can follow to build and integrate your application. + +6. **Catalog Management**: Keep catalog updated with available energy and accurate production windows +7. **Meter Readings**: Update meter readings regularly during delivery (every 15-30 minutes) +8. **Telemetry**: Provide real-time telemetry data for monitoring +9. **Settlement**: Calculate settlement amounts based on delivered quantity and pricing model +10. **State Management**: Properly transition contract and delivery statuses + +TODO + +## 12.1. FAQs +## 12.2. References +* [Postman collection for EV Charging](/testnet/ev-charging-devkit/postman/) +* [Beckn 1.0 (legacy) Layer2 config for peer to peer trading](https://github.com/beckn/missions/blob/main/DEG2.0/layer2/P2P/trade_1.1.0.yaml) diff --git a/docs/implementation-guides/v2/P2P_Trading/note-on-allocation-settlement-logic.md b/docs/implementation-guides/v2/P2P_Trading/note-on-allocation-settlement-logic.md new file mode 100644 index 00000000..2086ca4f --- /dev/null +++ b/docs/implementation-guides/v2/P2P_Trading/note-on-allocation-settlement-logic.md @@ -0,0 +1,1275 @@ +# P2P Energy Settlement & Allocation + +## 1. The Settlement Problem- [P2P Energy Settlement \& Allocation](#p2p-energy-settlement--allocation) +- [P2P Energy Settlement \& Allocation](#p2p-energy-settlement--allocation) + - [1. The Settlement Problem- P2P Energy Settlement \& Allocation](#1-the-settlement-problem--p2p-energy-settlement--allocation) + - [2. Design Principles for Fair Settlement](#2-design-principles-for-fair-settlement) + - [3. The Min-of-Two Settlement Rule](#3-the-min-of-two-settlement-rule) + - [Why Min-of-Two?](#why-min-of-two) + - [Simple Case: Single Trade](#simple-case-single-trade) + - [4. When Allocation Becomes Necessary](#4-when-allocation-becomes-necessary) + - [Condition 1: Multiple Overlapping Trades](#condition-1-multiple-overlapping-trades) + - [Condition 2: Shortfall (Actual ≠ Contracted)](#condition-2-shortfall-actual--contracted) + - [The Allocation Problem](#the-allocation-problem) + - [5. Distributed Allocation Algorithm](#5-distributed-allocation-algorithm) + - [Pro-Rata Allocation (Recommended)](#pro-rata-allocation-recommended) + - [The 3-Round Settlement Flow](#the-3-round-settlement-flow) + - [Settlement Flow Diagram](#settlement-flow-diagram) + - [Optimality of the 3-Round Approach](#optimality-of-the-3-round-approach) + - [6. Billing Calculation](#6-billing-calculation) + - [For Buyer (Consumer)](#for-buyer-consumer) + - [For Seller (Prosumer)](#for-seller-prosumer) + - [7. Ledger API Integration](#7-ledger-api-integration) + - [Allocation Workflow](#allocation-workflow) + - [Step 1: Platform Creates Trade Record](#step-1-platform-creates-trade-record) + - [Step 2: Discoms Record Allocations (Rounds 1, 2 \& 3)](#step-2-discoms-record-allocations-rounds-1-2--3) + - [Step 3: Platforms Read Final Settlement](#step-3-platforms-read-final-settlement) + - [Step 4: Billing Calculation from Settlement](#step-4-billing-calculation-from-settlement) + - [Error Handling Patterns](#error-handling-patterns) + - [Sequence Diagram](#sequence-diagram) + - [8. Summary](#8-summary) + - [9. Consensus Rules for AI Summit](#9-consensus-rules-for-ai-summit) +- [Appendix A: Deviation-Based Settlement (Alternative)](#appendix-a-deviation-based-settlement-alternative) + - [Overview](#overview) + - [Settlement Formulas](#settlement-formulas) + - [Example](#example) + - [Key Properties](#key-properties) + - [When to Use Which](#when-to-use-which) +- [Appendix B: Detailed Optimality Analysis](#appendix-b-detailed-optimality-analysis) + - [The Centralized Optimum](#the-centralized-optimum) + - [Suboptimality Example: Cross-Linked Trades](#suboptimality-example-cross-linked-trades) + - [FIFO Can Be Worse](#fifo-can-be-worse) + - [Theoretical Bounds](#theoretical-bounds) +- [Appendix C: Side-by-Side Method Comparison](#appendix-c-side-by-side-method-comparison) + - [Scenario](#scenario) + - [Min-of-Two Result](#min-of-two-result) + - [Deviation Result](#deviation-result) + - [Key Insight](#key-insight) + - [Principles Alignment](#principles-alignment) + + +In P2P energy trading, settlement answers the question: **"How much energy was actually exchanged, and who pays whom?"** + +Unlike traditional retail electricity (where the utility supplies whatever you consume), P2P trades involve forward contracts: a buyer and seller agree to exchange a specific quantity at a specific price for a future time slot. The problem arises because: + +1. **Actuals differ from contracts** - A seller with rooftop solar may produce less on a cloudy day; a buyer may consume less than expected +2. **Multiple parties involved** - Each trade involves four entities: Buyer (B), Buyer's Utility (BU), Seller (S), Seller's Utility (SU) +3. **Grid must balance** - Any mismatch is absorbed by the utilities from the open market + +**Example:** Seller contracts to deliver 100 kWh but produces only 70 kWh. Buyer expected 100 kWh but received only 70 kWh. Who bears the cost of the 30 kWh shortfall? The buyer's utility had to procure it from the real-time market at potentially higher prices. + +A good settlement mechanism must answer these questions fairly, consistently, and without creating perverse incentives. + +--- + +## 2. Design Principles for Fair Settlement + +The most important property of any settlement is that it is **dispute-free and agreed by all parties, and verifiable in an audit**. Beyond this foundation, we believe the following principles should guide settlement design in order of decreasing importance: + +- **Principle 1: Shortfall responsibility** + > All else equal, the actor(s) responsible for the shortfall should bear the cost of that shortfall. + + If the seller underproduces, the seller bears the consequence. If the buyer underconsumes, the buyer bears the consequence. If both have shortfalls, they share responsibility proportionally. + + This creates natural alignment and avoids gaming. For P2P trading to grow sustainably, it must reduce costs on the rest of the ecosystem and add positive economic value. **Overpenalizing shortfalls (within reason) is acceptable; underpenalizing is not**, as it creates perverse incentives. + + **Consequence of seller underproduction:** The buyer's utility must procure the energy shortfall from the open market at real-time price ($\text{rtm}_p$). + + **Consequence of buyer underconsumption:** The seller's utility must sell the excess energy in the open market, potentially at a loss compared to the trade price. + +- **Principle 2: Independence & scalability** + > Enable uncoordinated, independent actions between (B, BU) and (S, SU) tuples. + + The buyer's utility should not need to know the seller's meter readings or trades when penalizing buyer underconsumption, and vice versa. This breaks deadlocks and enables scale. + +- **Principle 3: Allocation flexibility** + > Different utilities should be able to use independent allocation logic without violating Principle 1. + + The total penalty for a customer's shortfall should be deterministic, even if individual trade allocations vary. + +- **Principle 4: Reuse existing billing flows** + > Avoid introducing new billing relationships. + + Settlement should work within existing flows: + - Buyer ↔ Buyer's Utility + - Seller ↔ Seller's Utility + - Buyer ↔ Seller (via platform) + + Avoid inter-utility payments if possible. + +- **Principle 5: No surprises for compliant parties** + > If an actor abides by its contract, it should face no penalties or revenue surprises. + + - If a seller produces ≥ contracted quantity, their revenue should be the same regardless of whether the buyer underconsumed + - If a buyer consumes ≥ contracted quantity, their bill should be the same regardless of whether the seller underproduced + +- **Principle 6: Allocation-independent total penalty** + > A customer's total penalty should depend only on their total shortfall, not on how it's allocated across trades. + + This makes allocation logic less critical—it may affect per-trade penalties, but not the total. + +--- + +## 3. The Min-of-Two Settlement Rule + +When allocations to a trade by respective parties differ, a consensus has emerged around the following rule to break the tie. Let's denote it as the **min-of-two** rule: + +$$\text{settle}_k = \min(a^B_k, a^S_k)$$ + +Where: +- $a^B_k$ = Buyer utility's allocation for trade $k$ (capped by buyer's actual consumption) +- $a^S_k$ = Seller utility's allocation for trade $k$ (capped by seller's actual production) +- $\text{settle}_k$ = Final settled quantity for trade $k$ + +There are also alternate settlement rules which can help ease the friction in trade assurance. One such rule "pay for own deviation" is described in Appendix A. + +### Why Min-of-Two? + +1. **Dispute-free** - Both parties independently compute allocations; the minimum is unambiguous +2. **Conservative** - In case of disagreement, the lower value prevails, preventing over-billing + +### Simple Case: Single Trade + +When a buyer has exactly one trade with a seller, settlement is straightforward: + +``` +Trade: T1 between Buyer B1 and Seller S1 + - Contracted: 10 kWh @ 6 INR/kWh + +Actuals: + - B1 consumed: 15 kWh + - S1 produced: 8 kWh + +Settlement: + - Buyer allocation: a^B = min(10, 15) = 10 kWh + - Seller allocation: a^S = min(10, 8) = 8 kWh + - Settled: settle = min(10, 8) = 8 kWh + +Billing: + - Buyer pays seller: 8 kWh × 6 INR = 48 INR + - Buyer pays utility for grid import: (15 - 8) = 7 kWh × 10 INR = 70 INR +``` + +**Analysis:** Seller underproduced by 2 kWh. Buyer's settlement reduced from 10 to 8 kWh, forcing them to import 7 kWh from grid instead of 5 kWh. + +--- + +## 4. When Allocation Becomes Necessary + +The single-trade case is simple. However, **allocation** becomes a distinct problem when: + +### Condition 1: Multiple Overlapping Trades + +A customer may have multiple P2P trades in the same time slot: + +``` +Buyer B1 has two trades in slot 10:00-10:15: + - T1: Buy 10 kWh from Seller S1 @ 5 INR + - T2: Buy 10 kWh from Seller S2 @ 6 INR + +B1's actual consumption: 15 kWh (shortfall of 5 kWh) + +Question: How much of the 15 kWh came from T1 vs T2? +``` + +### Condition 2: Shortfall (Actual ≠ Contracted) + +If a customer's actual meter reading differs from their total contracted quantity, we must decide how to distribute the actual across trades: + +``` +Seller S1 has two trades: + - T1: Sell 10 kWh to Buyer B1 + - T3: Sell 10 kWh to Buyer B2 + +S1's actual production: 15 kWh (shortfall of 5 kWh) + +Question: Which buyer gets shorted? Or is it split proportionally? +``` + +### The Allocation Problem + +When both conditions exist, we have the **allocation problem**: given multiple trades and a meter reading that differs from total contracted quantity, how should the utility allocate the actual reading across trades? + +This is a **per-utility** problem. Each utility (buyer's DISCOM, seller's DISCOM) independently allocates their customer's meter reading across that customer's trades. The final settlement for each trade is then the minimum of both allocations. + +--- + +## 5. Distributed Allocation Algorithm + +### Pro-Rata Allocation (Recommended) + +Each utility allocates proportionally to contracted quantities: + +$$a_k = \text{tr}_k \cdot \min\left(1, \frac{\text{meter}}{\sum_{k'} \text{tr}_{k'}}\right)$$ + +**Example:** +``` +Seller S1: Production = 15 kWh, Contracts = T1(10) + T3(10) = 20 kWh +Pro-rata factor: min(1, 15/20) = 0.75 +Allocations: T1 = 10 × 0.75 = 7.5 kWh, T3 = 10 × 0.75 = 7.5 kWh +``` + +**Properties:** +- Deterministic (no timestamp dependency) +- Fair across trades (proportional sharing) +- Simple to implement +- Each utility computes independently + +### The 3-Round Settlement Flow + +1. **Round 1 - Seller utilities allocate (initial):** Each seller utility computes pro-rata allocations based on seller's production. Records allocated pushed energy to ledger. Marks `statusSellerDiscom` as **PENDING**. + +2. **Round 2 - Buyer utilities allocate:** Each buyer utility queries seller allocations from Round 1, computes pro-rata allocations based on buyer's consumption, and caps each allocation at the seller's Round 1 allocation. Records allocated pulled energy to ledger. Marks `statusBuyerDiscom` as **COMPLETED**. + +3. **Round 3 - Seller utilities re-allocate (final):** Each seller utility queries buyer allocations from Round 2, re-computes allocations capped at buyer's Round 2 values. This allows sellers to redistribute freed-up energy from trades where buyers took less than offered. Records updated allocations to ledger. Marks `statusSellerDiscom` as **COMPLETED**. + +After Round 3, both allocations converge: the seller's final allocation equals the buyer's allocation for each trade. The min-of-two rule $\text{settle}_k = \min(a^B_k, a^S_k)$ becomes a verification rather than a computation, since both values should agree. + +**Why seller first?** Production (supply) is typically the scarcer constraint. The seller's initial allocation sets the upper bound, the buyer responds within that bound, and the seller finalizes. This 3-round convergence ensures both parties explicitly agree on settled quantities. + +**Why 3 rounds instead of 2?** When a seller has multiple trades and some buyers consume less than offered, Round 3 allows the seller's utility to redistribute the surplus to other trades where the buyer could accept more. Without Round 3, this surplus would be stranded. + +### Settlement Flow Diagram + +``` +┌─────────────────────────────────────────────────────────────────────┐ +│ Post-Delivery Settlement │ +├─────────────────────────────────────────────────────────────────────┤ +│ │ +│ 1. METER READING 2. ALLOCATION 3. BILLING │ +│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ +│ │ m_i = 100 │ → │ alloc = 80 │ → │ utility_bill│ │ +│ │ (consumed) │ │ (from P2P) │ │ = 20 × tariff│ +│ └─────────────┘ └─────────────┘ └─────────────┘ │ +│ │ +│ Total Consumption = P2P Settled + Utility Import │ +│ 100 kWh = 80 kWh + 20 kWh │ +└─────────────────────────────────────────────────────────────────────┘ +``` + +### Optimality of the 3-Round Approach + +**When is it optimal?** +- **No shortfalls:** If all parties meet their contracts, settlement equals contract for every trade. Trivially optimal. +- **Single-side shortfall:** If only sellers (or only buyers) have shortfalls, the algorithm is optimal. + +**When is it suboptimal?** +- **Both-side shortfalls with cross-linked trades:** When buyers and sellers both have shortfalls, and trades form a bipartite graph with multiple edges, the distributed algorithm can leave energy "stranded." + +**Practical performance:** The 3-round pro-rata approach achieves **67-90% of the theoretical optimum** in worst-case scenarios. In typical scenarios (mild, correlated shortfalls), the gap is much smaller (<10%). See Appendix B for detailed analysis. + +**Recommendation:** Use pro-rata allocation. It is simple, fair, and adequate for most practical scenarios. + +--- + +## 6. Billing Calculation + +### For Buyer (Consumer) + +| Component | Formula | Description | +|-----------|---------|-------------| +| Meter Reading | $m_i$ | Actual consumption (kWh) | +| P2P Settled | $\sum_{k: b(k)=i} \text{settle}_k$ | Energy from P2P trades | +| Utility Import | $m_i - \sum \text{settle}_k$ | Remaining from grid | +| P2P Cost | $\sum \text{settle}_k \times p_k$ | Payment to sellers | +| Utility Cost | $(m_i - \sum \text{settle}_k) \times \text{tariff}_{\text{import}}$ | Grid charges | + +### For Seller (Prosumer) + +| Component | Formula | Description | +|-----------|---------|-------------| +| Meter Reading | $m_j$ | Actual production (kWh) | +| P2P Settled | $\sum_{k: s(k)=j} \text{settle}_k$ | Energy sold via P2P | +| Utility Export | $m_j - \sum \text{settle}_k$ | Remaining to grid | +| P2P Revenue | $\sum \text{settle}_k \times p_k$ | Payment from buyers | +| Utility Revenue | $(m_j - \sum \text{settle}_k) \times \text{tariff}_{\text{export}}$ | Net metering credits | + +--- + +## 7. Ledger API Integration + +The DEG Ledger Service provides an immutable, multi-party view of trade lifecycle events. It supports three primary operations: + +| Endpoint | Who Uses | Purpose | +|----------|----------|---------| +| `POST /ledger/put` | Platforms only | Create/update trade records | +| `POST /ledger/record` | Discoms only | Record actuals and status | +| `POST /ledger/get` | All parties | Query records (policy-filtered) | + +### Allocation Workflow + +``` +Timeline (generic — see "Consensus Rules for AI Summit" for specific time gates): + Delivery period ends + Meter readings become available to discoms + Round 1: Seller discom allocates (ACTUAL_PUSHED), statusSellerDiscom = PENDING + Round 2: Buyer discom reads seller allocations, allocates (ACTUAL_PULLED), + statusBuyerDiscom = COMPLETED + Round 3: Seller discom reads buyer allocations, re-allocates (ACTUAL_PUSHED), + statusSellerDiscom = COMPLETED + Trading platforms read final settled status +``` + +### Step 1: Platform Creates Trade Record + +When a trade is confirmed, the platform creates a ledger record via `/ledger/put`. + +```python +def create_trade_record(trade: Trade) -> LedgerWriteResponse: + """ + Platform creates the initial ledger record at trade confirmation. + Called by: Buyer Platform or Seller Platform + Endpoint: POST /ledger/put + """ + payload = { + "role": "BUYER", # or "SELLER" depending on calling platform + "transactionId": trade.transaction_id, + "orderItemId": trade.order_item_id, + + # Party identifiers + "platformIdBuyer": trade.bap_id, + "platformIdSeller": trade.bpp_id, + "discomIdBuyer": trade.buyer_discom_id, + "discomIdSeller": trade.seller_discom_id, + "buyerId": trade.buyer_ca_number, # Consumer Account number + "sellerId": trade.seller_der_id, # DER / prosumer ID + + # Time metadata + "tradeTime": trade.confirmed_at.isoformat() + "Z", + "deliveryStartTime": trade.delivery_slot_start.isoformat() + "Z", + "deliveryEndTime": trade.delivery_slot_end.isoformat() + "Z", + + # Trade details + "tradeDetails": [{ + "tradeType": "ENERGY", + "tradeQty": trade.contracted_kwh, + "tradeUnit": "KWH" + }], + + # Idempotency token for safe retries + "clientReference": f"platform-create-{trade.order_item_id}" + } + + response = requests.post( + f"{LEDGER_HOST}/ledger/put", + json=payload, + headers=get_signed_headers(payload) + ) + + if response.status_code == 200: + result = response.json() + # Store recordId for future reference + trade.ledger_record_id = result["recordId"] + trade.ledger_row_digest = result["rowDigest"] + return result + elif response.status_code == 409: + # Record already exists - idempotent retry is safe + raise ConflictError(response.json()) + else: + raise LedgerAPIError(response.status_code, response.json()) +``` + +### Step 2: Discoms Record Allocations (Rounds 1, 2 & 3) + +After the delivery period, discoms compute and record allocations in three sequential rounds: +- **Round 1:** Seller discoms allocate based on production (pro-rata). Mark `statusSellerDiscom = PENDING`. +- **Round 2:** Buyer discoms query seller allocations from Round 1, then allocate based on consumption, capped at seller's allocation. Mark `statusBuyerDiscom = COMPLETED`. +- **Round 3:** Seller discoms query buyer allocations from Round 2, then re-allocate capped at buyer's allocation. This allows redistribution of surplus from trades where buyers took less. Mark `statusSellerDiscom = COMPLETED`. + +```python +def compute_pro_rata_allocation( + customer_id: str, + meter_reading: float, + trades: list[Trade] +) -> dict[str, float]: + """ + Pro-rata allocation algorithm. + Allocates meter reading proportionally across all trades for a customer. + + Returns: {order_item_id: allocated_qty} + """ + total_contracted = sum(t.contracted_kwh for t in trades) + + if total_contracted == 0: + return {t.order_item_id: 0.0 for t in trades} + + # Pro-rata factor: ratio of actual to contracted (capped at 1.0) + pro_rata_factor = min(1.0, meter_reading / total_contracted) + + allocations = {} + for trade in trades: + # Each trade gets proportional share of actual meter reading + allocated = trade.contracted_kwh * pro_rata_factor + allocations[trade.order_item_id] = round(allocated, 3) + + return allocations + + +def record_discom_actuals( + role: str, # "BUYER_DISCOM" or "SELLER_DISCOM" + trade: Trade, + allocated_qty: float, + status: str = "COMPLETED" +) -> LedgerWriteResponse: + """ + Discom records fulfillment actuals for a trade. + Called by: Buyer Discom or Seller Discom + Endpoint: POST /ledger/record + + Validation metric types: + - ACTUAL_PUSHED: Energy pushed by seller (seller discom records) + - ACTUAL_PULLED: Energy pulled by buyer (buyer discom records) + """ + payload = { + "role": role, + "transactionId": trade.transaction_id, + "orderItemId": trade.order_item_id, + "clientReference": f"{role.lower()}-actuals-{trade.order_item_id}-{uuid4()}" + } + + if role == "SELLER_DISCOM": + payload["sellerFulfillmentValidationMetrics"] = [{ + "validationMetricType": "ACTUAL_PUSHED", + "validationMetricValue": allocated_qty + }] + payload["statusSellerDiscom"] = status + elif role == "BUYER_DISCOM": + payload["buyerFulfillmentValidationMetrics"] = [{ + "validationMetricType": "ACTUAL_PULLED", + "validationMetricValue": allocated_qty + }] + payload["statusBuyerDiscom"] = status + else: + raise ValueError(f"Invalid role: {role}") + + response = requests.post( + f"{LEDGER_HOST}/ledger/record", + json=payload, + headers=get_signed_headers(payload) + ) + + if response.status_code == 200: + return response.json() + elif response.status_code == 404: + # Record doesn't exist - platform must create first + raise RecordNotFoundError( + f"Ledger record not found for {trade.transaction_id}/{trade.order_item_id}" + ) + elif response.status_code == 403: + # Role not authorized to write these fields + raise AuthorizationError(response.json()) + else: + raise LedgerAPIError(response.status_code, response.json()) + + +def seller_discom_allocation_job( + delivery_slot: TimeSlot, + discom_id: str +): + """ + Round 1: Batch job run by seller discom after delivery period. + + Computes pro-rata allocations based on seller production and records to ledger. + This runs FIRST - buyer discoms will query these allocations in Round 2. + Marks statusSellerDiscom as PENDING (final status set in Round 3). + """ + # Get all trades for this discom in the delivery slot + trades = get_trades_by_seller_discom(discom_id, delivery_slot) + + # Group trades by seller + trades_by_seller = group_by(trades, key=lambda t: t.seller_id) + + for seller_id, seller_trades in trades_by_seller.items(): + # Get meter reading for this seller (production) + meter_reading = get_meter_reading(seller_id, delivery_slot, type="GENERATION") + + # Compute pro-rata allocation + allocations = compute_pro_rata_allocation(seller_id, meter_reading, seller_trades) + + # Record each allocation to ledger with PENDING status + for trade in seller_trades: + allocated_qty = allocations[trade.order_item_id] + record_discom_actuals( + role="SELLER_DISCOM", + trade=trade, + allocated_qty=allocated_qty, + status="PENDING" # Round 1: initial allocation, not yet final + ) + log.info(f"Seller Round 1 allocation recorded: {trade.order_item_id} = {allocated_qty} kWh") + + +def get_seller_allocations_from_ledger( + delivery_slot: TimeSlot, + discom_id: str +) -> dict[str, float]: + """ + Query ledger to get seller allocations recorded in Round 1. + Returns: {order_item_id: seller_allocated_qty} + """ + records = query_ledger_records(delivery_slot, discom_id=discom_id) + + seller_allocations = {} + for record in records: + seller_alloc = extract_allocation(record, "SELLER") + if seller_alloc is not None: + seller_allocations[record["orderItemId"]] = seller_alloc + + return seller_allocations + + +def compute_pro_rata_allocation_with_cap( + customer_id: str, + meter_reading: float, + trades: list[Trade], + other_party_allocations: dict[str, float] +) -> dict[str, float]: + """ + Pro-rata allocation capped at other party's allocation. + + Used in Round 2 (buyer caps at seller's Round 1 allocation) and + Round 3 (seller caps at buyer's Round 2 allocation). + + Returns: {order_item_id: allocated_qty} + """ + total_contracted = sum(t.contracted_kwh for t in trades) + + if total_contracted == 0: + return {t.order_item_id: 0.0 for t in trades} + + # Pro-rata factor: ratio of actual to contracted (capped at 1.0) + pro_rata_factor = min(1.0, meter_reading / total_contracted) + + allocations = {} + for trade in trades: + # Base pro-rata share + pro_rata_share = trade.contracted_kwh * pro_rata_factor + + # Cap at seller's allocation from Round 1 (if available) + seller_alloc = other_party_allocations.get(trade.order_item_id) + if seller_alloc is not None: + capped = min(pro_rata_share, seller_alloc) + else: + # Seller hasn't recorded yet - use pro-rata only + capped = pro_rata_share + + allocations[trade.order_item_id] = round(capped, 3) + + return allocations + + +def buyer_discom_allocation_job( + delivery_slot: TimeSlot, + discom_id: str +): + """ + Round 2: Batch job run by buyer discom after seller discoms have allocated (Round 1). + + 1. Queries ledger to get seller allocations from Round 1 + 2. Computes pro-rata allocations based on buyer consumption + 3. Caps each allocation at seller's allocation (can't pull more than pushed) + 4. Records to ledger with statusBuyerDiscom = COMPLETED + """ + # Get all trades for this discom in the delivery slot + trades = get_trades_by_buyer_discom(discom_id, delivery_slot) + + # Query seller allocations from Round 1 + seller_allocations = get_seller_allocations_from_ledger(delivery_slot, discom_id) + log.info(f"Retrieved {len(seller_allocations)} seller allocations from Round 1") + + # Group trades by buyer + trades_by_buyer = group_by(trades, key=lambda t: t.buyer_id) + + for buyer_id, buyer_trades in trades_by_buyer.items(): + # Get meter reading for this buyer (consumption) + meter_reading = get_meter_reading(buyer_id, delivery_slot, type="CONSUMPTION") + + # Compute pro-rata allocation, capped at seller's allocation + allocations = compute_pro_rata_allocation_with_cap( + buyer_id, + meter_reading, + buyer_trades, + seller_allocations + ) + + # Record each allocation to ledger + for trade in buyer_trades: + allocated_qty = allocations[trade.order_item_id] + seller_alloc = seller_allocations.get(trade.order_item_id, "N/A") + record_discom_actuals( + role="BUYER_DISCOM", + trade=trade, + allocated_qty=allocated_qty, + status="COMPLETED" # Round 2: buyer allocation is final + ) + log.info( + f"Buyer Round 2 allocation recorded: {trade.order_item_id} = {allocated_qty} kWh " + f"(capped at seller's {seller_alloc} kWh)" + ) + + +def get_buyer_allocations_from_ledger( + delivery_slot: TimeSlot, + discom_id: str +) -> dict[str, float]: + """ + Query ledger to get buyer allocations recorded in Round 2. + Returns: {order_item_id: buyer_allocated_qty} + """ + records = query_ledger_records(delivery_slot, discom_id=discom_id) + + buyer_allocations = {} + for record in records: + buyer_alloc = extract_allocation(record, "BUYER") + if buyer_alloc is not None: + buyer_allocations[record["orderItemId"]] = buyer_alloc + + return buyer_allocations + + +def seller_discom_reallocation_job( + delivery_slot: TimeSlot, + discom_id: str +): + """ + Round 3: Batch job run by seller discom after buyer discoms have allocated (Round 2). + + 1. Queries ledger to get buyer allocations from Round 2 + 2. Re-computes pro-rata allocations based on seller production + 3. Caps each allocation at buyer's allocation + 4. Records updated allocations to ledger with statusSellerDiscom = COMPLETED + + This allows redistribution: if a buyer took less than the seller initially + offered in Round 1, the seller can reallocate that surplus to other trades + where buyers accepted the full allocation. + """ + # Get all trades for this discom in the delivery slot + trades = get_trades_by_seller_discom(discom_id, delivery_slot) + + # Query buyer allocations from Round 2 + buyer_allocations = get_buyer_allocations_from_ledger(delivery_slot, discom_id) + log.info(f"Retrieved {len(buyer_allocations)} buyer allocations from Round 2") + + # Group trades by seller + trades_by_seller = group_by(trades, key=lambda t: t.seller_id) + + for seller_id, seller_trades in trades_by_seller.items(): + # Get meter reading for this seller (production) + meter_reading = get_meter_reading(seller_id, delivery_slot, type="GENERATION") + + # Re-compute pro-rata allocation, capped at buyer's Round 2 allocation + allocations = compute_pro_rata_allocation_with_cap( + seller_id, + meter_reading, + seller_trades, + buyer_allocations + ) + + # Record updated allocations to ledger with COMPLETED status + for trade in seller_trades: + allocated_qty = allocations[trade.order_item_id] + buyer_alloc = buyer_allocations.get(trade.order_item_id, "N/A") + record_discom_actuals( + role="SELLER_DISCOM", + trade=trade, + allocated_qty=allocated_qty, + status="COMPLETED" # Round 3: seller allocation is now final + ) + log.info( + f"Seller Round 3 re-allocation recorded: {trade.order_item_id} = {allocated_qty} kWh " + f"(capped at buyer's {buyer_alloc} kWh)" + ) +``` + +### Step 3: Platforms Read Final Settlement + +After all three discom allocation rounds are complete (both `statusSellerDiscom` and `statusBuyerDiscom` are `COMPLETED`), trading platforms and settlement engines can query the ledger to read the final converged allocations. The min-of-two rule is applied as a verification — after convergence, both allocations should agree. + +```python +def query_ledger_records( + delivery_slot: TimeSlot, + discom_id: str = None, + buyer_id: str = None, + seller_id: str = None +) -> list[LedgerRecord]: + """ + Query ledger records by filters. + Endpoint: POST /ledger/get + + Access control: Server enforces record-level and field-level visibility + based on caller identity. + """ + payload = { + "deliveryStartFrom": delivery_slot.start.isoformat() + "Z", + "deliveryStartTo": delivery_slot.end.isoformat() + "Z", + "limit": 500, + "offset": 0, + "sort": "deliveryStartTime", + "sortOrder": "asc" + } + + # Add optional filters + if discom_id: + payload["discomIdBuyer"] = discom_id # or discomIdSeller + if buyer_id: + payload["buyerId"] = buyer_id + if seller_id: + payload["sellerId"] = seller_id + + response = requests.post( + f"{LEDGER_HOST}/ledger/get", + json=payload, + headers=get_signed_headers(payload) + ) + + if response.status_code == 200: + result = response.json() + return result["records"] + else: + raise LedgerAPIError(response.status_code, response.json()) + + +def extract_allocation(record: LedgerRecord, role: str) -> float | None: + """ + Extract allocated quantity from ledger record for a given role. + """ + if role == "SELLER": + metrics = record.get("sellerFulfillmentValidationMetrics", []) + for m in metrics: + if m["validationMetricType"] == "ACTUAL_PUSHED": + return m["validationMetricValue"] + elif role == "BUYER": + metrics = record.get("buyerFulfillmentValidationMetrics", []) + for m in metrics: + if m["validationMetricType"] == "ACTUAL_PULLED": + return m["validationMetricValue"] + return None + + +def compute_settlement(record: LedgerRecord) -> SettlementResult: + """ + Apply min-of-two settlement rule to a ledger record. + + settle_k = min(buyer_allocation, seller_allocation) + """ + trade_qty = record["tradeDetails"][0]["tradeQty"] # Contracted quantity + + # Extract allocations from both discoms + seller_alloc = extract_allocation(record, "SELLER") + buyer_alloc = extract_allocation(record, "BUYER") + + # Handle missing allocations + if seller_alloc is None: + raise SettlementError( + f"Missing seller allocation for {record['recordId']}" + ) + if buyer_alloc is None: + raise SettlementError( + f"Missing buyer allocation for {record['recordId']}" + ) + + # Min-of-two rule + settled_qty = min(seller_alloc, buyer_alloc) + + return SettlementResult( + record_id=record["recordId"], + transaction_id=record["transactionId"], + order_item_id=record["orderItemId"], + contracted_qty=trade_qty, + seller_allocation=seller_alloc, + buyer_allocation=buyer_alloc, + settled_qty=settled_qty, + seller_shortfall=trade_qty - seller_alloc, + buyer_shortfall=trade_qty - buyer_alloc + ) + + +def settlement_batch_job(delivery_slot: TimeSlot): + """ + Main settlement job run after all 3 discom allocation rounds are complete. + Queries ledger, verifies convergence via min-of-two, generates billing records. + + After the 3-round convergence, seller_alloc (Round 3) should equal + buyer_alloc (Round 2) for each trade. The min-of-two serves as verification. + """ + # Query all records for the delivery slot + records = query_ledger_records(delivery_slot) + + settlements = [] + errors = [] + + for record in records: + try: + # Verify both discoms have recorded + if (record.get("statusSellerDiscom") not in ["COMPLETED", "CURTAILED_OUTAGE"] or + record.get("statusBuyerDiscom") not in ["COMPLETED", "CURTAILED_OUTAGE"]): + log.warning(f"Skipping {record['recordId']}: awaiting discom status") + continue + + settlement = compute_settlement(record) + settlements.append(settlement) + + log.info( + f"Settlement computed: {settlement.order_item_id} " + f"contracted={settlement.contracted_qty} " + f"seller_alloc={settlement.seller_allocation} " + f"buyer_alloc={settlement.buyer_allocation} " + f"settled={settlement.settled_qty}" + ) + + except SettlementError as e: + errors.append((record["recordId"], str(e))) + log.error(f"Settlement error for {record['recordId']}: {e}") + + # Generate billing records from settlements + generate_billing_records(settlements) + + return SettlementBatchResult( + delivery_slot=delivery_slot, + total_records=len(records), + settled_count=len(settlements), + error_count=len(errors), + errors=errors + ) +``` + +### Step 4: Billing Calculation from Settlement + +```python +@dataclass +class BillingRecord: + buyer_id: str + seller_id: str + settled_qty: float + p2p_cost: float # settled_qty × trade_price + wheeling_cost: float # settled_qty × wheeling_rate + grid_import: float # buyer_consumption - settled_qty + grid_cost: float # grid_import × grid_tariff + + +def generate_billing_records(settlements: list[SettlementResult]): + """ + Convert settlement results into billing line items. + """ + for s in settlements: + trade = get_trade(s.transaction_id, s.order_item_id) + + billing = BillingRecord( + buyer_id=trade.buyer_id, + seller_id=trade.seller_id, + settled_qty=s.settled_qty, + p2p_cost=s.settled_qty * trade.price_per_kwh, + wheeling_cost=s.settled_qty * trade.wheeling_rate, + grid_import=trade.buyer_meter_reading - s.settled_qty, + grid_cost=(trade.buyer_meter_reading - s.settled_qty) * get_grid_tariff() + ) + + # Persist billing record + save_billing_record(billing) + + # Trigger payment flows + initiate_buyer_to_seller_payment(billing) + initiate_buyer_to_utility_payment(billing) +``` + +### Error Handling Patterns + +```python +# Status codes and their meanings +LEDGER_ERROR_CODES = { + "SCH_FIELD_NOT_ALLOWED": "Field not allowed in request schema", + "SCH_MISSING_REQUIRED": "Required field missing", + "AUT_SIGNATURE_INVALID": "Request signature verification failed", + "AUT_NOT_AUTHORIZED": "Caller not authorized for this operation", + "PRC_CONFLICT": "Immutable field conflict on existing record", + "PRC_NOT_FOUND": "Target record not found", + "SRV_INTERNAL_ERROR": "Internal server error" +} + +def handle_ledger_error(response: requests.Response): + """ + Standard error handling for ledger API responses. + """ + error = response.json() + code = error.get("code") + message = error.get("message") + + if response.status_code == 400: + # Schema/validation error - fix request and retry + raise ValidationError(f"{code}: {message}") + + elif response.status_code == 401: + # Signature invalid - check signing key + raise AuthenticationError(f"{code}: {message}") + + elif response.status_code == 403: + # Not authorized - role cannot perform this action + raise AuthorizationError(f"{code}: {message}") + + elif response.status_code == 404: + # Record not found - platform must create first + raise RecordNotFoundError(f"{code}: {message}") + + elif response.status_code == 409: + # Conflict - immutable field mismatch + raise ConflictError(f"{code}: {message}") + + else: + raise LedgerAPIError(response.status_code, f"{code}: {message}") +``` + +### Sequence Diagram + +``` +┌─────────┐ ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐ +│ Buyer │ │ Seller │ │ Ledger │ │ Seller │ │ Buyer │ │Trading │ +│ Platform│ │ Platform│ │ Service │ │ Discom │ │ Discom │ │Platform│ +└────┬────┘ └────┬────┘ └────┬────┘ └────┬─────┘ └────┬─────┘ └───┬────┘ + │ │ │ │ │ │ + │ Trade Confirmed │ │ │ │ + │─────────────────────────> │ │ │ + │ POST /ledger/put │ │ │ │ + │ (create record) │ │ │ │ + │ │ │ │ │ │ + │ │<───────────│ │ │ │ + │ │ recordId │ │ │ │ + │ │ │ │ │ │ + │ │ │ │ + │ │ │ ══ ROUND 1: Seller Allocates (PENDING) ══ + │ │ │ Meter readings available │ + │ │ │ │ │ │ + │ │ │<───────────│ │ │ + │ │ │ POST /ledger/record │ │ + │ │ │ ACTUAL_PUSHED=70 kWh │ │ + │ │ │ statusSellerDiscom=PENDING │ + │ │ │───────────>│ │ │ + │ │ │ OK │ │ │ + │ │ │ │ │ │ + │ │ │ ══ ROUND 2: Buyer Allocates (COMPLETED) ══ + │ │ │ Buyer queries seller allocs │ + │ │ │ │ │ │ + │ │ │<────────────────────────── │ + │ │ │ POST /ledger/get │ + │ │ │ (get seller allocations) │ + │ │ │──────────────────────────> │ + │ │ │ ACTUAL_PUSHED=70 kWh │ + │ │ │ │ │ │ + │ │ │ │ Buyer computes pro-rata │ + │ │ │ │ consumption=80, cap at 70│ + │ │ │ │ │ │ + │ │ │<────────────────────────── │ + │ │ │ POST /ledger/record │ + │ │ │ ACTUAL_PULLED=70 kWh (capped) │ + │ │ │ statusBuyerDiscom=COMPLETED │ + │ │ │──────────────────────────> │ + │ │ │ OK │ │ │ + │ │ │ │ │ │ + │ │ │ ══ ROUND 3: Seller Re-Allocates (COMPLETED) ══ + │ │ │ Seller queries buyer allocs │ + │ │ │ │ │ │ + │ │ │<───────────│ │ │ + │ │ │ POST /ledger/get │ │ + │ │ │ (get buyer allocations) │ │ + │ │ │───────────>│ │ │ + │ │ │ ACTUAL_PULLED=70 kWh │ │ + │ │ │ │ │ │ + │ │ │ Seller re-computes, caps at buyer's 70│ + │ │ │ │ │ │ + │ │ │<───────────│ │ │ + │ │ │ POST /ledger/record │ │ + │ │ │ ACTUAL_PUSHED=70 kWh (confirmed) │ + │ │ │ statusSellerDiscom=COMPLETED │ + │ │ │───────────>│ │ │ + │ │ │ OK │ │ │ + │ │ │ │ │ │ + │ │ │ ══ SETTLEMENT: Platforms Read Final Status ══ + │ │ │ Both statuses COMPLETED │ + │ │ │ │ │ │ + │ │ │<─────────────────────────────────────│ + │ │ │ POST /ledger/get │ + │ │ │ (query by delivery slot) │ + │ │ │─────────────────────────────────────>│ + │ │ │ seller=70, buyer=70 (converged) │ + │ │ │ │ │ │ + │ │ │ │ │ settled = min(70, 70) = 70 kWh + │ │ │ │ │ → Generate billing +``` + +**Key insight:** The 3-round process ensures convergence. In Round 1, the seller discom sets the upper bound (70 kWh based on production). In Round 2, the buyer discom allocates within that bound (70 kWh, capped from 80 kWh consumption). In Round 3, the seller discom confirms by re-allocating within the buyer's bound. After convergence, both allocations agree, and the min-of-two verification yields `min(70, 70) = 70 kWh`. + +--- + +## 8. Summary + +| Aspect | Min-of-Two Settlement | +|--------|----------------------| +| Settlement rule | $\text{settle}_k = \min(a^B_k, a^S_k)$ | +| Allocation method | Pro-rata (recommended) | +| Flow | Seller allocates (PENDING) → Buyer allocates (COMPLETED) → Seller re-allocates (COMPLETED) | +| Optimality | 67-90% of global optimum in worst case | +| Complexity | Simple, no optimization solvers needed | + +The min-of-two approach satisfies our design principles: +- **Dispute-free:** Minimum is unambiguous +- **Shortfall accountability:** Underproduce/underconsume → reduced settlement +- **Independence:** Each utility allocates based only on its customers' meters +- **Existing flows:** No inter-utility payments required + +--- + +## 9. Consensus Rules for AI Summit + +The following time gates define the settlement schedule agreed upon for the AI Summit demonstration. These are specific deadlines for each round of the 3-round allocation flow. + +**Assumptions:** +- Delivery window: **6:00 AM to 7:00 AM** +- Meter data available with discoms by: **next day, 9:00 AM** + +| Round | Actor | Deadline | Action | Status Field | +|-------|-------|----------|--------|--------------| +| 1 | Seller Discom | 9:55 AM | Writes allocations (ACTUAL_PUSHED) to ledger | `statusSellerDiscom = PENDING` | +| 2 | Buyer Discom | 10:55 AM | Reads ledger (by 10:00 AM), writes allocations (ACTUAL_PULLED) capped at seller's Round 1 values | `statusBuyerDiscom = COMPLETED` | +| 3 | Seller Discom | 11:55 AM | Reads buyer allocations, writes final allocations capped at buyer's Round 2 values | `statusSellerDiscom = COMPLETED` | +| — | Trading Platforms | 12:00 PM (noon) | Read final settled status from ledger | Both statuses `COMPLETED` | + +``` +Timeline (AI Summit): + + Day 1 + ├── 06:00 AM Delivery window starts + └── 07:00 AM Delivery window ends + + Day 2 (next morning) + ├── 09:00 AM Meter data available with discoms + ├── 09:55 AM [Round 1] Seller discom writes allocations → statusSellerDiscom = PENDING + ├── 10:00 AM Buyer discom reads seller allocations from ledger + ├── 10:55 AM [Round 2] Buyer discom writes allocations → statusBuyerDiscom = COMPLETED + ├── 11:55 AM [Round 3] Seller discom writes final allocations → statusSellerDiscom = COMPLETED + └── 12:00 PM Trading platforms read final settlement status +``` + +**Notes:** +- All times refer to the day after the delivery window (D+1). +- Each round has a ~55-minute window to allow for batch processing across all trades in the delivery slot. +- The 5-minute gap between rounds (e.g., 9:55 AM finish → 10:00 AM read) allows the ledger to propagate writes before the next reader begins. +- If a discom misses its deadline, the trade remains in an incomplete state and must be handled through exception processes. + +--- + +# Appendix A: Deviation-Based Settlement (Alternative) + +This appendix describes an alternative settlement method based on **explicit deviation penalties** rather than reduced settlement quantities. + +## Overview + +| Aspect | Min-of-Two | Deviation Method | +|--------|------------|------------------| +| Inter-utility coordination | Required (3 rounds) | **Not required** | +| Penalty mechanism | Implicit (reduced settlement) | Explicit (deviation charges) | +| Revenue for compliant party | Depends on other party | **Guaranteed if you comply** | +| Complexity | Simpler billing | More line items | + +## Settlement Formulas + +**Buyer pays:** +$$\text{Buyer Payment} = \text{tr}_q \times \text{tr}_p - (\text{tr}_q - \text{load}_q) \times \text{exportBU}_p$$ + +- Pays full contract value +- Minus: credit for underconsumption (utility sells surplus at spot) + +**Seller receives:** +$$\text{Seller Revenue} = \text{tr}_q \times \text{tr}_p - (\text{tr}_q - \text{gen}_q) \times \text{importSU}_p$$ + +- Receives full contract value +- Minus: penalty for underproduction (utility procures shortfall) + +**Utility flows:** +- Seller utility receives: $(\text{tr}_q - \text{gen}_q) \times \text{importSU}_p$ +- Buyer utility pays: $(\text{tr}_q - \text{load}_q) \times \text{exportBU}_p$ + +**Zero-sum verification:** All flows balance to zero. + +## Example + +``` +Trade: 10 kWh @ 6 INR/kWh +Actuals: load_q = 8 kWh, gen_q = 7 kWh +Rates: exportBU_p = 4 INR, importSU_p = 8 INR + +Buyer pays: 10×6 - (10-8)×4 = 60 - 8 = 52 INR +Seller gets: 10×6 - (10-7)×8 = 60 - 24 = 36 INR +SU receives: (10-7)×8 = 24 INR +BU pays: (10-8)×4 = 8 INR + +Verify: 52 - 36 - 24 + 8 = 0 ✓ +``` + +## Key Properties + +**1. No coordination needed** +Each utility computes penalties independently based only on its customer's meter. + +**2. Contract compliance guarantees revenue** +If seller produces ≥ contract: receives full $\text{tr}_q \times \text{tr}_p$ regardless of buyer behavior. + +**3. Allocation doesn't affect total penalty** +Total penalty = (total contract - total meter) × rate. Independent of per-trade allocation. + +**4. Utility margin for risk** +Utilities can set $\text{importSU}_p > \text{rtm}_p$ and $\text{exportBU}_p < \text{rtm}_p$ to ensure no loss. + +## When to Use Which + +| Scenario | Recommended | +|----------|-------------| +| Intra-utility P2P (same DISCOM) | Min-of-two (simpler) | +| Inter-utility P2P (different DISCOMs) | **Deviation** (no coordination) | +| Regulatory requirement for energy tracing | Min-of-two | +| Revenue certainty for compliant parties | **Deviation** | + +--- + +# Appendix B: Detailed Optimality Analysis + +This appendix provides formal analysis of when the 3-round min-of-two allocation is suboptimal. + +## The Centralized Optimum + +If a central coordinator had all information, the optimal allocation maximizes total settlement: + +$$ +\begin{align} +\max_{a^B, a^S, z} \quad & \sum_{k \in \mathcal{T}} z_k \\ +\text{s.t.} \quad & z_k \leq a^B_k, \quad z_k \leq a^S_k & \forall k \\ +& \sum_{k: b(k)=i} a^B_k \leq m_i & \forall i \\ +& \sum_{k: s(k)=j} a^S_k \leq m_j & \forall j \\ +& 0 \leq a^B_k, a^S_k \leq \text{tr}_k & \forall k +\end{align} +$$ + +This is a **Linear Program (LP)** solvable in polynomial time. + +## Suboptimality Example: Cross-Linked Trades + +Consider this scenario with both-side shortfalls: + +``` +Trades: + T1: Buyer B1 ↔ Seller S1, quantity = 10 + T2: Buyer B1 ↔ Seller S2, quantity = 10 + T3: Buyer B2 ↔ Seller S1, quantity = 10 + +Meter readings: + B1 consumed = 15, B2 consumed = 10 + S1 produced = 15, S2 produced = 10 +``` + +**Pro-Rata Algorithm Result:** +- Seller allocations: S1 → T1=7.5, T3=7.5; S2 → T2=10 +- Buyer allocations: B1 → T1=7.5, T2=7.5; B2 → T3=10 +- Settlements: T1=min(7.5,7.5)=7.5, T2=min(10,7.5)=7.5, T3=min(7.5,10)=7.5 +- **Total settled: 22.5 kWh** + +**Optimal (LP Solution):** +- T1=5, T2=10, T3=10 +- Check: B1 uses 15 (5+10), B2 uses 10, S1 produces 15 (5+10), S2 produces 10 +- **Total settled: 25 kWh** + +**Gap:** 22.5/25 = 90% of optimal. + +## FIFO Can Be Worse + +With timestamp-based FIFO allocation (T1 < T2 < T3): + +- Round 1 (Sellers): S1 allocates T1=10, T3=5; S2 allocates T2=10 +- Round 2 (Buyers): B1 allocates T1=10, T2=5; B2 allocates T3=5 +- **Total settled: 20 kWh** (only 80% of optimal) + +## Theoretical Bounds + +**Worst-case approximation ratio:** The distributed algorithm achieves at least **67%** of optimal. + +**Tight example:** +``` +T1: B1 ↔ S1, quantity = 100 +T2: B1 ↔ S2, quantity = 100 +T3: B2 ↔ S1, quantity = 100 +Meters: B1=100, B2=100, S1=100, S2=100 + +FIFO (T1 first): T1=100, T2=0, T3=0 → 100 kWh +Optimal: T1=50, T2=50, T3=50 → 150 kWh +Ratio: 100/150 = 67% +``` + +**Practical performance:** In typical scenarios with mild, correlated shortfalls, the gap is much smaller (<10%). The 67% bound is a pathological worst case requiring: +- Both-side shortfalls +- Cross-linked bipartite trade graph +- Adversarial allocation order + +--- + +# Appendix C: Side-by-Side Method Comparison + +## Scenario + +``` +Trade: B1 (DISCOM-A) ↔ S1 (DISCOM-B) + - Contract: 100 kWh @ 6 INR/kWh = 600 INR + +Actuals: + - B1 consumed: 80 kWh (20 kWh underconsumption) + - S1 produced: 70 kWh (30 kWh underproduction) + +Rates: + - exportBU_p = 4 INR/kWh + - importSU_p = 8 INR/kWh + - Grid import = 10 INR/kWh +``` + +## Min-of-Two Result + +``` +Settlement = min(80, 70) = 70 kWh + +Buyer pays: + - P2P: 70 × 6 = 420 INR + - Grid: (80-70) × 10 = 100 INR + - Total: 520 INR for 80 kWh (6.50 INR/kWh effective) + +Seller receives: + - P2P: 70 × 6 = 420 INR + - Total: 420 INR for 70 kWh (6.00 INR/kWh effective) +``` + +## Deviation Result + +``` +Buyer pays: + - 100×6 - 20×4 = 520 INR (same) + +Seller receives: + - 100×6 - 30×8 = 360 INR (60 INR less) + +SU receives: 240 INR +BU pays: 80 INR +``` + +## Key Insight + +- **Buyer outcome:** Identical (520 INR) +- **Seller outcome:** Different + - Min-of-two: 420 INR + - Deviation: 360 INR (explicit penalty for 30 kWh shortfall) + +The deviation method penalizes the non-compliant party more explicitly, while min-of-two implicitly reduces settlement without explicit penalty attribution. + +## Principles Alignment + +| Principle | Min-of-Two | Deviation | +|-----------|------------|-----------| +| Shortfall responsibility | ✓ Implicit | ✓ Explicit | +| Independence | Partial (needs 3 rounds) | ✓ Full | +| Existing billing flows | ✓ | ✓ | +| No surprise for compliant | Partial | ✓ Full | +| Allocation-independent total | Partial | ✓ Full | + +Both methods satisfy the core principles; deviation provides stronger guarantees for independence and compliant-party protection at the cost of more explicit penalty accounting. diff --git a/docs/implementation-guides/v2/P2P_Trading/note-on-payment-in-p2p-trading-interdiscom.md b/docs/implementation-guides/v2/P2P_Trading/note-on-payment-in-p2p-trading-interdiscom.md new file mode 100644 index 00000000..9230ccd6 --- /dev/null +++ b/docs/implementation-guides/v2/P2P_Trading/note-on-payment-in-p2p-trading-interdiscom.md @@ -0,0 +1,1487 @@ +# Payment Design for Inter-Utility Peer to Peer Energy Trading + +Version 0.1 (Non-Normative) + +## Table of contents +- [1. Overview](#1-overview) +- [2. Design Principles](#2-design-principles) + - [2.1. Peer-to-Peer Transparency](#21-peer-to-peer-transparency) + - [2.2. Bill Component Transparency](#22-bill-component-transparency) + - [2.3. Settlement Flow](#23-settlement-flow) +- [3. Sequence Diagram](#3-sequence-diagram) +- [4. Payment Status Lifecycle](#4-payment-status-lifecycle) +- [5. Bill Components](#5-bill-components) +- [6. Message Flow Examples](#6-message-flow-examples) + - [6.1. on\_select: Settlement Quote + Accepted Payment Methods](#61-on_select-settlement-quote--accepted-payment-methods) + - [6.2. on\_init: Payment Terms Confirmation](#62-on_init-payment-terms-confirmation) + - [6.3. on\_confirm: Order Confirmation](#63-on_confirm-order-confirmation) + - [6.4. on\_update: Partial Delivery (Curtailment)](#64-on_update-partial-delivery-curtailment) + - [6.5. on\_status: Final Invoice (After Allocation)](#65-on_status-final-invoice-after-allocation) + - [6.6. on\_status: Settlement Complete](#66-on_status-settlement-complete) + - [6.7. on\_status: Trade Completed](#67-on_status-trade-completed) +- [7. Key Design Decisions](#7-key-design-decisions) + - [7.1. Why Platform-to-Platform Settlement?](#71-why-platform-to-platform-settlement) + - [7.2. Customer Agency](#72-customer-agency) + - [7.3. Discom's Role](#73-discoms-role) +- [8. Implementation Notes](#8-implementation-notes) + - [8.1. For Buyer Platforms (BAP)](#81-for-buyer-platforms-bap) + - [8.2. For Seller Platforms (BPP)](#82-for-seller-platforms-bpp) + +## 1. Overview + +This note documents the payment flow design for peer-to-peer energy trading across distribution companies (discoms). While trading platforms act as intermediaries facilitating transactions, the fundamental nature remains **peer-to-peer**: energy flows from one prosumer to another consumer, and payment should reflect this direct relationship. + +## 2. Design Principles + +### 2.1. Peer-to-Peer Transparency + +Even though payments flow through platforms (BAP → BPP), the underlying transaction is between two individuals: +- **Seller (Prosumer)**: Generates excess energy and sells it +- **Buyer (Consumer)**: Purchases energy from the seller + +Platforms act with **delegated agency** on behalf of their customers. This means: +- Each platform must provide **full visibility** to their own customer about applicable fees +- In future implementations, it is conceivable that customers may **pay sellers directly** + +### 2.2. Inter-Platform Privacy & Fee Transparency + +Platform fees are private to each platform and are **not disclosed in inter-platform protocol messages**. The `orderValue` in protocol messages only contains the **net settlement amount** between platforms (based on catalog prices). + +**Catalog prices** are inclusive of seller platform charges. During discovery, the buyer platform (BAP) adds its own fee on top for the buyer-facing display. + +**Recommendation for platforms:** +- **Buyer platforms (BAP)**: Disclose the buyer platform fee to the buyer upfront. Show the buyer: catalog price + buyer platform fee = total cost per unit. +- **Seller platforms (BPP)**: Disclose the seller platform fee to the seller upfront. The catalog price already includes the seller platform fee; the seller should understand their net earnings after the platform deduction. + +Optionally, platforms can also indicate the wheeling charges & deviation penalty that the utility will bill separately, outside this p2p transaction. That will give customers a full picture of all opportunity costs involved in engaging in a trade. + +This ensures informed consent while maintaining fee privacy between competing platforms. + +### 2.3. Settlement Flow + +The payment settlement follows a clear progression: +1. **Authorization**: Buyer platform verifies wallet balance or credit line covers total amount (catalog price + buyer platform fee) +2. **Allocation**: After energy delivery is confirmed via meter readings +3. **Final Invoice (via on_status)**: Buyer platform queries status; seller platform responds with invoice including BPP settlement account +4. **Settlement**: Money moves from buyer platform to seller platform (at catalog price), then seller platform deducts its fee and pays the seller + +## 3. Sequence Diagram + +```mermaid +sequenceDiagram + participant Buyer + participant BuyerPlatform as Buyer Platform (BAP) + participant SellerPlatform as Seller Platform (BPP) + participant Seller + + Note over Buyer, Seller: Discovery & Selection Phase + Buyer->>BuyerPlatform: Select energy offer + BuyerPlatform->>SellerPlatform: select + SellerPlatform-->>BuyerPlatform: on_select (settlement quote + accepted payment methods) + BuyerPlatform-->>Buyer: Show total: catalog price + buyer platform fee + + Note over Buyer, Seller: Initialization Phase + Buyer->>BuyerPlatform: Confirm intent to buy + BuyerPlatform->>BuyerPlatform: Check wallet/credit >= total amount + BuyerPlatform->>SellerPlatform: init + SellerPlatform-->>BuyerPlatform: on_init (payment terms + accepted methods) + + Note over Buyer, Seller: Confirmation Phase + BuyerPlatform->>BuyerPlatform: Reserve funds from wallet + BuyerPlatform->>SellerPlatform: confirm + SellerPlatform-->>BuyerPlatform: on_confirm (full order + payment AUTHORIZED) + + Note over Buyer, Seller: Energy Delivery Phase + Seller->>SellerPlatform: Energy injected to grid + SellerPlatform->>SellerPlatform: Record meter readings + + Note over Buyer, Seller: Settlement Phase + SellerPlatform->>SellerPlatform: Allocation complete + BuyerPlatform->>SellerPlatform: status + SellerPlatform-->>BuyerPlatform: on_status (final invoice + BPP settlement account + tracking URL) + BuyerPlatform->>BuyerPlatform: Deduct buyer platform fee + BuyerPlatform->>SellerPlatform: Transfer settlement amount + SellerPlatform->>SellerPlatform: Deduct seller platform fee + SellerPlatform->>Seller: Transfer seller earnings + BuyerPlatform->>SellerPlatform: status + SellerPlatform-->>BuyerPlatform: on_status (payment SETTLED) + BuyerPlatform-->>Buyer: Trade complete notification +``` + +## 4. Payment Status Lifecycle + +| Status | When | Meaning | +|--------|------|---------| +| `PENDING` | on_select | Awaiting buyer decision | +| `INITIATED` | init | Payment process started | +| `AUTHORIZED` | on_init → on_confirm | Funds reserved, trade approved | +| `ADJUSTED` | on_update (curtailment) | Amount changed due to partial delivery | +| `SETTLED` | on_status (settlement complete) | Money transferred to all parties | + +## 5. Inter-Platform Settlement Value + +The `beckn:orderValue` in protocol messages between BAP and BPP contains only the **net settlement amount** — the total value to be transferred from buyer platform to seller platform. Platform fees are not itemized in the protocol exchange. + +```json +{ + "currency": "USD", + "value": 4.05, + "description": "Inter-platform settlement at catalog prices (15 kWh × $0.15 + 10 kWh × $0.18). Catalog prices are inclusive of seller platform charges." +} +``` + +**How platform fees work (not part of protocol messages):** +- **Catalog price** ($0.15/kWh, $0.18/kWh) is set by the seller platform and includes the seller platform fee +- **Buyer platform** adds its own fee on top when presenting the price to the buyer +- **Settlement**: BAP pays BPP the catalog-price-based amount ($4.05). BPP deducts seller platform fee and pays the seller. BAP deducts buyer platform fee from what it collected from the buyer. + +## 6. Message Flow Examples + +### 6.1. on_select: Settlement Quote + Accepted Payment Methods + +At selection, the seller platform returns the inter-platform settlement quote and accepted payment methods. The settlement value is based on catalog prices (which are inclusive of seller platform charges). The buyer platform (BAP) adds its own fee when presenting the total to the buyer. + +
+on_select Response + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_select", + "timestamp": "2024-10-04T10:15:05Z", + "message_id": "msg-on-select-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderValue": { + "currency": "USD", + "value": 4.05, + "description": "Inter-platform settlement at catalog prices (15 kWh × $0.15 + 10 kWh × $0.18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:paymentStatus": "PENDING", + "beckn:acceptedPaymentMethod": ["UPI", "BANK_TRANSFER", "WALLET"] + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.15, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.18, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + } + } + } + } + ] + } + } +} + +``` +
+ +### 6.2. on_init: Payment Terms Confirmation + +The initialization response confirms accepted payment methods and the settlement amount. Settlement account details are **not exchanged at this stage** — the BPP settlement account is provided later at the final invoice stage. + +
+on_init Response + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "timestamp": "2024-10-04T10:20:05Z", + "message_id": "msg-on-init-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.15, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.18, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "USD", + "value": 4.05, + "description": "Inter-platform settlement at catalog prices (15 kWh × $0.15 + 10 kWh × $0.18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "USD", + "value": 4.05 + }, + "beckn:acceptedPaymentMethod": ["UPI", "BANK_TRANSFER", "WALLET"], + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED" + } + } + } +} + +``` +
+ +### 6.3. on_confirm: Order Confirmation + +The confirmation response returns the full order details with payment status AUTHORIZED, mirroring the information from on_init. This serves as the definitive record of the agreed trade terms. + +
+on_confirm Response + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "timestamp": "2024-10-04T10:25:05Z", + "message_id": "msg-on-confirm-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.15, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.18, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "USD", + "value": 4.05, + "description": "Inter-platform settlement at catalog prices (15 kWh × $0.15 + 10 kWh × $0.18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "USD", + "value": 4.05 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED" + } + } + } +} + +``` +
+ +### 6.4. on_update: Partial Delivery (Curtailment) + +If delivery is curtailed (e.g., grid outage), the seller platform pushes an update with the adjusted settlement amount reflecting actual delivered energy. + +
+on_update Curtailment + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "timestamp": "2024-10-04T14:30:00Z", + "message_id": "msg-on-update-curtailment-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "INPROGRESS", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 8.5, + "curtailedQuantity": 6.5, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 8.5, + "allocatedEnergy": 8.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.15, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "USD", + "value": 1.28, + "description": "Adjusted inter-platform settlement for delivered quantity (8.5 kWh × $0.15). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "USD", + "value": 1.28 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "ADJUSTED" + } + } + } +} + +``` +
+ +### 6.5. on_status: Final Invoice (After Allocation) + +After energy allocation is complete, the buyer platform queries status. The seller platform responds with the final invoice including: +- Final settlement amount based on actual delivered quantities +- BPP settlement account for payment transfer +- Payment tracking URL for transparency + +
+on_status Final Invoice + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T18:15:00Z", + "message_id": "msg-on-status-final-invoice-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "INPROGRESS", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 15.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 15.0, + "allocatedEnergy": 15.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.15, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T12:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 10.0, + "allocatedEnergy": 10.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.18, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "USD", + "value": 4.05, + "description": "Inter-platform settlement at catalog prices (15 kWh × $0.15 + 10 kWh × $0.18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "USD", + "value": 4.05 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED", + "beckn:acceptedPaymentMethod": ["UPI", "BANK_TRANSFER"], + "beckn:paymentURL": "https://payments.seller-platform.com/track?txn=TXN-ENERGY-001", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "bpp.energy-provider.com", + "accountHolderName": "Solar Farm Energy Provider Pvt Ltd", + "accountNumber": "9876543210", + "ifscCode": "ICICI0005678", + "bankName": "ICICI Bank", + "vpa": "solar-provider@upi" + } + ] + } + } + } + } +} + +``` +
+ +### 6.6. on_status: Settlement Complete + +Once money has moved from buyer platform to seller platform (tracked via URL), the buyer platform queries status again and the seller platform confirms the trade as settled. + +
+on_status Settlement Complete + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T18:45:00Z", + "message_id": "msg-on-status-settlement-complete-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "COMPLETED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": ["energy-resource-solar-001"] + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": ["energy-resource-solar-001"] + } + } + ], + "beckn:orderValue": { + "currency": "USD", + "value": 4.05, + "description": "Inter-platform settlement at catalog prices (15 kWh × $0.15 + 10 kWh × $0.18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "USD", + "value": 4.05 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "SETTLED", + "beckn:paidAt": "2024-10-04T18:40:00Z", + "beckn:txnRef": "TXN-ENERGY-001-SETTLED" + } + } + } +} + +``` +
+ +### 6.7. on_status: Trade Completed + +Final status shows the order and payment as complete. + +
+on_status Completed + +```json +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T18:30:00Z", + "message_id": "msg-on-status-completed-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "COMPLETED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 15.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + }, + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T09:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T12:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.15, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "BESCOM-CUST-001", + "utilityId": "BESCOM-KA" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T12:00:00Z", + "schema:endTime": "2024-10-04T15:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 5.0, + "allocatedEnergy": 5.0, + "unit": "kWh" + }, + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T15:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 5.0, + "allocatedEnergy": 5.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.18, + "schema:priceCurrency": "USD", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "USD", + "value": 4.05, + "description": "Inter-platform settlement at catalog prices (15 kWh × $0.15 + 10 kWh × $0.18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "USD", + "value": 4.05 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "SETTLED", + "beckn:paidAt": "2024-10-04T19:00:00Z" + } + } + } +} + +``` +
+ +## 7. Key Design Decisions + +### 7.1. Why Platform-to-Platform Settlement? + +While the trade is peer-to-peer, platform-to-platform settlement provides: +1. **Credit management**: Platforms can extend goodwill credit to customers +2. **Wallet management**: Customers can pre-fund wallets for faster trades +3. **Dispute resolution**: Platforms can mediate if issues arise +4. **Regulatory compliance**: Platforms handle KYC/AML requirements + +### 7.2. Customer Agency + +Despite platform intermediation: +- **Fee transparency to own customers**: Each platform is recommended to fully disclose its fees to its own customers — buyer platform fee to buyers, seller platform fee to sellers +- **Inter-platform privacy**: Platform fees are not disclosed in protocol messages between BAP and BPP, preventing competitive information leakage +- **Settlement transparency**: Tracking URLs allow platforms to verify fund movement +- **Future optionality**: The protocol supports direct peer-to-peer payment in future versions +- **Choice of platform**: Customers can choose platforms based on fees and services + +### 7.3. Discom's Role + +Discoms (distribution companies) are privy to: +- **Trade volumes only**: For grid management and wheeling fee calculation +- **Wheeling fees**: Charged separately in monthly utility bills +- **No double billing**: Peer-traded energy is excluded from regular consumption billing + +## 8. Implementation Notes + +### 8.1. For Buyer Platforms (BAP) + +1. **Before confirm**: Verify `wallet_balance + goodwill_credit >= catalog_price_total + buyer_platform_fee` +2. **Disclose buyer fee**: Show the buyer the total cost upfront (catalog price + buyer platform fee per unit) +3. **On final invoice (on_status)**: Validate settlement amount matches agreed catalog prices +4. **Settlement**: Deduct buyer platform fee from buyer's payment, transfer settlement amount to BPP +5. **Tracking**: Poll status and monitor payment URL until SETTLED status received + +### 8.2. For Seller Platforms (BPP) + +1. **Catalog pricing**: Set catalog prices inclusive of seller platform fee. Disclose the fee breakdown to sellers so they understand their net earnings. +2. **On select**: Return inter-platform settlement quote (catalog-price-based) and accepted payment methods +3. **On init**: Confirm payment terms and accepted methods (no settlement accounts at this stage) +4. **After allocation (on_status)**: Provide final invoice with BPP settlement account and tracking URL +5. **On payment receipt**: Deduct seller platform fee, pay seller their net earnings, update status to SETTLED + +--- + +*This design ensures that while platforms facilitate the transaction, customers remain the principals in a true peer-to-peer energy trade.* diff --git a/docs/implementation-guides/v2/P2P_Trading/taxonomy.md b/docs/implementation-guides/v2/P2P_Trading/taxonomy.md deleted file mode 100644 index f060747f..00000000 --- a/docs/implementation-guides/v2/P2P_Trading/taxonomy.md +++ /dev/null @@ -1,253 +0,0 @@ -# P2P Energy Trading Taxonomy Reference - -## Overview - -This document provides a comprehensive reference for all enumerations and taxonomies used in P2P Energy Trading schemas. - -## Energy Source Types - -**Schema**: `EnergyResource.sourceType`, `EnergyTradeContract.sourceType` - -| Value | Description | Use Case | -|-------|-------------|----------| -| `SOLAR` | Solar photovoltaic energy | Solar panels, rooftop solar | -| `BATTERY` | Battery storage energy | Battery systems, energy storage | -| `GRID` | Grid-sourced energy | Traditional utility grid | -| `HYBRID` | Hybrid energy source | Combination of multiple sources | -| `RENEWABLE` | Renewable energy (unspecified) | General renewable energy category | - -**Notes**: -- Source type influences pricing but not workflow -- Source verification occurs at onboarding but can change post-onboarding -- Example: Switching from solar to diesel backup - -## Delivery Modes - -**Schema**: `EnergyResource.deliveryMode`, `EnergyTradeDelivery.deliveryMode` - -| Value | Description | Use Case | -|-------|-------------|----------| -| `EV_CHARGING` | Electric vehicle charging | Direct EV charging | -| `BATTERY_SWAP` | Battery swap service | Battery exchange stations | -| `V2G` | Vehicle-to-Grid | EVs feeding energy back to grid | -| `GRID_INJECTION` | Grid injection | Energy injected into utility grid | - -**Notes**: -- Used as discovery filter to match consumer requirements -- Determines delivery mechanism for energy transfer - -## Pricing Models - -**Schema**: `EnergyTradeOffer.pricingModel` - -| Value | Description | Use Case | -|-------|-------------|----------| -| `PER_KWH` | Per kilowatt-hour pricing | Standard energy pricing | -| `TIME_OF_DAY` | Time-of-day pricing | Variable rates by time period | -| `SUBSCRIPTION` | Subscription-based pricing | Fixed monthly/annual pricing | -| `FIXED` | Fixed price | Flat rate pricing | - -**Notes**: -- `TIME_OF_DAY` requires `timeOfDayRates` array -- `PER_KWH` is most common for P2P energy trading - -## Settlement Types - -**Schema**: `EnergyTradeOffer.settlementType` - -| Value | Description | Frequency | Use Case | -|-------|-------------|-----------|----------| -| `REAL_TIME` | Real-time settlement | Continuous | Instant payment processing | -| `HOURLY` | Hourly settlement | Every hour | High-frequency trading | -| `DAILY` | Daily settlement | Once per day | Standard P2P trading | -| `WEEKLY` | Weekly settlement | Once per week | Long-term contracts | -| `MONTHLY` | Monthly settlement | Once per month | Subscription-based trading | - -**Notes**: -- Determines when payments are processed -- Default: `DAILY` (see profile.json) -- Settlement cycles tracked in `EnergyTradeContract.settlementCycles` - -## Contract Status - -**Schema**: `EnergyTradeContract.contractStatus` - -| Value | Description | Lifecycle Stage | -|-------|-------------|-----------------| -| `PENDING` | Contract pending activation | After init, before confirm | -| `ACTIVE` | Contract is active | After confirm, during fulfillment | -| `COMPLETED` | Contract completed | After successful fulfillment | -| `TERMINATED` | Contract terminated | Cancelled or failed | - -**Notes**: -- Decouples trade from fulfillment -- Generator, transmitter, and consumer operate independently -- Status progression: PENDING → ACTIVE → COMPLETED - -## Delivery Status - -**Schema**: `EnergyTradeDelivery.deliveryStatus` - -| Value | Description | Stage | -|-------|-------------|-------| -| `PENDING` | Delivery pending | Before delivery starts | -| `IN_PROGRESS` | Delivery in progress | Active energy transfer | -| `COMPLETED` | Delivery completed | Successful completion | -| `FAILED` | Delivery failed | Failed or cancelled | - -**Notes**: -- Handles recurring or continuous fulfillment scenarios -- Multiple deliveries can be tied to a single contract -- Status updates as meter readings arrive - -## Settlement Cycle Status - -**Schema**: `EnergyTradeContract.settlementCycles[].status` - -| Value | Description | Stage | -|-------|-------------|-------| -| `PENDING` | Settlement pending | Awaiting settlement | -| `SETTLED` | Settlement completed | Payment processed | -| `FAILED` | Settlement failed | Payment processing failed | - -**Notes**: -- Each settlement cycle tracks its own status -- Status updates when settlement is processed -- Failed settlements may be retried - -## Billing Cycle Status - -**Schema**: `EnergyTradeContract.billingCycles[].status` - -| Value | Description | Stage | -|-------|-------------|-------| -| `PENDING` | Billing pending | Awaiting payment | -| `PAID` | Payment received | Payment completed | -| `OVERDUE` | Payment overdue | Payment past due date | - -**Notes**: -- Supports ongoing connections billed periodically -- Multiple billing cycles per contract -- Status updates when payment is received - -## Telemetry Metric Names - -**Schema**: `EnergyTradeDelivery.telemetry[].metrics[].name` - -| Value | Description | Unit Code | Use Case | -|-------|-------------|-----------|----------| -| `ENERGY` | Energy delivered | `KWH` | Total energy in kilowatt-hours | -| `POWER` | Power level | `KW` | Instantaneous power in kilowatts | -| `FLOW_RATE` | Energy flow rate | `KW` | Rate of energy transfer | -| `VOLTAGE` | Voltage level | `VLT` | Grid voltage in volts | -| `CURRENT` | Current level | `AMP` | Current in amperes | -| `FREQUENCY` | Frequency | `HZ` | Grid frequency in hertz | -| `POWER_QUALITY` | Power quality metric | dimensionless | Power quality indicator | - -**Notes**: -- All metrics use `schema:QuantitativeValue` structure -- Unit codes must match metric type -- Update frequency: Every 5-15 minutes during active delivery - -## Payment Types - -**Schema**: Core `Payment.type` (not in Energy* schemas) - -| Value | Description | Timing | -|-------|-------------|--------| -| `PRE-ORDER` | Payment before order | Before order confirmation | -| `ON-FULFILLMENT` | Payment during fulfillment | During energy delivery | -| `POST-FULFILLMENT` | Payment after fulfillment | After delivery completion | - -**Notes**: -- Defined in core Payment schema -- Most common for energy trading: `ON-FULFILLMENT` - -## Payment Status - -**Schema**: Core `Payment.status` (not in Energy* schemas) - -| Value | Description | -|-------|-------------| -| `PAID` | Payment received | -| `NOT-PAID` | Payment not yet received | - -## Payment Collected By - -**Schema**: Core `Payment.collected_by` (not in Energy* schemas) - -| Value | Description | -|-------|-------------| -| `BAP` | Collected by Buyer App Platform | -| `BPP` | Collected by Provider Platform | - -**Notes**: -- BPP collection is most common for energy trading -- BAP collection requires pre-payment - -## Fulfillment Stop Types - -**Schema**: Core `Stop.type` (not in Energy* schemas) - -| Value | Description | Required Fields | -|-------|-------------|-----------------| -| `START` | Source location | `location.address` (source meter ID) | -| `END` | Target location | `location.address` (target meter ID) | - -**Notes**: -- At least one END stop is required -- Meter IDs in `location.address` use IEEE mRID format -- START stop: Source meter (generator) -- END stop: Target meter (consumer) - -## Certification Status Examples - -**Schema**: `EnergyResource.certificationStatus` (free-form string) - -Common values: -- `"Carbon Offset Certified"` -- `"Green Energy Certified"` -- `"Renewable Energy Certified"` -- `"ISO 14001 Certified"` - -**Notes**: -- Free-form string (not an enum) -- Used for compliance and marketing -- Detailed certificates in `sourceVerification.certificates` - -## Unit Codes - -**Schema**: `EnergyTradeDelivery.telemetry[].metrics[].unitCode` - -| Metric | Unit Code | Description | -|--------|-----------|-------------| -| `ENERGY` | `KWH` | Kilowatt-hours | -| `POWER` | `KW` | Kilowatts | -| `FLOW_RATE` | `KW` | Kilowatts | -| `VOLTAGE` | `VLT` | Volts | -| `CURRENT` | `AMP` | Amperes | -| `FREQUENCY` | `HZ` | Hertz | -| `POWER_QUALITY` | (dimensionless) | No unit | - -## Summary Table - -| Category | Enum Values | Schema Location | -|----------|-------------|----------------| -| Energy Source Types | SOLAR, BATTERY, GRID, HYBRID, RENEWABLE | `EnergyResource.sourceType`, `EnergyTradeContract.sourceType` | -| Delivery Modes | EV_CHARGING, BATTERY_SWAP, V2G, GRID_INJECTION | `EnergyResource.deliveryMode`, `EnergyTradeDelivery.deliveryMode` | -| Pricing Models | PER_KWH, TIME_OF_DAY, SUBSCRIPTION, FIXED | `EnergyTradeOffer.pricingModel` | -| Settlement Types | REAL_TIME, HOURLY, DAILY, WEEKLY, MONTHLY | `EnergyTradeOffer.settlementType` | -| Contract Status | PENDING, ACTIVE, COMPLETED, TERMINATED | `EnergyTradeContract.contractStatus` | -| Delivery Status | PENDING, IN_PROGRESS, COMPLETED, FAILED | `EnergyTradeDelivery.deliveryStatus` | -| Settlement Cycle Status | PENDING, SETTLED, FAILED | `EnergyTradeContract.settlementCycles[].status` | -| Billing Cycle Status | PENDING, PAID, OVERDUE | `EnergyTradeContract.billingCycles[].status` | -| Telemetry Metrics | ENERGY, POWER, FLOW_RATE, VOLTAGE, CURRENT, FREQUENCY, POWER_QUALITY | `EnergyTradeDelivery.telemetry[].metrics[].name` | - -## Usage Guidelines - -1. **Enum Values**: Always use uppercase with underscores (e.g., `SOLAR`, `GRID_INJECTION`) -2. **Case Sensitivity**: Enum values are case-sensitive -3. **Validation**: Validate enum values against this taxonomy -4. **Extensibility**: Do not add custom enum values; use free-form strings for extensions -5. **Documentation**: Document any custom values used in certification status or other free-form fields - diff --git a/examples/enrollment/v2/README.md b/examples/enrollment/v2/README.md new file mode 100644 index 00000000..c2f03752 --- /dev/null +++ b/examples/enrollment/v2/README.md @@ -0,0 +1,53 @@ +# Enrollment Examples + +This directory contains JSON examples for the enrollment/onboarding flow for Digital Energy Programs. + +## Files + +### Init Requests +- **init-request-simple-consumer.json** - Simple consumer with single meter enrolling in a demand flexibility program +- **init-request-prosumer-solar-battery.json** - Prosumer with solar and battery DERs enrolling in a P2P trading program + +### On_Init Responses +- **on-init-response-success.json** - Successful credential verification with no conflicts +- **on-init-response-conflict.json** - Enrollment conflict detected (meter already enrolled) +- **on-init-response-error.json** - Credential verification failed + +### Confirm Request +- **confirm-request.json** - Confirm request with enrollment start and end dates + +### On_Confirm Response +- **on-confirm-response-success.json** - Successful enrollment with issued credential + +### Update Requests (Revocation/Unenrollment) +- **update-request-consent-revocation.json** - Request to revoke a consent credential +- **update-request-unenrollment.json** - Request to unenroll from a program + +### On_Update Responses +- **on-update-response-consent-revocation.json** - Confirmation of consent revocation with status list details +- **on-update-response-unenrollment.json** - Confirmation of unenrollment with all credential revocations + +## Usage + +These examples are embedded in the implementation guide using the `embed_example_json.py` script. The examples are referenced using `
` blocks in the markdown file. + +To update the embedded examples in the guide, run: +```bash +python3 scripts/embed_example_json.py docs/implementation-guides/v2/Onboarding/IG_Onboarding_users_in_digital_energy_programs.md +``` + +## Schema + +All examples use the `EnergyEnrollment` schema defined at: +- Context: `https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld` +- Attributes: `../protocol-specifications-new/schema/EnergyEnrollment/v0.2/attributes.yaml` + +## Revocation Mechanism + +Consent and enrollment credentials use W3C VC Status Lists (BitstringStatusList) for revocation: + +1. **Consent Revocation**: User revokes consent via `update` action → BPP updates status list → Future verifications fail +2. **Unenrollment**: User unenrolls via `update` action → BPP revokes enrollment VC and all consent VCs → All credentials added to status lists + +Verifiers must check status lists before accepting credentials. Status lists use bitstrings for efficient and privacy-preserving revocation checks as per [W3C VC Data Model v2.0](https://www.w3.org/TR/vc-data-model-2.0/). + diff --git a/examples/enrollment/v2/confirm-request-oauth2.json b/examples/enrollment/v2/confirm-request-oauth2.json new file mode 100644 index 00000000..13c02e70 --- /dev/null +++ b/examples/enrollment/v2/confirm-request-oauth2.json @@ -0,0 +1,58 @@ +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:00Z", + "message_id": "msg-confirm-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEyMzQ1IiwiYXVkIjoicHJvZ3JhbS1vd25lci1icHAiLCJpc3MiOiJodHRwczovL3V0aWxpdHktaWRwLmV4YW1wbGUuY29tIiwiaWF0IjoxNzI5MDAwMDAwLCJleHAiOjE3MjkwMDM2MDB9.signature" + }, + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z" + } + } + } +} diff --git a/examples/enrollment/v2/confirm-request-otp.json b/examples/enrollment/v2/confirm-request-otp.json new file mode 100644 index 00000000..0204645b --- /dev/null +++ b/examples/enrollment/v2/confirm-request-otp.json @@ -0,0 +1,62 @@ +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:33:00Z", + "message_id": "msg-confirm-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "mobile": "+919999999999", + "nguid": "LQUejkRbBL9nJGQiqbComfQ242AHnbG3hnwWdHJut59jqmdJygnVHoiyDcnAUrKm", + "otp": "123456", + "utilityCustomerId": "CUST-123456", + "userType": "CONSUMER" + }, + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z" + } + } + } +} diff --git a/examples/enrollment/v2/confirm-request.json b/examples/enrollment/v2/confirm-request.json new file mode 100644 index 00000000..eb0338e5 --- /dev/null +++ b/examples/enrollment/v2/confirm-request.json @@ -0,0 +1,60 @@ +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:00Z", + "message_id": "msg-confirm-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "consents": [ + { + "type": "DATA_COLLECTION", + "granted": true, + "grantedAt": "2024-10-15T10:33:00Z", + "description": "Consent to collect and share meter data for program participation" + }, + { + "type": "DER_CONTROL", + "granted": false, + "description": "Consent to control DER devices for demand response (not applicable for this enrollment)" + } + ] + } + } + } +} diff --git a/examples/enrollment/v2/init-request-oauth2.json b/examples/enrollment/v2/init-request-oauth2.json new file mode 100644 index 00000000..2eaa814f --- /dev/null +++ b/examples/enrollment/v2/init-request-oauth2.json @@ -0,0 +1,53 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:00Z", + "message_id": "msg-init-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEyMzQ1IiwiYXVkIjoicHJvZ3JhbS1vd25lci1icHAiLCJpc3MiOiJodHRwczovL3V0aWxpdHktaWRwLmV4YW1wbGUuY29tIiwiaWF0IjoxNzI5MDAwMDAwLCJleHAiOjE3MjkwMDM2MDB9.signature", + "idToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTEyMzQ1IiwibmFtZSI6IlJhamVzaCBLdW1hciIsImVtYWlsIjoicmFqZXNoQGV4YW1wbGUuY29tIiwiaXNzIjoiaHR0cHM6Ly91dGlsaXR5LWlkcC5leGFtcGxlLmNvbSIsImlhdCI6MTcyOTAwMDAwMCwiZXhwIjoxNzI5MDAzNjAwfQ.signature" + }, + "customer": { + "name": "Rajesh Kumar" + } + } + } + } +} diff --git a/examples/enrollment/v2/init-request-otp.json b/examples/enrollment/v2/init-request-otp.json new file mode 100644 index 00000000..a9f40c9c --- /dev/null +++ b/examples/enrollment/v2/init-request-otp.json @@ -0,0 +1,54 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:00Z", + "message_id": "msg-init-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "mobile": "+919999999999", + "utilityCustomerId": "CUST-123456", + "userType": "CONSUMER" + }, + "customer": { + "name": "Rajesh Kumar" + } + } + } + } +} diff --git a/examples/enrollment/v2/init-request-prosumer-solar-battery.json b/examples/enrollment/v2/init-request-prosumer-solar-battery.json new file mode 100644 index 00000000..2aaf897a --- /dev/null +++ b/examples/enrollment/v2/init-request-prosumer-solar-battery.json @@ -0,0 +1,81 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T11:00:00Z", + "message_id": "msg-init-prosumer-001", + "transaction_id": "txn-onboard-prosumer-001", + "bap_id": "ea-portal.example.com", + "bap_uri": "https://ea-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-prosumer-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-p2p-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:prosumer-789" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-vpp-p2p-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-prosumer-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING", + "beckn:deliveryAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "meters": [ + { + "meterId": "umid-002", + "utilityId": "utility-example-001" + } + ], + "ders": [ + { + "derId": "der-solar-001", + "type": "SOLAR_PV", + "capacityValue": 10.0, + "capacityUnit": "kW" + }, + { + "derId": "der-battery-001", + "type": "BATTERY_STORAGE", + "capacityValue": 15.0, + "capacityUnit": "kWh" + } + ] + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "mobile": "+919876543210", + "userType": "PROSUMER" + }, + "meterOwnershipCredential": { + "credentialId": "vc-meter-ownership-002", + "type": "MeterOwnershipCredential", + "format": "VC-JWT", + "credentialData": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", + "verificationUrl": "https://utility-example-001.com/verify/vc-meter-ownership-002" + } + } + } + } +} diff --git a/examples/enrollment/v2/init-request-simple-consumer.json b/examples/enrollment/v2/init-request-simple-consumer.json new file mode 100644 index 00000000..e21db683 --- /dev/null +++ b/examples/enrollment/v2/init-request-simple-consumer.json @@ -0,0 +1,67 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:00Z", + "message_id": "msg-init-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING", + "beckn:deliveryAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "customer": { + "name": "Rajesh Kumar", + "email": "rajesh.kumar@example.com" + }, + "meters": [ + { + "meterId": "umid-001", + "utilityId": "utility-example-001" + } + ], + "ders": [] + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "meterOwnershipCredential": { + "credentialId": "vc-meter-ownership-001", + "type": "MeterOwnershipCredential", + "format": "VC-JWT", + "credentialData": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiTWV0ZXJPd25lcnNoaXBDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmV4YW1wbGU6dXNlci0xMjM0NSIsIm1ldGVySWQiOiJ1bWlkLTAwMSIsInV0aWxpdHlJZCI6InV0aWxpdHktZXhhbXBsZS0wMDEiLCJvd25lcnNoaXBTdGF0dXMiOiJPV05FUiIsInZhbGlkRnJvbSI6IjIwMjQtMDEtMDFUMDA6MDA6MDBaIiwidmFsaWRVbnRpbCI6IjIwMjUtMTItMzFUMjM6NTk6NTlaIn19LCJpc3MiOiJkaWQ6ZXhhbXBsZTp1dGlsaXR5LWNyZWRlbnRpYWwtaXNzdWVyIiwiaWF0IjoxNzA0MDY3MjAwfQ.signature", + "verificationUrl": "https://utility-example-001.com/verify/vc-meter-ownership-001" + } + } + } + } +} diff --git a/examples/enrollment/v2/on-confirm-response-no-meter.json b/examples/enrollment/v2/on-confirm-response-no-meter.json new file mode 100644 index 00000000..74d14ec0 --- /dev/null +++ b/examples/enrollment/v2/on-confirm-response-no-meter.json @@ -0,0 +1,64 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:05Z", + "message_id": "msg-on-confirm-no-meter-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "FAILED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + } + } + }, + "error": { + "code": "BIZ_NO_METER_SPECIFIED", + "message": "No meter specified for enrollment. Please select from available meters.", + "details": { + "path": "$.message.order.orderAttributes.meters", + "availableMeters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "address": "123 Main Street, Bangalore", + "sanctionedLoad": 5.0, + "connectionType": "residential" + }, + { + "meterId": "umid-002", + "meterNumber": "MTR-987654322", + "address": "456 Oak Avenue, Bangalore", + "sanctionedLoad": 10.0, + "connectionType": "commercial" + } + ] + } + } +} diff --git a/examples/enrollment/v2/on-confirm-response-oauth2.json b/examples/enrollment/v2/on-confirm-response-oauth2.json new file mode 100644 index 00000000..dbb7cc4d --- /dev/null +++ b/examples/enrollment/v2/on-confirm-response-oauth2.json @@ -0,0 +1,86 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:05Z", + "message_id": "msg-on-confirm-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:orderNumber": "ENR-2024-OAUTH-001234", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "verified": true, + "verifiedAt": "2024-10-15T10:35:05Z", + "subject": "user-12345", + "issuer": "https://utility-idp.example.com", + "message": "Token verified successfully" + }, + "enrollmentId": "enrollment-oauth2-001", + "status": "ACTIVE", + "programId": "program-p2p-trading-001", + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "sanctionedLoad": 5.0, + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "enrolledAt": "2024-10-15T10:35:05Z", + "loggedAt": "2024-10-15T10:35:05Z", + "logReference": "log-enrollment-oauth2-001", + "credential": { + "credentialId": "vc:enrollment:oauth2-001", + "type": "ProgramEnrollmentCredential", + "format": "VC-JWT", + "credentialUrl": "https://vpp-program-owner.example.com/credentials/vc:enrollment:oauth2-001", + "verificationUrl": "https://vpp-program-owner.example.com/verify/vc:enrollment:oauth2-001", + "issuedAt": "2024-10-15T10:35:05Z" + }, + "p2pdetails": { + "usertype": "consumer", + "isp2pactive": true, + "iscaactive": false, + "meternumber": "MTR-987654321", + "sdload": "5.0", + "cuflimit": "10.0" + } + } + } + } +} diff --git a/examples/enrollment/v2/on-confirm-response-otp.json b/examples/enrollment/v2/on-confirm-response-otp.json new file mode 100644 index 00000000..3ff6345f --- /dev/null +++ b/examples/enrollment/v2/on-confirm-response-otp.json @@ -0,0 +1,85 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:33:05Z", + "message_id": "msg-on-confirm-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:orderNumber": "ENR-2024-OTP-001234", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "verified": true, + "verifiedAt": "2024-10-15T10:33:05Z", + "message": "OTP verification successful", + "utilityCustomerId": "CUST-123456" + }, + "enrollmentId": "enrollment-otp-001", + "status": "ACTIVE", + "programId": "program-p2p-trading-001", + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "sanctionedLoad": 5.0, + "connectionType": "residential" + } + ], + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "enrolledAt": "2024-10-15T10:33:05Z", + "loggedAt": "2024-10-15T10:33:05Z", + "logReference": "log-enrollment-otp-001", + "credential": { + "credentialId": "vc:enrollment:otp-001", + "type": "ProgramEnrollmentCredential", + "format": "VC-JWT", + "credentialUrl": "https://vpp-program-owner.example.com/credentials/vc:enrollment:otp-001", + "verificationUrl": "https://vpp-program-owner.example.com/verify/vc:enrollment:otp-001", + "issuedAt": "2024-10-15T10:33:05Z" + }, + "p2pdetails": { + "usertype": "prosumer", + "isp2pactive": true, + "iscaactive": false, + "meternumber": "MTR-987654321", + "sdload": "5.0", + "cuflimit": "10.0" + } + } + } + } +} diff --git a/examples/enrollment/v2/on-confirm-response-success.json b/examples/enrollment/v2/on-confirm-response-success.json new file mode 100644 index 00000000..d102770a --- /dev/null +++ b/examples/enrollment/v2/on-confirm-response-success.json @@ -0,0 +1,67 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:35:05Z", + "message_id": "msg-on-confirm-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:orderNumber": "ENR-2024-001234", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED", + "beckn:deliveryAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "credential": { + "credentialId": "vc:enrollment:consumer-001", + "type": "ProgramEnrollmentCredential", + "format": "VC-JWT", + "credentialUrl": "https://vpp-program-owner.example.com/credentials/vc:enrollment:consumer-001", + "verificationUrl": "https://vpp-program-owner.example.com/verify/vc:enrollment:consumer-001", + "issuedAt": "2024-10-15T10:35:05Z", + "credentialData": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZ3JhbUVucm9sbG1lbnRDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImlkIjoiZGlkOmV4YW1wbGU6dXNlci0xMjM0NSIsImVucm9sbG1lbnRJZCI6ImVucm9sbG1lbnQtY29uc3VtZXItMDAxIiwicHJvZ3JhbUlkIjoicHJvZ3JhbS1mbGV4LWRlbWFuZC1yZXNwb25zZS0wMDEiLCJtZXRlcnMiOlsidW1pZC0wMDEiXSwic3RhdHVzIjoiQUNUSVZFIiwic3RhcnREYXRlIjoiMjAyNC0xMS0wMVQwMDowMDowMFoiLCJlbmREYXRlIjoiMjAyNS0xMC0zMVQyMzo1OTo1OVoifSwiaXNzdWFuY2VEYXRlIjoiMjAyNC0xMC0xNVQxMDozNTowNVoiLCJleHBpcmF0aW9uRGF0ZSI6IjIwMjUtMTAtMzFUMjM6NTk6NTlaIn0sImlzcyI6ImRpZDpleGFtcGxlOnZwcC1wcm9ncmFtLW93bmVyIiwiaWF0IjoxNzI5MDk3NzA1fQ.signature" + } + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "enrollmentId": "enrollment-consumer-001", + "status": "ACTIVE", + "programId": "program-flex-demand-response-001", + "startDate": "2024-11-01T00:00:00Z", + "endDate": "2025-10-31T23:59:59Z", + "enrolledAt": "2024-10-15T10:35:05Z", + "loggedAt": "2024-10-15T10:35:05Z", + "logReference": "log-enrollment-consumer-001" + } + } + } +} diff --git a/examples/enrollment/v2/on-init-response-conflict.json b/examples/enrollment/v2/on-init-response-conflict.json new file mode 100644 index 00000000..8a3786f8 --- /dev/null +++ b/examples/enrollment/v2/on-init-response-conflict.json @@ -0,0 +1,69 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-conflict-001", + "transaction_id": "txn-onboard-conflict-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-conflict-001", + "beckn:orderStatus": "REJECTED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "credentialVerification": { + "status": "VERIFIED" + }, + "conflictCheck": { + "hasConflict": true, + "conflictingEnrollments": [ + { + "enrollmentId": "enrollment-existing-001", + "programId": "program-flex-other-001", + "conflictReason": "Meter umid-001 is already enrolled in program-flex-other-001 from 2024-09-01 to 2025-09-01", + "conflictType": "METER_ALREADY_ENROLLED" + } + ], + "checkedAt": "2024-10-15T10:30:05Z" + } + } + } + }, + "error": { + "code": "BIZ_ENROLLMENT_CONFLICT", + "message": "Enrollment conflicts with existing enrollment. Meter umid-001 is already enrolled in another program.", + "details": { + "path": "$.message.order.orderAttributes.conflictCheck", + "conflictingEnrollmentId": "enrollment-existing-001", + "conflictEndDate": "2025-09-01T00:00:00Z" + } + } +} diff --git a/examples/enrollment/v2/on-init-response-error.json b/examples/enrollment/v2/on-init-response-error.json new file mode 100644 index 00000000..d448eaa6 --- /dev/null +++ b/examples/enrollment/v2/on-init-response-error.json @@ -0,0 +1,50 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-error-001", + "transaction_id": "txn-onboard-error-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-error-001", + "beckn:orderStatus": "REJECTED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + } + } + }, + "error": { + "code": "SEC_CREDENTIAL_VERIFICATION_FAILED", + "message": "Meter ownership credential could not be verified", + "details": { + "path": "$.message.order.orderAttributes.meterOwnershipCredential", + "credentialId": "vc-meter-ownership-001", + "reason": "Invalid signature or expired credential" + } + } +} diff --git a/examples/enrollment/v2/on-init-response-oauth2.json b/examples/enrollment/v2/on-init-response-oauth2.json new file mode 100644 index 00000000..31d3af0a --- /dev/null +++ b/examples/enrollment/v2/on-init-response-oauth2.json @@ -0,0 +1,83 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-oauth2-001", + "transaction_id": "txn-onboard-oauth2-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-oauth2-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OIDC", + "verified": true, + "verifiedAt": "2024-10-15T10:30:05Z", + "subject": "user-12345", + "issuer": "https://utility-idp.example.com", + "scope": "openid profile email meter:read", + "expiresAt": "2024-10-15T11:30:00Z", + "message": "Token verified successfully" + }, + "meters": [ + { + "meterId": "umid-001", + "meterNumber": "MTR-987654321", + "sanctionedLoad": 5.0, + "connectionType": "residential", + "utilityId": "utility-example-001" + }, + { + "meterId": "umid-002", + "meterNumber": "MTR-987654322", + "sanctionedLoad": 10.0, + "connectionType": "commercial", + "utilityId": "utility-example-001" + } + ], + "requiredConsents": [ + { + "type": "DATA_COLLECTION", + "description": "Consent to collect and share meter data for program participation", + "required": true + }, + { + "type": "DER_CONTROL", + "description": "Consent to control DER devices for demand response (if applicable)", + "required": false + } + ] + } + } + } +} diff --git a/examples/enrollment/v2/on-init-response-otp.json b/examples/enrollment/v2/on-init-response-otp.json new file mode 100644 index 00000000..d448515a --- /dev/null +++ b/examples/enrollment/v2/on-init-response-otp.json @@ -0,0 +1,52 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-otp-001", + "transaction_id": "txn-onboard-otp-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-otp-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "pending-verification" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-p2p-trading-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "userAuth": { + "authMethod": "OTP", + "nguid": "LQUejkRbBL9nJGQiqbComfQ242AHnbG3hnwWdHJut59jqmdJygnVHoiyDcnAUrKm", + "message": "OTP sent to +91XXXXXX9999. Valid for 5 minutes.", + "expiresAt": "2024-10-15T10:35:00Z", + "utilityCustomerId": "CUST-123456" + } + } + } + } +} diff --git a/examples/enrollment/v2/on-init-response-success.json b/examples/enrollment/v2/on-init-response-success.json new file mode 100644 index 00000000..d2a5dc34 --- /dev/null +++ b/examples/enrollment/v2/on-init-response-success.json @@ -0,0 +1,94 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-10-15T10:30:05Z", + "message_id": "msg-on-init-consumer-001", + "transaction_id": "txn-onboard-consumer-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "PENDING", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "PENDING" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "credentialVerification": { + "status": "VERIFIED", + "verifiedCredentials": [ + { + "credentialId": "vc-meter-ownership-001", + "status": "VERIFIED", + "verifiedAt": "2024-10-15T10:30:05Z" + }, + { + "credentialId": "vc-program-eligibility-001", + "status": "VERIFIED", + "verifiedAt": "2024-10-15T10:30:05Z" + } + ] + }, + "conflictCheck": { + "hasConflict": false, + "checkedAt": "2024-10-15T10:30:05Z", + "message": "No conflicts found with existing enrollments" + }, + "requiredCredentials": [ + { + "type": "MeterOwnershipCredential", + "description": "Proof of meter ownership verified through utility OTP verification", + "status": "PROVIDED" + }, + { + "type": "ProgramEligibilityCredential", + "description": "Proof of program eligibility based on meter type and location", + "status": "PROVIDED" + } + ], + "requiredConsents": [ + { + "type": "DATA_COLLECTION", + "description": "Consent to collect and share meter data for program participation", + "required": true + }, + { + "type": "DER_CONTROL", + "description": "Consent to control DER devices for demand response (if applicable)", + "required": false + }, + { + "type": "CROSS_UTILITY_SHARING", + "description": "Consent to share data across utilities (if applicable)", + "required": false + } + ] + } + } + } +} diff --git a/examples/enrollment/v2/on-update-response-consent-revocation.json b/examples/enrollment/v2/on-update-response-consent-revocation.json new file mode 100644 index 00000000..e0281161 --- /dev/null +++ b/examples/enrollment/v2/on-update-response-consent-revocation.json @@ -0,0 +1,56 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T14:30:05Z", + "message_id": "msg-on-update-consent-revoke-001", + "transaction_id": "txn-revoke-consent-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CONFIRMED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "enrollmentId": "enrollment-consumer-001", + "status": "ACTIVE", + "updateType": "CONSENT_REVOCATION", + "consentRevocation": { + "consentCredentialId": "https://vpp-program-owner.example.com/credentials/vc:consent:consumer-001", + "status": "REVOKED", + "revokedAt": "2024-11-20T14:30:05Z", + "statusListUrl": "https://vpp-program-owner.example.com/status/consent-list", + "statusListIndex": "94567", + "message": "Consent has been revoked and added to revocation status list. Future verifications will fail." + } + } + } + } +} diff --git a/examples/enrollment/v2/on-update-response-unenrollment.json b/examples/enrollment/v2/on-update-response-unenrollment.json new file mode 100644 index 00000000..0035b944 --- /dev/null +++ b/examples/enrollment/v2/on-update-response-unenrollment.json @@ -0,0 +1,69 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T15:00:05Z", + "message_id": "msg-on-update-unenroll-001", + "transaction_id": "txn-unenroll-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CANCELLED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-onboard-001", + "beckn:mode": "DIGITAL", + "beckn:fulfillmentStatus": "CANCELLED" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "enrollmentId": "enrollment-consumer-001", + "status": "CANCELLED", + "updateType": "UNENROLLMENT", + "unenrollment": { + "enrollmentId": "enrollment-consumer-001", + "status": "CANCELLED", + "cancelledAt": "2024-11-20T15:00:05Z", + "enrollmentCredentialStatus": { + "statusListUrl": "https://vpp-program-owner.example.com/status/enrollment-list", + "statusListIndex": "12345", + "revoked": true + }, + "consentsRevoked": [ + { + "consentCredentialId": "https://vpp-program-owner.example.com/credentials/vc:consent:consumer-001", + "statusListUrl": "https://vpp-program-owner.example.com/status/consent-list", + "statusListIndex": "94567", + "revoked": true + } + ], + "message": "Enrollment and all associated consents have been revoked. Enrollment credential and consent credentials have been added to revocation status lists." + }, + "loggedAt": "2024-11-20T15:00:05Z", + "logReference": "log-unenrollment-consumer-001" + } + } + } +} diff --git a/examples/enrollment/v2/update-request-consent-revocation.json b/examples/enrollment/v2/update-request-consent-revocation.json new file mode 100644 index 00000000..9f646dfc --- /dev/null +++ b/examples/enrollment/v2/update-request-consent-revocation.json @@ -0,0 +1,46 @@ +{ + "context": { + "version": "2.0.0", + "action": "update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T14:30:00Z", + "message_id": "msg-update-consent-revoke-001", + "transaction_id": "txn-revoke-consent-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "updateType": "CONSENT_REVOCATION", + "consentRevocation": { + "consentCredentialId": "https://vpp-program-owner.example.com/credentials/vc:consent:consumer-001", + "consentType": "DATA_COLLECTION", + "reason": "USER_REQUESTED", + "revokedAt": "2024-11-20T14:30:00Z", + "effectiveDate": "2024-11-20T14:30:00Z" + } + } + } + } +} diff --git a/examples/enrollment/v2/update-request-unenrollment.json b/examples/enrollment/v2/update-request-unenrollment.json new file mode 100644 index 00000000..3dff613c --- /dev/null +++ b/examples/enrollment/v2/update-request-unenrollment.json @@ -0,0 +1,45 @@ +{ + "context": { + "version": "2.0.0", + "action": "update", + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "timestamp": "2024-11-20T15:00:00Z", + "message_id": "msg-update-unenroll-001", + "transaction_id": "txn-unenroll-001", + "bap_id": "utility-portal.example.com", + "bap_uri": "https://utility-portal.example.com/beckn", + "bpp_id": "vpp-program-owner.example.com", + "bpp_uri": "https://vpp-program-owner.example.com/beckn", + "ttl": "PT30S" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-onboard-consumer-001", + "beckn:orderStatus": "CONFIRMED", + "beckn:seller": "vpp-program-flex-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "did:example:user-12345" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "program-flex-demand-response-001" + } + ], + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/p2p-trading/schema/EnergyEnrollment/v0.2/context.jsonld", + "@type": "EnergyEnrollment", + "updateType": "UNENROLLMENT", + "unenrollment": { + "enrollmentId": "enrollment-consumer-001", + "reason": "USER_REQUESTED", + "effectiveDate": "2024-11-20T15:00:00Z", + "revokeAllConsents": true + } + } + } + } +} diff --git a/examples/ev-charging/v1-EOS/cancel/cancel-request.json b/examples/ev-charging/v1-EOS/cancel/cancel-request.json new file mode 100644 index 00000000..03070c34 --- /dev/null +++ b/examples/ev-charging/v1-EOS/cancel/cancel-request.json @@ -0,0 +1,29 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "cancel", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "cancellation_reason_id": "5", + "descriptor": { + "short_desc": "can't attend booking" + }, + "order_id": "6743e9e2-4fb5-487c-92b7" + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/cancel/on_cancel-charger_breakdown-request.json b/examples/ev-charging/v1-EOS/cancel/on_cancel-charger_breakdown-request.json new file mode 100644 index 00000000..08a33ab9 --- /dev/null +++ b/examples/ev-charging/v1-EOS/cancel/on_cancel-charger_breakdown-request.json @@ -0,0 +1,212 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_cancel", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "id": "6743e9e2-4fb5-487c-92b7", + "status": "CANCELLED", + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + }, + "allocated": { + "measure": { + "value": "2", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ], + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + }, + "type": "CHARGING", + "state": { + "descriptor": { + "code": "charger-error" + } + }, + "stops": [ + { + "time": { + "range": { + "start": "2023-06-10T10:00:00Z", + "end": "2023-06-10T10:30:00Z" + } + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "billing": { + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "quote": { + "price": { + "value": "-12", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "payment refund" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "-12", + "currency": "INR" + } + } + ] + }, + "payments": [ + { + "type": "PRE-ORDER", + "status": "PAID", + "params": { + "amount": "40", + "currency": "INR", + "transaction_id": "asjdhw8e238e3" + }, + "time": { + "range": { + "start": "2023-08-10T10:00:00Z", + "end": "2023-08-10T10:30:00Z" + } + } + } + ], + "cancellation_terms": [ + { + "fulfillment_state": { + "descriptor": { + "code": "charging-start" + } + }, + "cancellation_fee": { + "percentage": "30%" + }, + "external_ref": { + "mimetype": "text/html", + "url": "https://chargezone.in/charge/tnc.html" + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/cancel/on_cancel-request.json b/examples/ev-charging/v1-EOS/cancel/on_cancel-request.json new file mode 100644 index 00000000..5dc08790 --- /dev/null +++ b/examples/ev-charging/v1-EOS/cancel/on_cancel-request.json @@ -0,0 +1,206 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_cancel", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "id": "6743e9e2-4fb5-487c-92b7", + "status": "CANCELLED", + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ], + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + }, + "type": "CHARGING", + "state": { + "descriptor": { + "code": "order-cancelled" + } + }, + "stops": [ + { + "time": { + "range": { + "start": "2023-06-01T10:00:00", + "end": "2023-06-01T10:30:00" + } + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "billing": { + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "quote": { + "price": { + "value": "-32", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "payment refund" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "-32", + "currency": "INR" + } + } + ] + }, + "payments": [ + { + "type": "PRE-ORDER", + "status": "PAID", + "params": { + "amount": "40", + "currency": "INR", + "transaction_id": "asjdhw8e238e3" + }, + "time": { + "range": { + "start": "2023-08-10T10:00:00Z", + "end": "2023-08-10T10:30:00Z" + } + } + } + ], + "cancellation_terms": [ + { + "fulfillment_state": { + "descriptor": { + "code": "charging-start" + } + }, + "cancellation_fee": { + "percentage": "30%" + }, + "external_ref": { + "mimetype": "text/html", + "url": "https://chargezone.in/charge/tnc.html" + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/confirm/confirm-request.json b/examples/ev-charging/v1-EOS/confirm/confirm-request.json new file mode 100644 index 00000000..0051cb98 --- /dev/null +++ b/examples/ev-charging/v1-EOS/confirm/confirm-request.json @@ -0,0 +1,104 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "confirm", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "provider": { + "id": "chargezone.in" + }, + "items": [ + { + "id": "pe-charging-01", + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1" + } + ] + } + ], + "billing": { + "name": "John Doe", + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + } + } + ], + "payments": [ + { + "collected_by": "BPP", + "params": { + "amount": "40", + "currency": "INR", + "transaction_id": "asjdhw8e238e3" + }, + "status": "PAID", + "type": "PRE-ORDER" + } + ], + "quote": { + "price": { + "value": "40", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "Estimated units consumed" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "32", + "currency": "INR" + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/confirm/on_confirm-request.json b/examples/ev-charging/v1-EOS/confirm/on_confirm-request.json new file mode 100644 index 00000000..9bf5f7cf --- /dev/null +++ b/examples/ev-charging/v1-EOS/confirm/on_confirm-request.json @@ -0,0 +1,224 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_confirm", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "id": "6743e9e2-4fb5-487c-92b7", + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ], + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + }, + "type": "CHARGING", + "state": { + "descriptor": { + "code": "payment-completed" + } + }, + "stops": [ + { + "type": "start", + "location": { + "gps": "12.423423,77.325647" + }, + "time": { + "timestamp": "2023-06-01T10:00:00", + "range": { + "start": "2023-06-01T10:00:00", + "end": "2023-06-01T10:10:00" + } + }, + "instructions": { + "name": "Charging instructions", + "short_desc": "To start your charging, go to charger number 987, and click on 'start' on your app" + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:30:00", + "range": { + "start": "2023-06-01T10:30:00", + "end": "2023-06-01T10:40:00" + } + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "billing": { + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "quote": { + "price": { + "value": "40", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "Estimated units consumed" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "32", + "currency": "INR" + } + } + ] + }, + "payments": [ + { + "type": "PRE-ORDER", + "status": "PAID", + "params": { + "amount": "40", + "currency": "INR", + "transaction_id": "asjdhw8e238e3" + }, + "time": { + "range": { + "start": "2023-08-10T10:00:00Z", + "end": "2023-08-10T10:30:00Z" + } + } + } + ], + "cancellation_terms": [ + { + "fulfillment_state": { + "descriptor": { + "code": "charging-start" + } + }, + "cancellation_fee": { + "percentage": "30%" + }, + "external_ref": { + "mimetype": "text/html", + "url": "https://chargezone.in/charge/tnc.html" + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/init/init-request.json b/examples/ev-charging/v1-EOS/init/init-request.json new file mode 100644 index 00000000..b3bca533 --- /dev/null +++ b/examples/ev-charging/v1-EOS/init/init-request.json @@ -0,0 +1,65 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "init", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "provider": { + "id": "chargezone.in" + }, + "items": [ + { + "id": "pe-charging-01", + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1" + } + ] + } + ], + "billing": { + "name": "John Doe", + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/init/on_init-request.json b/examples/ev-charging/v1-EOS/init/on_init-request.json new file mode 100644 index 00000000..5b2b9a5f --- /dev/null +++ b/examples/ev-charging/v1-EOS/init/on_init-request.json @@ -0,0 +1,208 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_init", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ], + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + }, + "type": "CHARGING", + "state": { + "descriptor": { + "code": "order-initiated" + } + }, + "stops": [ + { + "type": "start", + "time": { + "timestamp": "2023-06-01T10:00:00" + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:00:00" + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "billing": { + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "quote": { + "price": { + "value": "32", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "Estimated units consumed" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "32", + "currency": "INR" + } + } + ] + }, + "payments": [ + { + "url": "https://payment.gateway.in", + "type": "PRE-ORDER", + "status": "NOT-PAID", + "params": { + "amount": "40", + "currency": "INR" + }, + "time": { + "range": { + "start": "2023-08-10T10:00:00Z", + "end": "2023-08-10T10:30:00Z" + } + } + } + ], + "cancellation_terms": [ + { + "fulfillment_state": { + "descriptor": { + "code": "charging-start" + } + }, + "cancellation_fee": { + "percentage": "30%" + }, + "external_ref": { + "mimetype": "text/html", + "url": "https://chargezone.in/charge/tnc.html" + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/rating/on_rating-request.json b/examples/ev-charging/v1-EOS/rating/on_rating-request.json new file mode 100644 index 00000000..9f329603 --- /dev/null +++ b/examples/ev-charging/v1-EOS/rating/on_rating-request.json @@ -0,0 +1,30 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_rating", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "feedback_form": { + "form": { + "url": "https://api.example-bpp.com/pilot/bpp/feedback/portal" + }, + "required": false + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/rating/rating-request.json b/examples/ev-charging/v1-EOS/rating/rating-request.json new file mode 100644 index 00000000..03b3de52 --- /dev/null +++ b/examples/ev-charging/v1-EOS/rating/rating-request.json @@ -0,0 +1,31 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "rating", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "ratings": [ + { + "id": "6743e9e2-4fb5-487c-92b7", + "rating_category": "charger", + "value": "5" + } + ] + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/search/on_search-request.json b/examples/ev-charging/v1-EOS/search/on_search-request.json new file mode 100644 index 00000000..9867db63 --- /dev/null +++ b/examples/ev-charging/v1-EOS/search/on_search-request.json @@ -0,0 +1,288 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_search", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "catalog": { + "providers": [ + { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + }, + "locations": [ + { + "id": "1", + "gps": "12.345345,77.389754" + }, + { + "id": "2", + "gps": "12.247934,77.876987" + } + ], + "categories": [ + { + "id": "1", + "descriptor": { + "code": "green-tariff", + "name": "green tariff" + } + } + ], + "fulfillments": [ + { + "id": "1", + "type": "CHARGING", + "stops": [ + { + "type": "start", + "time": { + "timestamp": "2023-06-01T10:00:00Z" + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:00:00Z" + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point Specifications" + }, + "list": [ + { + "descriptor": { + "name": "Charger type", + "code": "charger-type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type", + "code": "connector-type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + }, + { + "id": "2", + "type": "CHARGING", + "stops": [ + { + "type": "start", + "time": { + "timestamp": "2023-06-01T10:00:00Z" + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:00:00Z" + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "unit": "kWH", + "value": "100" + } + } + }, + "category_ids": [ + "1" + ], + "location_ids": [ + "1", + "2" + ], + "fulfillment_ids": [ + "1", + "2" + ], + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ] + }, + { + "id": "log9.in", + "descriptor": { + "name": "Log9 Inc" + }, + "categories": [ + { + "id": "1", + "descriptor": { + "code": "green-tariff", + "name": "green tariff" + } + } + ], + "fulfillments": [ + { + "id": "3", + "type": "BATTERY-SWAP", + "stops": [ + { + "location": { + "gps": "12.745675, 77.987393" + } + } + ] + }, + { + "id": "4", + "type": "MOBILE-BATTERY-SWAP", + "stops": [ + { + "location": { + "map_url": "https://log9.in/track/bswap/3234242" + } + } + ] + } + ], + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "10", + "currency": "INR / kWH" + }, + "quantity": { + "available": { + "measure": { + "unit": "kWH", + "value": "1000" + } + } + }, + "category_ids": [ + "1" + ], + "fulfillment_ids": [ + "3", + "4" + ], + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "name": "Free tyre pressure check" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/search/search-request.json b/examples/ev-charging/v1-EOS/search/search-request.json new file mode 100644 index 00000000..18fb89e3 --- /dev/null +++ b/examples/ev-charging/v1-EOS/search/search-request.json @@ -0,0 +1,58 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "search", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "intent": { + "category": { + "descriptor": { + "code": "green-tariff" + } + }, + "item": { + "descriptor": { + "code": "energy" + }, + "quantity": { + "available": { + "measure": { + "unit": "kWH", + "value": "4.0" + } + } + } + }, + "fulfillment": { + "stops": [ + { + "location": { + "circle": { + "gps": "12.423423,77.325647", + "radius": { + "type": "CONSTANT", + "value": "5", + "unit": "km" + } + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/select/on_select-request.json b/examples/ev-charging/v1-EOS/select/on_select-request.json new file mode 100644 index 00000000..4c0ba51e --- /dev/null +++ b/examples/ev-charging/v1-EOS/select/on_select-request.json @@ -0,0 +1,175 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_select", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ], + "fulfillments": [ + { + "id": "1", + "type": "CHARGING", + "stops": [ + { + "type": "start", + "time": { + "timestamp": "2023-06-01T10:00:00" + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:00:00" + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point Specifications" + }, + "list": [ + { + "descriptor": { + "name": "Charger type", + "code": "charger-type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type", + "code": "connector-type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "quote": { + "price": { + "value": "32", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "id": "pe-charging-01", + "descriptor": { + "name": "Estimated units consumed" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "32", + "currency": "INR" + } + }, + { + "item": { + "add_ons": [ + { + "id": "pe-charging-01-addon-1" + } + ], + "descriptor": { + "name": "Free car wash" + } + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/select/select-request.json b/examples/ev-charging/v1-EOS/select/select-request.json new file mode 100644 index 00000000..d770b522 --- /dev/null +++ b/examples/ev-charging/v1-EOS/select/select-request.json @@ -0,0 +1,52 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "select", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "provider": { + "id": "chargezone.in" + }, + "items": [ + { + "id": "pe-charging-01", + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1" + } + ] + } + ], + "fulfillments": [ + { + "id": "1" + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/status/on_status-request.json b/examples/ev-charging/v1-EOS/status/on_status-request.json new file mode 100644 index 00000000..91ed66fd --- /dev/null +++ b/examples/ev-charging/v1-EOS/status/on_status-request.json @@ -0,0 +1,220 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_status", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "id": "6743e9e2-4fb5-487c-92b7", + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ], + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + }, + "type": "CHARGING", + "state": { + "descriptor": { + "name": "vehicle 65% charged" + } + }, + "stops": [ + { + "type": "start", + "location": { + "gps": "12.423423,77.325647" + }, + "time": { + "timestamp": "2023-06-01T10:00:00", + "range": { + "start": "2023-06-01T10:00:00", + "end": "2023-06-01T10:10:00" + } + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:30:00", + "range": { + "start": "2023-06-01T10:00:00", + "end": "2023-06-01T10:40:00" + } + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "billing": { + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "quote": { + "price": { + "value": "32", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "Estimated units consumed" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "32", + "currency": "INR" + } + } + ] + }, + "payments": [ + { + "type": "PRE-ORDER", + "status": "PAID", + "params": { + "amount": "40", + "currency": "INR", + "transaction_id": "asjdhw8e238e3" + }, + "time": { + "range": { + "start": "2023-08-10T10:00:00Z", + "end": "2023-08-10T10:30:00Z" + } + } + } + ], + "cancellation_terms": [ + { + "fulfillment_state": { + "descriptor": { + "code": "charging-start" + } + }, + "cancellation_fee": { + "percentage": "30%" + }, + "external_ref": { + "mimetype": "text/html", + "url": "https://chargezone.in/charge/tnc.html" + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/status/status-request.json b/examples/ev-charging/v1-EOS/status/status-request.json new file mode 100644 index 00000000..4ac54e7e --- /dev/null +++ b/examples/ev-charging/v1-EOS/status/status-request.json @@ -0,0 +1,25 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "status", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order_id": "6743e9e2-4fb5-487c-92b7" + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/support/on_support-request.json b/examples/ev-charging/v1-EOS/support/on_support-request.json new file mode 100644 index 00000000..ae7ee489 --- /dev/null +++ b/examples/ev-charging/v1-EOS/support/on_support-request.json @@ -0,0 +1,30 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_support", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "support": { + "ref_id": "6743e9e2-4fb5-487c-92b7", + "phone": "1800 1080", + "email": "customer.care@chargezone.com", + "url": "https://www.chargezone.com/helpdesk" + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/support/support-request.json b/examples/ev-charging/v1-EOS/support/support-request.json new file mode 100644 index 00000000..2947fec1 --- /dev/null +++ b/examples/ev-charging/v1-EOS/support/support-request.json @@ -0,0 +1,29 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "support", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "support": { + "ref_id": "6743e9e2-4fb5-487c-92b7", + "phone": "+919876543210", + "email": "john.doe@gmail.com" + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/update/on_update-request-charging-end.json b/examples/ev-charging/v1-EOS/update/on_update-request-charging-end.json new file mode 100644 index 00000000..82e62433 --- /dev/null +++ b/examples/ev-charging/v1-EOS/update/on_update-request-charging-end.json @@ -0,0 +1,220 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_update", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "id": "6743e9e2-4fb5-487c-92b7", + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ], + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + }, + "type": "CHARGING", + "state": { + "descriptor": { + "code": "charging-ended" + } + }, + "stops": [ + { + "type": "start", + "location": { + "gps": "12.423423,77.325647" + }, + "time": { + "timestamp": "2023-06-01T10:00:00", + "range": { + "start": "2023-06-01T10:00:00", + "end": "2023-06-01T10:10:00" + } + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:30:00", + "range": { + "start": "2023-06-01T10:30:00", + "end": "2023-06-01T10:40:00" + } + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "billing": { + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "quote": { + "price": { + "value": "40", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "Estimated units consumed" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "32", + "currency": "INR" + } + } + ] + }, + "payments": [ + { + "type": "PRE-ORDER", + "status": "PAID", + "params": { + "amount": "40", + "currency": "INR", + "transaction_id": "asjdhw8e238e3" + }, + "time": { + "range": { + "start": "2023-08-10T10:00:00Z", + "end": "2023-08-10T10:30:00Z" + } + } + } + ], + "cancellation_terms": [ + { + "fulfillment_state": { + "descriptor": { + "code": "charging-start" + } + }, + "cancellation_fee": { + "percentage": "30%" + }, + "external_ref": { + "mimetype": "text/html", + "url": "https://chargezone.in/charge/tnc.html" + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/update/on_update-request-charging-start.json b/examples/ev-charging/v1-EOS/update/on_update-request-charging-start.json new file mode 100644 index 00000000..d0709b0d --- /dev/null +++ b/examples/ev-charging/v1-EOS/update/on_update-request-charging-start.json @@ -0,0 +1,220 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "on_update", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "example-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "order": { + "id": "6743e9e2-4fb5-487c-92b7", + "provider": { + "id": "chargezone.in", + "descriptor": { + "name": "Chargezone", + "short_desc": "Chargezone Technologies Pvt Ltd", + "images": [ + { + "url": "https://chargezone.in/images/logo.png" + } + ] + } + }, + "items": [ + { + "id": "pe-charging-01", + "descriptor": { + "code": "energy" + }, + "price": { + "value": "8", + "currency": "INR/kWH" + }, + "quantity": { + "available": { + "measure": { + "value": "100", + "unit": "kWh" + } + }, + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + }, + "add_ons": [ + { + "id": "pe-charging-01-addon-1", + "descriptor": { + "code": "add-on-item", + "name": "Free car wash" + }, + "price": { + "value": "0", + "currency": "INR" + } + } + ] + } + ], + "fulfillments": [ + { + "id": "1", + "customer": { + "person": { + "name": "John Doe" + }, + "contact": { + "phone": "+91-9887766554" + } + }, + "type": "CHARGING", + "state": { + "descriptor": { + "code": "charging-started" + } + }, + "stops": [ + { + "type": "start", + "location": { + "gps": "12.423423,77.325647" + }, + "time": { + "timestamp": "2023-06-01T10:00:00", + "range": { + "start": "2023-06-01T10:00:00", + "end": "2023-06-01T10:10:00" + } + } + }, + { + "type": "end", + "time": { + "timestamp": "2023-06-01T10:30:00", + "range": { + "start": "2023-06-01T10:30:00", + "end": "2023-06-01T10:40:00" + } + } + } + ], + "tags": [ + { + "descriptor": { + "name": "Charging Point" + }, + "list": [ + { + "descriptor": { + "name": "Charger type" + }, + "value": "AC" + }, + { + "descriptor": { + "name": "Connector type" + }, + "value": "CCS2" + }, + { + "descriptor": { + "name": "Power Rating" + }, + "value": "greater than 50kW" + }, + { + "descriptor": { + "name": "Availability" + }, + "value": "Available" + } + ], + "display": true + } + ] + } + ], + "billing": { + "email": "abc@example.com", + "phone": "+91-9876522222" + }, + "quote": { + "price": { + "value": "40", + "currency": "INR" + }, + "breakup": [ + { + "item": { + "descriptor": { + "name": "Estimated units consumed" + }, + "quantity": { + "selected": { + "measure": { + "value": "4", + "unit": "kWh" + } + } + } + }, + "price": { + "value": "32", + "currency": "INR" + } + } + ] + }, + "payments": [ + { + "type": "PRE-ORDER", + "status": "PAID", + "params": { + "amount": "40", + "currency": "INR", + "transaction_id": "asjdhw8e238e3" + }, + "time": { + "range": { + "start": "2023-08-10T10:00:00Z", + "end": "2023-08-10T10:30:00Z" + } + } + } + ], + "cancellation_terms": [ + { + "fulfillment_state": { + "descriptor": { + "code": "charging-start" + } + }, + "cancellation_fee": { + "percentage": "30%" + }, + "external_ref": { + "mimetype": "text/html", + "url": "https://chargezone.in/charge/tnc.html" + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/update/update-request-charging-end.json b/examples/ev-charging/v1-EOS/update/update-request-charging-end.json new file mode 100644 index 00000000..f9337c88 --- /dev/null +++ b/examples/ev-charging/v1-EOS/update/update-request-charging-end.json @@ -0,0 +1,37 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "update", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "update_target": "order.fulfillments[0].state", + "order": { + "fulfillments": [ + { + "id": "1", + "state": { + "descriptor": { + "code": "end-charging" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/ev-charging/v1-EOS/update/update-request-charging-start.json b/examples/ev-charging/v1-EOS/update/update-request-charging-start.json new file mode 100644 index 00000000..2047ae03 --- /dev/null +++ b/examples/ev-charging/v1-EOS/update/update-request-charging-start.json @@ -0,0 +1,38 @@ +{ + "context": { + "domain": "dent:ev-charging:0.1.0", + "action": "update", + "location": { + "country": { + "code": "IND" + }, + "city": { + "code": "std:080" + } + }, + "version": "1.1.0", + "bap_id": "example-bap.com", + "bap_uri": "https://api.example-bap.com/pilot/bap/energy/v1", + "bpp_id": "chargezone-energy-bpp.com", + "bpp_uri": "https://api.example-bpp.com/pilot/bpp/", + "transaction_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "message_id": "6743e9e2-4fb5-487c-92b7-13ba8018f176", + "timestamp": "2023-07-16T04:41:16Z" + }, + "message": { + "update_target": "order.fulfillments[0].state", + "order": { + "fulfillments": [ + { + "id": "1", + "type": "CHARGING", + "state": { + "descriptor": { + "code": "start-charging" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/examples/p2p-trading-interdiscom/v2/cascaded-confirm-request.json b/examples/p2p-trading-interdiscom/v2/cascaded-confirm-request.json new file mode 100644 index 00000000..98901f40 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/cascaded-confirm-request.json @@ -0,0 +1,142 @@ +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "timestamp": "2024-10-04T10:25:00Z", + "message_id": "msg-cascaded-confirm-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-cascaded-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 225 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "p2pTrading-bpp.com", + "accountHolderName": "P2P Trading Platform Pvt Ltd", + "accountNumber": "5555666677", + "ifscCode": "SBIN0001234", + "bankName": "State Bank of India", + "vpa": "p2p-trading@upi" + }, + { + "beneficiaryId": "example-transmission-bpp.com", + "accountHolderName": "Transmission Utility Provider Pvt Ltd", + "accountNumber": "8888999900", + "ifscCode": "AXIS0004567", + "bankName": "Axis Bank", + "vpa": "transmission-utility@upi" + } + ] + } + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/cascaded-init-request.json b/examples/p2p-trading-interdiscom/v2/cascaded-init-request.json new file mode 100644 index 00000000..41e33752 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/cascaded-init-request.json @@ -0,0 +1,134 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "timestamp": "2024-10-04T10:20:00Z", + "message_id": "msg-cascaded-init-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-cascaded-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 225 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "INITIATED", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "p2pTrading-bpp.com", + "accountHolderName": "P2P Trading Platform Pvt Ltd", + "accountNumber": "5555666677", + "ifscCode": "SBIN0001234", + "bankName": "State Bank of India", + "vpa": "p2p-trading@upi" + } + ] + } + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/cascaded-on-confirm-response.json b/examples/p2p-trading-interdiscom/v2/cascaded-on-confirm-response.json new file mode 100644 index 00000000..1c25979f --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/cascaded-on-confirm-response.json @@ -0,0 +1,143 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "timestamp": "2024-10-04T10:25:05Z", + "message_id": "msg-cascaded-on-confirm-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-cascaded-utility-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-cascaded-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 225 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "p2pTrading-bpp.com", + "accountHolderName": "P2P Trading Platform Pvt Ltd", + "accountNumber": "5555666677", + "ifscCode": "SBIN0001234", + "bankName": "State Bank of India", + "vpa": "p2p-trading@upi" + }, + { + "beneficiaryId": "example-transmission-bpp.com", + "accountHolderName": "Transmission Utility Provider Pvt Ltd", + "accountNumber": "8888999900", + "ifscCode": "AXIS0004567", + "bankName": "Axis Bank", + "vpa": "transmission-utility@upi" + } + ] + } + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/cascaded-on-init-response.json b/examples/p2p-trading-interdiscom/v2/cascaded-on-init-response.json new file mode 100644 index 00000000..7f9ce727 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/cascaded-on-init-response.json @@ -0,0 +1,142 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "timestamp": "2024-10-04T10:20:05Z", + "message_id": "msg-cascaded-on-init-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-cascaded-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 225 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "p2pTrading-bpp.com", + "accountHolderName": "P2P Trading Platform Pvt Ltd", + "accountNumber": "5555666677", + "ifscCode": "SBIN0001234", + "bankName": "State Bank of India", + "vpa": "p2p-trading@upi" + }, + { + "beneficiaryId": "example-transmission-bpp.com", + "accountHolderName": "Transmission Utility Provider Pvt Ltd", + "accountNumber": "8888999900", + "ifscCode": "AXIS0004567", + "bankName": "Axis Bank", + "vpa": "transmission-utility@upi" + } + ] + } + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/confirm-request.json b/examples/p2p-trading-interdiscom/v2/confirm-request.json new file mode 100644 index 00000000..891a5cd1 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/confirm-request.json @@ -0,0 +1,176 @@ +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "timestamp": "2024-10-04T10:25:00Z", + "message_id": "msg-confirm-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 405 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/confirm-response.json b/examples/p2p-trading-interdiscom/v2/confirm-response.json new file mode 100644 index 00000000..714a2dff --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/confirm-response.json @@ -0,0 +1,182 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "timestamp": "2024-10-04T10:25:05Z", + "message_id": "msg-on-confirm-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 405, + "description": "Inter-platform settlement at catalog prices (15 kWh × ₹15 + 10 kWh × ₹18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 405 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/discover-request.json b/examples/p2p-trading-interdiscom/v2/discover-request.json new file mode 100644 index 00000000..49ddf7f8 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/discover-request.json @@ -0,0 +1,40 @@ +{ + "context": { + "version": "2.0.0", + "action": "discover", + "timestamp": "2024-10-04T10:00:00Z", + "message_id": "msg-discover-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0", + "location": { + "city": { + "code": "BLR", + "name": "Bangalore" + }, + "country": { + "code": "IND", + "name": "India" + } + }, + "schema_context": [ + "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld" + ] + }, + "message": { + "filters": { + "type": "jsonpath", + "expression": "$.catalogs[*] ? (@.beckn:items[*].beckn:networkId[*] == 'p2p-interdiscom-trading-test-network' && @.beckn:offers[*].beckn:isActive == true && @.beckn:offers[*].beckn:offerAttributes.validityWindow.schema:endTime >= '2024-10-04T09:00:00Z' && @.beckn:offers[*].beckn:price.schema:price >= 7 && @.beckn:offers[*].beckn:price.schema:price <= 750 && @.beckn:offers[*].beckn:price.schema:priceCurrency == 'INR' && @.beckn:offers[*].beckn:price.applicableQuantity.unitQuantity >= 1 && @.beckn:offers[*].beckn:price.applicableQuantity.unitQuantity <= 300 && @.beckn:offers[*].beckn:price.applicableQuantity.unitText == 'kWh')", + "example_expressions_remove_in_discover_calls": [ + "$.catalogs[*].beckn:offers[*] ? (@.beckn:price.schema:price >= 700 && @.beckn:price.schema:price <= 750 && @.beckn:price.schema:priceCurrency == 'INR')", + "$.catalogs[*].beckn:offers[*] ? (@.beckn:offerAttributes.deliveryWindow.schema:endTime <= '2026-02-05' && @.beckn:offerAttributes.deliveryWindow.schema:startTime >='2026-02-04')", + "$.catalogs[*].beckn:offers[*] ? (@.beckn:offerAttributes.deliveryWindow.schema:startTime >= '2024-02-03T12:00:00Z' && exists($.catalogs[*] ? (@.beckn:items[*].beckn:networkId[*] == 'p2p-interdiscom-trading-test-network' && @.beckn:items[*].beckn:provider.beckn:providerAttributes.utilityId == 'TPDDL-DL')))", + "$.catalogs[*] ? (@.beckn:items[*].beckn:networkId[*] == 'p2p-interdiscom-trading-test-network' && @.beckn:offers[*].beckn:price.schema:price >= 7 && @.beckn:offers[*].beckn:price.schema:price <= 750 && @.beckn:offers[*].beckn:price.schema:priceCurrency == 'INR' && @.beckn:offers[*].beckn:price.applicableQuantity.unitQuantity >= 1 && @.beckn:offers[*].beckn:price.applicableQuantity.unitQuantity <= 300 && @.beckn:offers[*].beckn:price.applicableQuantity.unitText == 'kWh')" + ] + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/discover-response.json b/examples/p2p-trading-interdiscom/v2/discover-response.json new file mode 100644 index 00000000..c7db8f97 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/discover-response.json @@ -0,0 +1,143 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_discover", + "timestamp": "2024-10-04T10:00:05Z", + "message_id": "msg-on-discover-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "catalogs": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Catalog", + "beckn:id": "catalog-energy-001", + "beckn:bppId": "bpp.energy-provider.com", + "beckn:bppUri": "https://bpp.energy-provider.com", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Trading Catalog" + }, + "beckn:items": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-interdiscom-trading-test-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 30.5 kWh" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + }, + "beckn:providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityId": "TEST_DISCOM_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "meterId": "TEST_METER_SELLER" + } + } + ], + "beckn:offers": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:isActive": true, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer - 6am-12pm" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:isActive": true, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer - 12pm-6pm" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + ] + } + ] + } +} diff --git a/examples/p2p-trading-interdiscom/v2/init-request.json b/examples/p2p-trading-interdiscom/v2/init-request.json new file mode 100644 index 00000000..58c31a86 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/init-request.json @@ -0,0 +1,176 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "timestamp": "2024-10-04T10:20:00Z", + "message_id": "msg-init-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 405 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "INITIATED" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/init-response.json b/examples/p2p-trading-interdiscom/v2/init-response.json new file mode 100644 index 00000000..584f8d42 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/init-response.json @@ -0,0 +1,186 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "timestamp": "2024-10-04T10:20:05Z", + "message_id": "msg-on-init-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 405, + "description": "Inter-platform settlement at catalog prices (15 kWh × ₹15 + 10 kWh × ₹18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 405 + }, + "beckn:acceptedPaymentMethod": [ + "UPI", + "BANK_TRANSFER", + "WALLET" + ], + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/on-update-response-curtailment.json b/examples/p2p-trading-interdiscom/v2/on-update-response-curtailment.json new file mode 100644 index 00000000..62e2b7df --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/on-update-response-curtailment.json @@ -0,0 +1,133 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "timestamp": "2024-10-04T14:30:00Z", + "message_id": "msg-on-update-curtailment-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "INPROGRESS", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 8.5, + "curtailedQuantity": 6.5, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 8.5, + "allocatedEnergy": 8.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 127.5, + "description": "Adjusted inter-platform settlement for delivered quantity (8.5 kWh × ₹15). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 127.5 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "ADJUSTED" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/on-update-response-final-invoice.json b/examples/p2p-trading-interdiscom/v2/on-update-response-final-invoice.json new file mode 100644 index 00000000..8f7be062 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/on-update-response-final-invoice.json @@ -0,0 +1,246 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "timestamp": "2024-10-04T18:15:00Z", + "message_id": "msg-on-update-final-invoice-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "INPROGRESS", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 15.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 15.0, + "allocatedEnergy": 15.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T12:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 10.0, + "allocatedEnergy": 10.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 425.25, + "components": [ + { + "type": "UNIT", + "value": 405, + "currency": "INR", + "description": "Energy value (15 kWh × ₹15 + 10 kWh × ₹18)" + }, + { + "type": "FEE", + "value": 8.1, + "currency": "INR", + "description": "Buyer platform fee (2%)" + }, + { + "type": "FEE", + "value": 12.15, + "currency": "INR", + "description": "Seller platform fee (3%)" + } + ] + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 425.25 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED", + "beckn:acceptedPaymentMethod": [ + "UPI", + "BANK_TRANSFER" + ], + "beckn:paymentURL": "https://payments.seller-platform.com/track?txn=TXN-ENERGY-001", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "bpp.energy-provider.com", + "accountHolderName": "Solar Farm Energy Provider Pvt Ltd", + "accountNumber": "9876543210", + "ifscCode": "ICICI0005678", + "bankName": "ICICI Bank", + "vpa": "solar-provider@upi" + } + ] + } + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/on-update-response-settlement-complete.json b/examples/p2p-trading-interdiscom/v2/on-update-response-settlement-complete.json new file mode 100644 index 00000000..555dc58c --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/on-update-response-settlement-complete.json @@ -0,0 +1,115 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "timestamp": "2024-10-04T18:45:00Z", + "message_id": "msg-on-update-settlement-complete-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "COMPLETED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ] + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ] + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 425.25, + "components": [ + { + "type": "UNIT", + "value": 405, + "currency": "INR", + "description": "Energy value (15 kWh × ₹15 + 10 kWh × ₹18)" + }, + { + "type": "FEE", + "value": 8.1, + "currency": "INR", + "description": "Buyer platform fee (2%)" + }, + { + "type": "FEE", + "value": 12.15, + "currency": "INR", + "description": "Seller platform fee (3%)" + } + ] + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 425.25 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "SETTLED", + "beckn:paidAt": "2024-10-04T18:40:00Z", + "beckn:txnRef": "TXN-ENERGY-001-SETTLED" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/publish-catalog.json b/examples/p2p-trading-interdiscom/v2/publish-catalog.json new file mode 100644 index 00000000..509eeb3b --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/publish-catalog.json @@ -0,0 +1,178 @@ +{ + "context": { + "version": "2.0.0", + "action": "catalog_publish", + "timestamp": "2024-10-04T08:00:00Z", + "message_id": "msg-publish-001", + "transaction_id": "txn-catalog-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "catalogs": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Catalog", + "beckn:id": "catalog-energy-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Trading Catalog" + }, + "beckn:bppId": "bpp.energy-provider.com", + "beckn:bppUri": "https://bpp.energy-provider.com", + "beckn:items": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-interdiscom-trading-test-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 30.5 kWh", + "beckn:shortDesc": "Carbon Offset Certified Solar Energy", + "beckn:longDesc": "High-quality solar energy from verified source with carbon offset certification" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + }, + "beckn:providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityId": "TEST_DISCOM_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "meterId": "TEST_METER_SELLER" + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-interdiscom-trading-test-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-002", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 50.0 kWh", + "beckn:shortDesc": "Standard Solar Energy", + "beckn:longDesc": "Reliable solar energy from verified source" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + }, + "beckn:providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityId": "TEST_DISCOM_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "meterId": "TEST_METER_SELLER" + } + } + ], + "beckn:offers": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-001", + "beckn:isActive": true, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Offer - Morning Slot" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 30.5, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T10:00:00Z", + "schema:endTime": "2024-10-04T14:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + } + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-002", + "beckn:isActive": true, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Offer - Afternoon Slot" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-002" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 12, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 50.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T14:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-04T13:00:00Z" + } + } + } + ] + } + ] + } +} diff --git a/examples/p2p-trading-interdiscom/v2/publish-reduce-catalog-inventory.json b/examples/p2p-trading-interdiscom/v2/publish-reduce-catalog-inventory.json new file mode 100644 index 00000000..3dccf4fa --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/publish-reduce-catalog-inventory.json @@ -0,0 +1,179 @@ +{ + "context": { + "version": "2.0.0", + "action": "catalog_publish", + "timestamp": "2024-10-04T08:00:00Z", + "message_id": "msg-publish-001", + "transaction_id": "txn-catalog-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "catalogs": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Catalog", + "beckn:id": "catalog-energy-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Trading Catalog" + }, + "beckn:bppId": "bpp.energy-provider.com", + "beckn:bppUri": "https://bpp.energy-provider.com", + "beckn:isActive": true, + "beckn:items": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-interdiscom-trading-test-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 3.5 kWh", + "beckn:shortDesc": "Carbon Offset Certified Solar Energy", + "beckn:longDesc": "High-quality solar energy from verified source with carbon offset certification" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + }, + "beckn:providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityId": "TEST_DISCOM_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "meterId": "TEST_METER_SELLER" + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-interdiscom-trading-test-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-002", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 50.0 kWh", + "beckn:shortDesc": "Standard Solar Energy", + "beckn:longDesc": "Reliable solar energy from verified source" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + }, + "beckn:providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityId": "TEST_DISCOM_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "meterId": "TEST_METER_SELLER" + } + } + ], + "beckn:offers": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-001", + "beckn:isActive": true, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Daily Settlement Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.5, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T10:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-04T23:59:59Z" + } + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-002", + "beckn:isActive": true, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Bulk Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-002" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 12, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T08:00:00Z", + "schema:endTime": "2024-10-04T16:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-11T23:59:59Z" + } + } + } + ] + } + ] + } +} diff --git a/examples/p2p-trading-interdiscom/v2/publish-revoke-catalog.json b/examples/p2p-trading-interdiscom/v2/publish-revoke-catalog.json new file mode 100644 index 00000000..ba969a23 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/publish-revoke-catalog.json @@ -0,0 +1,177 @@ +{ + "context": { + "version": "2.0.0", + "action": "catalog_publish", + "timestamp": "2024-10-04T08:00:00Z", + "message_id": "msg-publish-001", + "transaction_id": "txn-catalog-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "catalogs": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Catalog", + "beckn:id": "catalog-energy-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Trading Catalog" + }, + "beckn:bppId": "bpp.energy-provider.com", + "beckn:bppUri": "https://bpp.energy-provider.com", + "beckn:isActive": false, + "beckn:items": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-interdiscom-trading-test-network"], + "beckn:id": "energy-resource-solar-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 30.5 kWh", + "beckn:shortDesc": "Carbon Offset Certified Solar Energy", + "beckn:longDesc": "High-quality solar energy from verified source with carbon offset certification" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + }, + "beckn:providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityId": "TEST_DISCOM_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "meterId": "TEST_METER_SELLER" + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-interdiscom-trading-test-network"], + "beckn:id": "energy-resource-solar-002", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 50.0 kWh", + "beckn:shortDesc": "Standard Solar Energy", + "beckn:longDesc": "Reliable solar energy from verified source" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + }, + "beckn:providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityId": "TEST_DISCOM_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "meterId": "TEST_METER_SELLER" + } + } + ], + "beckn:offers": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-001", + "beckn:isActive": false, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Daily Settlement Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 30.5, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T10:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-04T23:59:59Z" + } + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-002", + "beckn:isActive": false, + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Bulk Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-002" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 12, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 50.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T08:00:00Z", + "schema:endTime": "2024-10-04T16:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-11T23:59:59Z" + } + } + } + ] + } + ] + } +} diff --git a/examples/p2p-trading-interdiscom/v2/select-request.json b/examples/p2p-trading-interdiscom/v2/select-request.json new file mode 100644 index 00000000..a0ef8866 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/select-request.json @@ -0,0 +1,159 @@ +{ + "context": { + "version": "2.0.0", + "action": "select", + "timestamp": "2024-10-04T10:15:00Z", + "message_id": "msg-select-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/select-response.json b/examples/p2p-trading-interdiscom/v2/select-response.json new file mode 100644 index 00000000..38b56c82 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/select-response.json @@ -0,0 +1,174 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_select", + "timestamp": "2024-10-04T10:15:05Z", + "message_id": "msg-on-select-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": { + "unitQuantity": 25.0, + "unitText": "kWh" + } + }, + "beckn:orderValue": { + "currency": "INR", + "value": 405, + "description": "Inter-platform settlement at catalog prices (15 kWh × ₹15 + 10 kWh × ₹18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:paymentStatus": "PENDING", + "beckn:acceptedPaymentMethod": [ + "UPI", + "BANK_TRANSFER", + "WALLET" + ] + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/v2/P2P_Trading/status-request.json b/examples/p2p-trading-interdiscom/v2/status-request.json similarity index 70% rename from examples/v2/P2P_Trading/status-request.json rename to examples/p2p-trading-interdiscom/v2/status-request.json index 54efa276..a332a450 100644 --- a/examples/v2/P2P_Trading/status-request.json +++ b/examples/p2p-trading-interdiscom/v2/status-request.json @@ -10,14 +10,11 @@ "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade" + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" }, "message": { "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", "beckn:id": "order-energy-001" } } } - diff --git a/examples/p2p-trading-interdiscom/v2/status-response-completed.json b/examples/p2p-trading-interdiscom/v2/status-response-completed.json new file mode 100644 index 00000000..e413964b --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/status-response-completed.json @@ -0,0 +1,231 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T18:30:00Z", + "message_id": "msg-on-status-completed-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "COMPLETED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 15.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + }, + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T09:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T12:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T12:00:00Z", + "schema:endTime": "2024-10-04T15:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 5.0, + "allocatedEnergy": 5.0, + "unit": "kWh" + }, + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T15:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 5.0, + "allocatedEnergy": 5.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 405, + "description": "Inter-platform settlement at catalog prices (15 kWh × ₹15 + 10 kWh × ₹18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 405 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "SETTLED", + "beckn:paidAt": "2024-10-04T19:00:00Z" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/status-response-curtailed.json b/examples/p2p-trading-interdiscom/v2/status-response-curtailed.json new file mode 100644 index 00000000..8989af98 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/status-response-curtailed.json @@ -0,0 +1,217 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T16:00:00Z", + "message_id": "msg-on-status-curtailed-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "PARTIALLYFULFILLED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "curtailedQuantity": 5.0, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T14:30:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 10.0, + "allocatedEnergy": 10.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "FAILED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 0.0, + "curtailedQuantity": 10.0, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 150 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "COMPLETED", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "bap.energy-consumer.com", + "accountHolderName": "Energy Consumer BAP Pvt Ltd", + "accountNumber": "1234567890", + "ifscCode": "HDFC0001234", + "bankName": "HDFC Bank", + "vpa": "energy-consumer@upi" + }, + { + "beneficiaryId": "bpp.energy-provider.com", + "accountHolderName": "Solar Farm Energy Provider Pvt Ltd", + "accountNumber": "9876543210", + "ifscCode": "ICICI0005678", + "bankName": "ICICI Bank", + "vpa": "solar-provider@upi" + } + ] + } + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/status-response-final-invoice.json b/examples/p2p-trading-interdiscom/v2/status-response-final-invoice.json new file mode 100644 index 00000000..cbb05741 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/status-response-final-invoice.json @@ -0,0 +1,227 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T18:15:00Z", + "message_id": "msg-on-status-final-invoice-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "INPROGRESS", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 15.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 15.0, + "allocatedEnergy": 15.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T12:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 10.0, + "allocatedEnergy": 10.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 405, + "description": "Inter-platform settlement at catalog prices (15 kWh × ₹15 + 10 kWh × ₹18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 405 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED", + "beckn:acceptedPaymentMethod": [ + "UPI", + "BANK_TRANSFER" + ], + "beckn:paymentURL": "https://payments.seller-platform.com/track?txn=TXN-ENERGY-001", + "beckn:paymentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/PaymentSettlement/v1/context.jsonld", + "@type": "PaymentSettlement", + "settlementAccounts": [ + { + "beneficiaryId": "bpp.energy-provider.com", + "accountHolderName": "Solar Farm Energy Provider Pvt Ltd", + "accountNumber": "9876543210", + "ifscCode": "ICICI0005678", + "bankName": "ICICI Bank", + "vpa": "solar-provider@upi" + } + ] + } + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/status-response-settlement-complete.json b/examples/p2p-trading-interdiscom/v2/status-response-settlement-complete.json new file mode 100644 index 00000000..7ee11291 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/status-response-settlement-complete.json @@ -0,0 +1,96 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T18:45:00Z", + "message_id": "msg-on-status-settlement-complete-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "COMPLETED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ] + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ] + } + } + ], + "beckn:orderValue": { + "currency": "INR", + "value": 405, + "description": "Inter-platform settlement at catalog prices (15 kWh × ₹15 + 10 kWh × ₹18). Catalog prices are inclusive of seller platform charges." + }, + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 405 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "SETTLED", + "beckn:paidAt": "2024-10-04T18:40:00Z", + "beckn:txnRef": "TXN-ENERGY-001-SETTLED" + } + } + } +} diff --git a/examples/p2p-trading-interdiscom/v2/status-response.json b/examples/p2p-trading-interdiscom/v2/status-response.json new file mode 100644 index 00000000..d8800b39 --- /dev/null +++ b/examples/p2p-trading-interdiscom/v2/status-response.json @@ -0,0 +1,191 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T15:00:05Z", + "message_id": "msg-on-status-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer", + "beckn:id": "buyer-001", + "beckn:buyerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_BUYER", + "utilityCustomerId": "TEST-CUST-BUYER-001", + "utilityId": "TEST_DISCOM_BUYER" + } + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 7.5, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T15:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 15, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T11:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T06:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "TEST_METER_SELLER", + "utilityCustomerId": "TEST-CUST-SELLER-001", + "utilityId": "TEST_DISCOM_SELLER" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "PENDING", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 0.0, + "meterReadings": [], + "lastUpdated": "2024-10-04T15:00:00Z" + } + }, + "beckn:acceptedOffer": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 18, + "schema:priceCurrency": "INR", + "unitText": "kWh", + "applicableQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + } + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/DEG/tags/deg-1.0.0/specification/schema/EnergyTrade/v0.3/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "deliveryWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T14:00:00Z", + "schema:endTime": "2026-01-09T15:00:00Z" + }, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T10:00:00Z" + } + } + } + } + ], + "beckn:payment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Payment", + "beckn:id": "payment-p2p-energy-001", + "beckn:amount": { + "currency": "INR", + "value": 425.25 + }, + "beckn:beneficiary": "BPP", + "beckn:paymentStatus": "AUTHORIZED" + } + } + } +} diff --git a/examples/p2p-trading/v2/cascaded-confirm-request.json b/examples/p2p-trading/v2/cascaded-confirm-request.json new file mode 100644 index 00000000..903e6249 --- /dev/null +++ b/examples/p2p-trading/v2/cascaded-confirm-request.json @@ -0,0 +1,102 @@ +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "timestamp": "2024-10-04T10:25:00Z", + "message_id": "msg-cascaded-confirm-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": 15.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/p2p-trading/v2/cascaded-init-request.json b/examples/p2p-trading/v2/cascaded-init-request.json new file mode 100644 index 00000000..e3d496d1 --- /dev/null +++ b/examples/p2p-trading/v2/cascaded-init-request.json @@ -0,0 +1,102 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "timestamp": "2024-10-04T10:20:00Z", + "message_id": "msg-cascaded-init-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": 15.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/p2p-trading/v2/cascaded-on-confirm-response.json b/examples/p2p-trading/v2/cascaded-on-confirm-response.json new file mode 100644 index 00000000..ffcf95da --- /dev/null +++ b/examples/p2p-trading/v2/cascaded-on-confirm-response.json @@ -0,0 +1,103 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "timestamp": "2024-10-04T10:25:05Z", + "message_id": "msg-cascaded-on-confirm-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-cascaded-utility-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": 15.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/p2p-trading/v2/cascaded-on-init-response.json b/examples/p2p-trading/v2/cascaded-on-init-response.json new file mode 100644 index 00000000..8e39fff3 --- /dev/null +++ b/examples/p2p-trading/v2/cascaded-on-init-response.json @@ -0,0 +1,102 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "timestamp": "2024-10-04T10:20:05Z", + "message_id": "msg-cascaded-on-init-001", + "transaction_id": "txn-cascaded-energy-001", + "bap_id": "p2pTrading-bpp.com", + "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", + "bpp_id": "example-transmission-bpp.com", + "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "p2pTrading-bpp.com", + "bpp_id": "example-transmission-bpp.com", + "total_quantity": 15.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/p2p-trading/v2/confirm-request.json b/examples/p2p-trading/v2/confirm-request.json new file mode 100644 index 00000000..373acbd2 --- /dev/null +++ b/examples/p2p-trading/v2/confirm-request.json @@ -0,0 +1,161 @@ +{ + "context": { + "version": "2.0.0", + "action": "confirm", + "timestamp": "2024-10-04T10:25:00Z", + "message_id": "msg-confirm-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/p2p-trading/v2/confirm-response.json b/examples/p2p-trading/v2/confirm-response.json new file mode 100644 index 00000000..0e941197 --- /dev/null +++ b/examples/p2p-trading/v2/confirm-response.json @@ -0,0 +1,162 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_confirm", + "timestamp": "2024-10-04T10:25:05Z", + "message_id": "msg-on-confirm-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/v2/P2P_Trading/discover-request.json b/examples/p2p-trading/v2/discover-request.json similarity index 57% rename from examples/v2/P2P_Trading/discover-request.json rename to examples/p2p-trading/v2/discover-request.json index bea3e96f..ba5a76fe 100644 --- a/examples/v2/P2P_Trading/discover-request.json +++ b/examples/p2p-trading/v2/discover-request.json @@ -10,7 +10,7 @@ "bpp_id": "bpp.energy-provider.com", "bpp_uri": "https://bpp.energy-provider.com", "ttl": "PT30S", - "domain": "energy-trade", + "domain": "beckn.one:deg:p2p-trading:2.0.0", "location": { "city": { "code": "BLR", @@ -20,14 +20,15 @@ "code": "IND", "name": "India" } - } + }, + "schema_context": [ + "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyResource/v0.2/context.jsonld" + ] }, "message": { - "text_search": "solar energy grid injection", "filters": { "type": "jsonpath", - "expression": "$[?(@.itemAttributes.sourceType == 'SOLAR' && @.itemAttributes.deliveryMode == 'GRID_INJECTION' && @.itemAttributes.availableQuantity >= 10.0 && @.itemAttributes.productionWindow.start <= '2024-10-04T10:00:00Z' && @.itemAttributes.productionWindow.end >= '2024-10-04T18:00:00Z')]" + "expression": "$[?('p2p-trading-pilot-network' == @.beckn:networkId && @.beckn:itemAttributes.sourceType == 'SOLAR' && @.beckn:itemAttributes.deliveryMode == 'GRID_INJECTION' && @.beckn:itemAttributes.availableQuantity >= 10.0 )]" } } } - diff --git a/examples/p2p-trading/v2/discover-response.json b/examples/p2p-trading/v2/discover-response.json new file mode 100644 index 00000000..655ef856 --- /dev/null +++ b/examples/p2p-trading/v2/discover-response.json @@ -0,0 +1,170 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_discover", + "timestamp": "2024-10-04T10:00:05Z", + "message_id": "msg-on-discover-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "catalogs": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Catalog", + "beckn:id": "catalog-energy-001", + "beckn:bppId": "bpp.energy-provider.com", + "beckn:bppUri": "https://bpp.energy-provider.com", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Trading Catalog" + }, + "beckn:items": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-trading-pilot-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 30.5 kWh" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyResource/v0.2/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "deliveryMode": "GRID_INJECTION", + "certificationStatus": "Carbon Offset Certified", + "meterId": "der://meter/100200300", + "availableQuantity": 30.5, + "productionWindow": [ + { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T10:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + ], + "sourceVerification": { + "verified": true, + "verificationDate": "2024-09-01T00:00:00Z", + "certificates": [ + "https://example.com/certs/solar-panel-cert.pdf" + ] + }, + "productionAsynchronous": true + } + } + ], + "beckn:offers": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-morning-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer - 6am-12pm" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "wheelingCharges": { + "amount": 2.5, + "currency": "USD", + "description": "PG&E Grid Services wheeling charge" + }, + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T23:59:59Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-afternoon-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer - 12pm-6pm" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "wheelingCharges": { + "amount": 2.5, + "currency": "USD", + "description": "PG&E Grid Services wheeling charge" + }, + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T23:59:59Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + ] + } + ] + } +} diff --git a/examples/p2p-trading/v2/init-request.json b/examples/p2p-trading/v2/init-request.json new file mode 100644 index 00000000..6328de09 --- /dev/null +++ b/examples/p2p-trading/v2/init-request.json @@ -0,0 +1,161 @@ +{ + "context": { + "version": "2.0.0", + "action": "init", + "timestamp": "2024-10-04T10:20:00Z", + "message_id": "msg-init-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/p2p-trading/v2/init-response.json b/examples/p2p-trading/v2/init-response.json new file mode 100644 index 00000000..0f7391e1 --- /dev/null +++ b/examples/p2p-trading/v2/init-response.json @@ -0,0 +1,161 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_init", + "timestamp": "2024-10-04T10:20:05Z", + "message_id": "msg-on-init-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ], + "beckn:fulfillment": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Fulfillment", + "beckn:id": "fulfillment-energy-001", + "beckn:mode": "DELIVERY" + } + } + } +} diff --git a/examples/p2p-trading/v2/on-update-response-curtailment.json b/examples/p2p-trading/v2/on-update-response-curtailment.json new file mode 100644 index 00000000..2baf975d --- /dev/null +++ b/examples/p2p-trading/v2/on-update-response-curtailment.json @@ -0,0 +1,113 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_update", + "timestamp": "2024-10-04T14:30:00Z", + "message_id": "msg-on-update-curtailment-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "INPROGRESS", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 8.5, + "curtailedQuantity": 6.5, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 8.5, + "allocatedEnergy": 8.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/p2p-trading/v2/publish-catalog.json b/examples/p2p-trading/v2/publish-catalog.json new file mode 100644 index 00000000..47625bfc --- /dev/null +++ b/examples/p2p-trading/v2/publish-catalog.json @@ -0,0 +1,206 @@ +{ + "context": { + "version": "2.0.0", + "action": "catalog_publish", + "timestamp": "2024-10-04T08:00:00Z", + "message_id": "msg-publish-001", + "transaction_id": "txn-catalog-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "catalogs": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Catalog", + "beckn:id": "catalog-energy-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy Trading Catalog" + }, + "beckn:bppId": "bpp.energy-provider.com", + "beckn:bppUri": "https://bpp.energy-provider.com", + "beckn:items": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-trading-pilot-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 30.5 kWh", + "beckn:shortDesc": "Carbon Offset Certified Solar Energy", + "beckn:longDesc": "High-quality solar energy from verified source with carbon offset certification" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyResource/v0.2/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "deliveryMode": "GRID_INJECTION", + "certificationStatus": "Carbon Offset Certified", + "meterId": "der://meter/100200300", + "availableQuantity": 30.5, + "productionWindow": [ + { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T10:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + } + ], + "sourceVerification": { + "verified": true, + "verificationDate": "2024-09-01T00:00:00Z", + "certificates": [ + "https://example.com/certs/solar-panel-cert.pdf" + ] + }, + "productionAsynchronous": true + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Item", + "beckn:networkId": ["p2p-trading-pilot-network"], + "beckn:isActive": true, + "beckn:id": "energy-resource-solar-002", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Energy - 50.0 kWh", + "beckn:shortDesc": "Standard Solar Energy", + "beckn:longDesc": "Reliable solar energy from verified source" + }, + "beckn:provider": { + "beckn:id": "provider-solar-farm-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Solar Farm 001" + } + }, + "beckn:itemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyResource/v0.2/context.jsonld", + "@type": "EnergyResource", + "sourceType": "SOLAR", + "deliveryMode": "GRID_INJECTION", + "certificationStatus": "Standard Certified", + "meterId": "der://meter/100200301", + "availableQuantity": 50.0, + "productionWindow": [ + { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T08:00:00Z", + "schema:endTime": "2024-10-04T16:00:00Z" + } + ], + "sourceVerification": { + "verified": true, + "verificationDate": "2024-09-01T00:00:00Z", + "certificates": [ + "https://example.com/certs/solar-panel-cert-2.pdf" + ] + }, + "productionAsynchronous": true + } + } + ], + "beckn:offers": [ + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-001", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Daily Settlement Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.15, + "schema:priceCurrency": "USD", + "schema:unitText": "kWh" + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "wheelingCharges": { + "amount": 2.5, + "currency": "USD", + "description": "PG&E Grid Services wheeling charge" + }, + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-04T23:59:59Z" + }, + "beckn:maxQuantity": { + "unitQuantity": 30.5, + "unitText": "kWh", + "unitCode": "KWH" + } + } + }, + { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:id": "offer-energy-002", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Bulk Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-002" + ], + "beckn:price": { + "@type": "schema:PriceSpecification", + "schema:price": 0.12, + "schema:priceCurrency": "USD", + "schema:unitText": "kWh" + }, + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "WEEKLY", + "wheelingCharges": { + "amount": 2.0, + "currency": "USD", + "description": "PG&E Grid Services wheeling charge" + }, + "minimumQuantity": 10.0, + "maximumQuantity": 500.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T00:00:00Z", + "schema:endTime": "2024-10-11T23:59:59Z" + }, + "beckn:maxQuantity": { + "unitQuantity": 50.0, + "unitText": "kWh", + "unitCode": "KWH" + } + } + } + ] + } + ] + } +} diff --git a/examples/p2p-trading/v2/select-request.json b/examples/p2p-trading/v2/select-request.json new file mode 100644 index 00000000..ad49b036 --- /dev/null +++ b/examples/p2p-trading/v2/select-request.json @@ -0,0 +1,155 @@ +{ + "context": { + "version": "2.0.0", + "action": "select", + "timestamp": "2024-10-04T10:15:00Z", + "message_id": "msg-select-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/p2p-trading/v2/select-response.json b/examples/p2p-trading/v2/select-response.json new file mode 100644 index 00000000..397d3fca --- /dev/null +++ b/examples/p2p-trading/v2/select-response.json @@ -0,0 +1,155 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_select", + "timestamp": "2024-10-04T10:15:05Z", + "message_id": "msg-on-select-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOrder/v0.2/context.jsonld", + "@type": "EnergyTradeOrder", + "bap_id": "bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "total_quantity": 25.0 + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + } + }, + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/p2p-trading/v2/status-request.json b/examples/p2p-trading/v2/status-request.json new file mode 100644 index 00000000..510c483d --- /dev/null +++ b/examples/p2p-trading/v2/status-request.json @@ -0,0 +1,20 @@ +{ + "context": { + "version": "2.0.0", + "action": "status", + "timestamp": "2024-10-04T15:00:00Z", + "message_id": "msg-status-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "beckn:id": "order-energy-001" + } + } +} \ No newline at end of file diff --git a/examples/p2p-trading/v2/status-response-completed.json b/examples/p2p-trading/v2/status-response-completed.json new file mode 100644 index 00000000..39c792ec --- /dev/null +++ b/examples/p2p-trading/v2/status-response-completed.json @@ -0,0 +1,213 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T18:30:00Z", + "message_id": "msg-on-status-completed-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "COMPLETED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 15.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + }, + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T09:00:00Z", + "schema:endTime": "2024-10-04T12:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T12:00:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T12:00:00Z", + "schema:endTime": "2024-10-04T15:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 5.0, + "allocatedEnergy": 5.0, + "unit": "kWh" + }, + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T15:00:00Z", + "schema:endTime": "2024-10-04T18:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 5.0, + "allocatedEnergy": 5.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T18:00:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/p2p-trading/v2/status-response-curtailed.json b/examples/p2p-trading/v2/status-response-curtailed.json new file mode 100644 index 00000000..7a406234 --- /dev/null +++ b/examples/p2p-trading/v2/status-response-curtailed.json @@ -0,0 +1,183 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T16:00:00Z", + "message_id": "msg-on-status-curtailed-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "PARTIALLYFULFILLED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "COMPLETED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 10.0, + "curtailedQuantity": 5.0, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T14:30:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 10.0, + "allocatedEnergy": 10.0, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "FAILED", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 0.0, + "curtailedQuantity": 10.0, + "curtailmentReason": "GRID_OUTAGE", + "meterReadings": [], + "lastUpdated": "2024-10-04T14:30:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/p2p-trading/v2/status-response.json b/examples/p2p-trading/v2/status-response.json new file mode 100644 index 00000000..1a7625cf --- /dev/null +++ b/examples/p2p-trading/v2/status-response.json @@ -0,0 +1,179 @@ +{ + "context": { + "version": "2.0.0", + "action": "on_status", + "timestamp": "2024-10-04T15:00:05Z", + "message_id": "msg-on-status-001", + "transaction_id": "txn-energy-001", + "bap_id": "bap.energy-consumer.com", + "bap_uri": "https://bap.energy-consumer.com", + "bpp_id": "bpp.energy-provider.com", + "bpp_uri": "https://bpp.energy-provider.com", + "ttl": "PT30S", + "domain": "beckn.one:deg:p2p-trading:2.0.0" + }, + "message": { + "order": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Order", + "beckn:id": "order-energy-001", + "beckn:orderStatus": "CREATED", + "beckn:seller": "provider-solar-farm-001", + "beckn:buyer": { + "beckn:id": "buyer-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Buyer" + }, + "beckn:orderItems": [ + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 15.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "IN_PROGRESS", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 7.5, + "meterReadings": [ + { + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2024-10-04T06:00:00Z", + "schema:endTime": "2024-10-04T09:00:00Z" + }, + "consumedEnergy": 0.0, + "producedEnergy": 7.5, + "allocatedEnergy": 7.5, + "unit": "kWh" + } + ], + "lastUpdated": "2024-10-04T15:00:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-morning-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Morning Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.15, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 20.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T06:00:00Z", + "schema:endTime": "2026-01-09T12:00:00Z" + } + } + } + }, + { + "beckn:orderedItem": "energy-resource-solar-001", + "beckn:quantity": { + "unitQuantity": 10.0, + "unitText": "kWh" + }, + "beckn:orderItemAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyOrderItem/v0.1/context.jsonld", + "@type": "EnergyOrderItem", + "providerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyCustomer/v0.1/context.jsonld", + "@type": "EnergyCustomer", + "meterId": "der://meter/98765456", + "utilityCustomerId": "UTIL-CUST-123456" + }, + "fulfillmentAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeDelivery/v0.2/context.jsonld", + "@type": "EnergyTradeDelivery", + "deliveryStatus": "PENDING", + "deliveryMode": "GRID_INJECTION", + "deliveredQuantity": 0.0, + "meterReadings": [], + "lastUpdated": "2024-10-04T15:00:00Z" + } + }, + "beckn:acceptedOffer": { + "beckn:id": "offer-afternoon-001", + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tags/core-2.0.0-rc-eos-release/schema/core/v2/context.jsonld", + "@type": "beckn:Offer", + "beckn:descriptor": { + "@type": "beckn:Descriptor", + "schema:name": "Afternoon Solar Energy Offer" + }, + "beckn:provider": "provider-solar-farm-001", + "beckn:items": [ + "energy-resource-solar-001" + ], + "beckn:offerAttributes": { + "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-v2/tpddl-p2p-trading-pilot-v20260201/schema/EnergyTradeOffer/v0.2/context.jsonld", + "@type": "EnergyTradeOffer", + "pricingModel": "PER_KWH", + "settlementType": "DAILY", + "sourceMeterId": "der://meter/100200300", + "minimumQuantity": 1.0, + "maximumQuantity": 100.0, + "validityWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T00:00:00Z", + "schema:endTime": "2026-01-09T05:00:00Z" + }, + "beckn:price": { + "value": 0.18, + "currency": "USD", + "unitText": "kWh" + }, + "beckn:maxQuantity": { + "unitQuantity": 15.0, + "unitText": "kWh", + "unitCode": "KWH" + }, + "beckn:timeWindow": { + "@type": "beckn:TimePeriod", + "schema:startTime": "2026-01-09T12:00:00Z", + "schema:endTime": "2026-01-09T18:00:00Z" + } + } + } + } + ] + } + } +} diff --git a/examples/v2/P2P_Trading/cascaded-init-request.json b/examples/v2/P2P_Trading/cascaded-init-request.json deleted file mode 100644 index 4fec5359..00000000 --- a/examples/v2/P2P_Trading/cascaded-init-request.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "init", - "timestamp": "2024-10-04T10:20:00Z", - "message_id": "msg-cascaded-init-001", - "transaction_id": "txn-cascaded-energy-001", - "bap_id": "p2pTrading-bpp.com", - "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", - "bpp_id": "example-transmission-bpp.com", - "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", - "ttl": "PT30S", - "domain": "energy-trade", - "location": { - "city": { - "code": "std:522", - "name": "Lucknow" - }, - "country": { - "code": "IND", - "name": "India" - } - } - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-cascaded-utility-001", - "beckn:provider": { - "@type": "beckn:Provider", - "beckn:id": "provider-uppcl-001", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "UPPCL" - } - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-utility-registration-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:customer": { - "@type": "beckn:Customer", - "beckn:person": { - "@type": "schema:Person", - "schema:name": "Raj" - }, - "beckn:contact": { - "@type": "schema:ContactPoint", - "schema:telephone": "+91-1276522222" - } - }, - "beckn:stops": [ - { - "@type": "beckn:Stop", - "beckn:id": "stop-source-utility-001", - "beckn:type": "START", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "92982739" - }, - "beckn:time": { - "@type": "beckn:Time", - "beckn:range": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - } - } - }, - { - "@type": "beckn:Stop", - "beckn:id": "stop-target-utility-001", - "beckn:type": "END", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "98765456" - }, - "beckn:time": { - "@type": "beckn:Time", - "beckn:range": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - } - } - } - ] - } - ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "PENDING", - "sourceMeterId": "92982739", - "targetMeterId": "98765456", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR" - }, - "beckn:billing": { - "@type": "beckn:Billing", - "beckn:name": "p2p-Trading-BPP", - "beckn:email": "p2tbpp@example.com", - "beckn:phone": "+91-1276522222" - } - } - } -} diff --git a/examples/v2/P2P_Trading/cascaded-on-init-response.json b/examples/v2/P2P_Trading/cascaded-on-init-response.json deleted file mode 100644 index 16f4030e..00000000 --- a/examples/v2/P2P_Trading/cascaded-on-init-response.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "on_init", - "timestamp": "2024-10-04T10:20:05Z", - "message_id": "msg-cascaded-on-init-001", - "transaction_id": "txn-cascaded-energy-001", - "bap_id": "p2pTrading-bpp.com", - "bap_uri": "https://api.p2pTrading-bpp.com/pilot/bap/energy/v2", - "bpp_id": "example-transmission-bpp.com", - "bpp_uri": "https://api.example-transmission-bpp.com/pilot/bpp/", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-cascaded-utility-001", - "beckn:provider": { - "@type": "beckn:Provider", - "beckn:id": "provider-uppcl-001", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "UPPCL" - } - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-utility-registration-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:customer": { - "@type": "beckn:Customer", - "beckn:person": { - "@type": "schema:Person", - "schema:name": "Raj" - }, - "beckn:contact": { - "@type": "schema:ContactPoint", - "schema:telephone": "+91-1276522222" - } - }, - "beckn:stops": [ - { - "@type": "beckn:Stop", - "beckn:id": "stop-source-utility-001", - "beckn:type": "START", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "92982739" - } - }, - { - "@type": "beckn:Stop", - "beckn:id": "stop-target-utility-001", - "beckn:type": "END", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "98765456" - } - } - ] - } - ], - "beckn:quote": { - "@type": "beckn:Quotation", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 2.5, - "schema:priceCurrency": "INR" - }, - "beckn:breakup": [ - { - "@type": "beckn:Breakup", - "beckn:title": "Wheeling Charge", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 2.5, - "schema:priceCurrency": "INR" - } - } - ] - }, - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "PENDING", - "sourceMeterId": "92982739", - "targetMeterId": "98765456", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR" - }, - "beckn:billing": { - "@type": "beckn:Billing", - "beckn:name": "p2p-Trading-BPP", - "beckn:email": "p2ptbpp@example.com", - "beckn:phone": "+91-1276522222" - }, - "beckn:cancellationTerms": [ - { - "@type": "beckn:CancellationTerm", - "beckn:externalRef": { - "@type": "schema:MediaObject", - "schema:encodingFormat": "text/html", - "schema:contentUrl": "https://mvvnl.in/cancellation_terms.html" - } - } - ] - } - } -} diff --git a/examples/v2/P2P_Trading/confirm-request.json b/examples/v2/P2P_Trading/confirm-request.json deleted file mode 100644 index 755e8548..00000000 --- a/examples/v2/P2P_Trading/confirm-request.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "confirm", - "timestamp": "2024-10-04T10:25:00Z", - "message_id": "msg-confirm-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY" - } - ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ] - } - } -} - diff --git a/examples/v2/P2P_Trading/confirm-response.json b/examples/v2/P2P_Trading/confirm-response.json deleted file mode 100644 index f2ab1f87..00000000 --- a/examples/v2/P2P_Trading/confirm-response.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "on_confirm", - "timestamp": "2024-10-04T10:25:05Z", - "message_id": "msg-on-confirm-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:state": { - "@type": "beckn:State", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "PENDING" - } - } - } - ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "ACTIVE", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "inverterId": "inv-12345", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR", - "certification": { - "status": "Carbon Offset Certified", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - }, - "settlementCycles": [ - { - "cycleId": "settle-2024-10-04-001", - "startTime": "2024-10-04T00:00:00Z", - "endTime": "2024-10-04T23:59:59Z", - "status": "PENDING", - "amount": 0.0, - "currency": "USD" - } - ] - } - } - } -} - diff --git a/examples/v2/P2P_Trading/discover-response.json b/examples/v2/P2P_Trading/discover-response.json deleted file mode 100644 index d9d0fc9e..00000000 --- a/examples/v2/P2P_Trading/discover-response.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "on_discover", - "timestamp": "2024-10-04T10:00:05Z", - "message_id": "msg-on-discover-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "catalogs": [ - { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Catalog", - "beckn:id": "catalog-energy-001", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "Solar Energy Trading Catalog" - }, - "beckn:items": [ - { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Item", - "beckn:id": "energy-resource-solar-001", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "Solar Energy - 30.5 kWh", - "beckn:shortDesc": "Carbon Offset Certified Solar Energy", - "beckn:longDesc": "High-quality solar energy from verified source with carbon offset certification" - }, - "beckn:provider": { - "@type": "beckn:Provider", - "beckn:id": "provider-solar-farm-001" - }, - "beckn:itemAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyResource/v0.2/context.jsonld", - "@type": "EnergyResource", - "sourceType": "SOLAR", - "deliveryMode": "GRID_INJECTION", - "certificationStatus": "Carbon Offset Certified", - "meterId": "100200300", - "inverterId": "inv-12345", - "availableQuantity": 30.5, - "productionWindow": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - }, - "sourceVerification": { - "verified": true, - "verificationDate": "2024-09-01T00:00:00Z", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - }, - "productionAsynchronous": true - } - } - ], - "beckn:offers": [ - { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Offer", - "beckn:id": "offer-energy-001", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "Daily Settlement Solar Energy Offer" - }, - "beckn:provider": "provider-solar-farm-001", - "beckn:items": ["energy-resource-solar-001"], - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 0.15, - "schema:priceCurrency": "USD", - "schema:unitText": "kWh" - }, - "beckn:offerAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeOffer/v0.2/context.jsonld", - "@type": "EnergyTradeOffer", - "pricingModel": "PER_KWH", - "settlementType": "DAILY", - "wheelingCharges": { - "amount": 2.5, - "currency": "USD", - "description": "PG&E Grid Services wheeling charge" - }, - "minimumQuantity": 1.0, - "maximumQuantity": 100.0, - "validityWindow": { - "start": "2024-10-04T00:00:00Z", - "end": "2024-10-04T23:59:59Z" - } - } - } - ] - } - ] - } -} - diff --git a/examples/v2/P2P_Trading/init-request.json b/examples/v2/P2P_Trading/init-request.json deleted file mode 100644 index ad9b76fb..00000000 --- a/examples/v2/P2P_Trading/init-request.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "init", - "timestamp": "2024-10-04T10:20:00Z", - "message_id": "msg-init-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:stops": [ - { - "@type": "beckn:Stop", - "beckn:id": "stop-start-001", - "beckn:type": "START", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "100200300" - }, - "beckn:time": { - "@type": "beckn:Time", - "beckn:range": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - } - } - }, - { - "@type": "beckn:Stop", - "beckn:id": "stop-end-001", - "beckn:type": "END", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "98765456" - }, - "beckn:time": { - "@type": "beckn:Time", - "beckn:range": { - "start": "2024-10-04T10:00:00Z", - "end": "2024-10-04T18:00:00Z" - } - } - } - ] - } - ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ], - "beckn:billing": { - "@type": "beckn:Billing", - "beckn:name": "Energy Consumer", - "beckn:email": "consumer@example.com", - "beckn:phone": "+1-555-0100" - } - } - } -} - diff --git a/examples/v2/P2P_Trading/init-response.json b/examples/v2/P2P_Trading/init-response.json deleted file mode 100644 index dd9b5158..00000000 --- a/examples/v2/P2P_Trading/init-response.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "on_init", - "timestamp": "2024-10-04T10:20:05Z", - "message_id": "msg-on-init-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:stops": [ - { - "@type": "beckn:Stop", - "beckn:id": "stop-start-001", - "beckn:type": "START", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "100200300" - } - }, - { - "@type": "beckn:Stop", - "beckn:id": "stop-end-001", - "beckn:type": "END", - "beckn:location": { - "@type": "beckn:Location", - "beckn:address": "98765456" - } - } - ] - } - ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "PENDING", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "inverterId": "inv-12345", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR", - "certification": { - "status": "Carbon Offset Certified", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - } - } - } - } -} - diff --git a/examples/v2/P2P_Trading/select-request.json b/examples/v2/P2P_Trading/select-request.json deleted file mode 100644 index e891f620..00000000 --- a/examples/v2/P2P_Trading/select-request.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "select", - "timestamp": "2024-10-04T10:15:00Z", - "message_id": "msg-select-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - } - } - } -} - diff --git a/examples/v2/P2P_Trading/select-response.json b/examples/v2/P2P_Trading/select-response.json deleted file mode 100644 index 8527cffc..00000000 --- a/examples/v2/P2P_Trading/select-response.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "on_select", - "timestamp": "2024-10-04T10:15:05Z", - "message_id": "msg-on-select-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:quote": { - "@type": "beckn:Quotation", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 1.5, - "schema:priceCurrency": "USD", - "schema:unitText": "kWh" - }, - "beckn:breakup": [ - { - "@type": "beckn:Breakup", - "beckn:title": "Energy Cost (10 kWh @ $0.15/kWh)", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 1.5, - "schema:priceCurrency": "USD" - } - }, - { - "@type": "beckn:Breakup", - "beckn:title": "Wheeling Charges", - "beckn:price": { - "@type": "schema:PriceSpecification", - "schema:price": 2.5, - "schema:priceCurrency": "USD" - } - } - ] - } - } - } -} - diff --git a/examples/v2/P2P_Trading/status-response-completed.json b/examples/v2/P2P_Trading/status-response-completed.json deleted file mode 100644 index 6de2f0e3..00000000 --- a/examples/v2/P2P_Trading/status-response-completed.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "on_status", - "timestamp": "2024-10-04T18:30:00Z", - "message_id": "msg-on-status-completed-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:state": { - "@type": "beckn:State", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "COMPLETED" - } - }, - "beckn:attributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeDelivery/v0.2/context.jsonld", - "@type": "EnergyTradeDelivery", - "deliveryStatus": "COMPLETED", - "deliveryMode": "GRID_INJECTION", - "deliveredQuantity": 10.0, - "deliveryStartTime": "2024-10-04T10:00:00Z", - "deliveryEndTime": "2024-10-04T18:00:00Z", - "meterReadings": [ - { - "timestamp": "2024-10-04T10:00:00Z", - "sourceReading": 1000.0, - "targetReading": 990.0, - "energyFlow": 0.0 - }, - { - "timestamp": "2024-10-04T12:00:00Z", - "sourceReading": 1000.5, - "targetReading": 990.3, - "energyFlow": 0.3 - }, - { - "timestamp": "2024-10-04T14:00:00Z", - "sourceReading": 1001.0, - "targetReading": 990.8, - "energyFlow": 0.5 - }, - { - "timestamp": "2024-10-04T16:00:00Z", - "sourceReading": 1002.0, - "targetReading": 991.5, - "energyFlow": 0.7 - }, - { - "timestamp": "2024-10-04T18:00:00Z", - "sourceReading": 1010.0, - "targetReading": 1000.0, - "energyFlow": 10.0 - } - ], - "telemetry": [ - { - "eventTime": "2024-10-04T18:00:00Z", - "metrics": [ - { - "name": "ENERGY", - "value": 10.0, - "unitCode": "KWH" - }, - { - "name": "POWER", - "value": 0.0, - "unitCode": "KW" - }, - { - "name": "VOLTAGE", - "value": 240.0, - "unitCode": "VLT" - } - ] - } - ], - "settlementCycleId": "settle-2024-10-04-001", - "lastUpdated": "2024-10-04T18:30:00Z" - } - } - ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "COMPLETED", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "inverterId": "inv-12345", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR", - "certification": { - "status": "Carbon Offset Certified", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - }, - "settlementCycles": [ - { - "cycleId": "settle-2024-10-04-001", - "startTime": "2024-10-04T00:00:00Z", - "endTime": "2024-10-04T23:59:59Z", - "status": "SETTLED", - "amount": 4.0, - "currency": "USD", - "breakdown": { - "energyCost": 1.5, - "wheelingCharges": 2.5 - } - } - ], - "lastUpdated": "2024-10-04T18:30:00Z" - } - } - } -} - diff --git a/examples/v2/P2P_Trading/status-response.json b/examples/v2/P2P_Trading/status-response.json deleted file mode 100644 index 9f0496d7..00000000 --- a/examples/v2/P2P_Trading/status-response.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "context": { - "version": "2.0.0", - "action": "on_status", - "timestamp": "2024-10-04T15:00:05Z", - "message_id": "msg-on-status-001", - "transaction_id": "txn-energy-001", - "bap_id": "bap.energy-consumer.com", - "bap_uri": "https://bap.energy-consumer.com", - "bpp_id": "bpp.energy-provider.com", - "bpp_uri": "https://bpp.energy-provider.com", - "ttl": "PT30S", - "domain": "energy-trade" - }, - "message": { - "order": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/core/v2/context.jsonld", - "@type": "beckn:Order", - "beckn:id": "order-energy-001", - "beckn:items": [ - { - "beckn:id": "energy-resource-solar-001", - "quantity": { - "count": 10.0, - "unit": "kWh" - } - } - ], - "beckn:offers": [ - { - "beckn:id": "offer-energy-001" - } - ], - "beckn:provider": { - "beckn:id": "provider-solar-farm-001" - }, - "beckn:fulfillments": [ - { - "@type": "beckn:Fulfillment", - "beckn:id": "fulfillment-energy-001", - "beckn:type": "ENERGY_DELIVERY", - "beckn:state": { - "@type": "beckn:State", - "beckn:descriptor": { - "@type": "beckn:Descriptor", - "schema:name": "IN_PROGRESS" - } - }, - "beckn:attributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeDelivery/v0.2/context.jsonld", - "@type": "EnergyTradeDelivery", - "deliveryStatus": "IN_PROGRESS", - "deliveryMode": "GRID_INJECTION", - "deliveredQuantity": 9.8, - "deliveryStartTime": "2024-10-04T10:00:00Z", - "deliveryEndTime": null, - "meterReadings": [ - { - "timestamp": "2024-10-04T10:00:00Z", - "sourceReading": 1000.0, - "targetReading": 990.0, - "energyFlow": 10.0 - }, - { - "timestamp": "2024-10-04T12:00:00Z", - "sourceReading": 1000.5, - "targetReading": 990.3, - "energyFlow": 10.2 - }, - { - "timestamp": "2024-10-04T14:00:00Z", - "sourceReading": 1001.0, - "targetReading": 990.8, - "energyFlow": 10.2 - } - ], - "telemetry": [ - { - "eventTime": "2024-10-04T12:00:00Z", - "metrics": [ - { - "name": "ENERGY", - "value": 5.8, - "unitCode": "KWH" - }, - { - "name": "POWER", - "value": 2.5, - "unitCode": "KW" - }, - { - "name": "VOLTAGE", - "value": 240.0, - "unitCode": "VLT" - } - ] - } - ], - "settlementCycleId": "settle-2024-10-04-001", - "lastUpdated": "2024-10-04T15:30:00Z" - } - } - ], - "beckn:payments": [ - { - "@type": "beckn:Payment", - "beckn:id": "payment-energy-001", - "beckn:type": "ON-FULFILLMENT", - "beckn:status": "NOT-PAID", - "beckn:collected_by": "BPP" - } - ], - "beckn:orderAttributes": { - "@context": "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/draft/schema/EnergyTradeContract/v0.2/context.jsonld", - "@type": "EnergyTradeContract", - "contractStatus": "ACTIVE", - "sourceMeterId": "100200300", - "targetMeterId": "98765456", - "inverterId": "inv-12345", - "contractedQuantity": 10.0, - "tradeStartTime": "2024-10-04T10:00:00Z", - "tradeEndTime": "2024-10-04T18:00:00Z", - "sourceType": "SOLAR", - "certification": { - "status": "Carbon Offset Certified", - "certificates": [ - "https://example.com/certs/solar-panel-cert.pdf" - ] - }, - "settlementCycles": [ - { - "cycleId": "settle-2024-10-04-001", - "startTime": "2024-10-04T00:00:00Z", - "endTime": "2024-10-04T23:59:59Z", - "status": "PENDING", - "amount": 0.0, - "currency": "USD" - } - ], - "lastUpdated": "2024-10-04T15:30:00Z" - } - } - } -} - diff --git a/scripts/generate_postman_collection.py b/scripts/generate_postman_collection.py index 1f37c39c..61992568 100755 --- a/scripts/generate_postman_collection.py +++ b/scripts/generate_postman_collection.py @@ -99,22 +99,47 @@ "bap_adapter_url": "http://localhost:8081/bap/caller", "bpp_adapter_url": "http://localhost:8082/bpp/caller", "examples_path": "examples/p2p-trading/v2", - # "output_path": "testnet/p2p-energy-trading-devkit/postman", + # "output_path": "testnet/p2p-trading-devkit/postman", "structure": "flat" # Flat file structure + }, + "p2p-enrollment": { + "domain": "beckn.one:deg:p2p-enrollment:2.0.0", + "bap_id": "p2p-enrollment-sandbox1.com", + "bap_uri": "http://onix-bap:8081/bap/receiver", + "bpp_id": "p2p-enrollment-sandbox2.com", + "bpp_uri": "http://onix-bpp:8082/bpp/receiver", + "bap_adapter_url": "http://localhost:8081/bap/caller", + "bpp_adapter_url": "http://localhost:8082/bpp/caller", + "examples_path": "examples/enrollment/v2", + # "output_path": "testnet/p2p-enrollment-devkit/postman", + "structure": "flat" # Flat file structure (like p2p-trading) + }, + "p2p-trading-interdiscom": { + "domain": "beckn.one:deg:p2p-trading-interdiscom:2.0.0", + "bap_id": "p2p-trading-sandbox1.com", + "bap_uri": "http://onix-bap:8081/bap/receiver", + "bpp_id": "p2p-trading-sandbox2.com", + "bpp_uri": "http://onix-bpp:8082/bpp/receiver", + "bap_adapter_url": "http://localhost:8081/bap/caller", + "bpp_adapter_url": "http://localhost:8082/bpp/caller", + "examples_path": "examples/p2p-trading-interdiscom/v2", + # "output_path": "testnet/p2p-trading-interdiscom-devkit/postman", + "structure": "flat" # Flat file structure (like p2p-trading) } } # Role-based file name filters (regex patterns) ROLE_FILTERS = { "BAP": [ - r".*-request\.json$", # P2P trading: *-request.json + r".*-request.*\.json$", # P2P trading/enrollment: *-request*.json (includes suffixes like -otp, -oauth2) r"^\d+_(discover|select|init|confirm|status|update|track|rating|support|cancel)\.json$", # EV charging: numbered folders r"^(discover|select|init|confirm|status|update|track|rating|support|cancel).*\.json$" # General pattern ], "BPP": [ - r".*-response\.json$", # P2P trading: *-response.json + r"^(?!cascaded-).*-response.*\.json$", # P2P trading/enrollment: *-response*.json (excludes cascaded-) r"^\d+_on_(discover|select|init|confirm|update|track|status|rating|support|cancel).*\.json$", # EV charging: on_* folders - r"^on_(discover|select|init|confirm|update|track|status|rating|support|cancel).*\.json$" # General pattern + r"^on[-_](discover|select|init|confirm|update|track|status|rating|support|cancel).*\.json$", # General pattern (on- or on_) + r"^publish-.*\.json$" # BPP-initiated publish action to CDS ], "UtilityBPP": [ r"^cascaded-.*\.json$" # Cascaded requests/responses @@ -135,6 +160,11 @@ "cancel": "cancel", } +# BPP-initiated actions (not callbacks, but BPP initiating requests to CDS, etc.) +BPP_INITIATED_ACTIONS = { + "publish": "publish", +} + # BPP response actions BPP_ACTIONS = { "on_discover": "on_discover", @@ -185,47 +215,63 @@ def extract_action_from_filename(filename: str, role: str) -> Optional[str]: "discover-request.json" (BAP) -> "discover" "discover-response.json" (BPP) -> "on_discover" "cascaded-init-request.json" (UtilityBPP) -> "init" + "init-request-otp.json" (BAP) -> "init" + "on-init-response-oauth2.json" (BPP) -> "on_init" """ # Remove .json extension name = filename.replace('.json', '') - # Handle P2P trading flat structure - strict role-based matching + # Handle P2P trading/enrollment flat structure - strict role-based matching if role == "BAP": - # BAP only matches *-request.json (not *-response.json) - if name.endswith('-request'): - action = name.replace('-request', '') - if action in BAP_ACTIONS: - return action - # Also handle cascaded requests for BAP (though typically UtilityBPP) - if name.startswith('cascaded-') and name.endswith('-request'): - action = name.replace('cascaded-', '').replace('-request', '') - if action in BAP_ACTIONS: - return action + # BAP only matches *-request*.json (not *-response*.json) + # Pattern: action-request or action-request-suffix + if '-request' in name and '-response' not in name: + # Extract action from before -request + match = re.match(r'^(cascaded-)?([a-z]+)-request', name, re.IGNORECASE) + if match: + is_cascaded = match.group(1) is not None + action = match.group(2) + if action in BAP_ACTIONS: + return action elif role == "BPP": - # BPP only matches *-response.json (not *-request.json) - if name.endswith('-response'): - # For responses, the action in filename is the request action - # We need to convert to BPP action (e.g., "discover" -> "on_discover") - request_action = name.replace('-response', '') - # Check if it's a direct BPP action - if request_action in BPP_ACTIONS: - return request_action - # Convert request action to response action - if request_action in BAP_ACTIONS: - return f"on_{request_action}" - # Handle cascaded responses - if name.startswith('cascaded-') and name.endswith('-response'): - request_action = name.replace('cascaded-', '').replace('-response', '') - if request_action in BAP_ACTIONS: - return f"on_{request_action}" + # BPP matches *-response*.json (not *-request*.json) AND publish-*.json + # Patterns: action-response, on-action-response, action-response-suffix, publish-* + + # First check for BPP-initiated actions (like publish-catalog.json) + if name.startswith('publish-'): + match = re.match(r'^(publish)-', name, re.IGNORECASE) + if match: + action = match.group(1).lower() + if action in BPP_INITIATED_ACTIONS: + return action + + if '-response' in name and '-request' not in name: + # First try: on-action-response pattern (e.g., on-init-response-oauth2) + match = re.match(r'^(cascaded-)?(on[-_])?([a-z]+)-response', name, re.IGNORECASE) + if match: + is_cascaded = match.group(1) is not None + has_on_prefix = match.group(2) is not None + action = match.group(3) + + if has_on_prefix: + # Already has on_ prefix (e.g., on-init-response -> on_init) + bpp_action = f"on_{action}" + if bpp_action in BPP_ACTIONS: + return bpp_action + else: + # No on_ prefix, convert to BPP action (e.g., discover-response -> on_discover) + if action in BAP_ACTIONS: + return f"on_{action}" elif role == "UtilityBPP": - # UtilityBPP matches cascaded-*-request.json - if name.startswith('cascaded-') and name.endswith('-request'): - action = name.replace('cascaded-', '').replace('-request', '') - if action in BAP_ACTIONS: - return action + # UtilityBPP matches cascaded-*-request*.json + if name.startswith('cascaded-') and '-request' in name: + match = re.match(r'^cascaded-([a-z]+)-request', name, re.IGNORECASE) + if match: + action = match.group(1) + if action in BAP_ACTIONS: + return action return None @@ -527,7 +573,8 @@ def generate_collection( action_mapping = BAP_ACTIONS adapter_url_var = "bap_adapter_url" elif role == "BPP": - action_mapping = BPP_ACTIONS + # BPP uses both callback actions and BPP-initiated actions (like publish to CDS) + action_mapping = {**BPP_ACTIONS, **BPP_INITIATED_ACTIONS} adapter_url_var = "bpp_adapter_url" elif role == "UtilityBPP": action_mapping = BAP_ACTIONS # UtilityBPP uses BAP actions @@ -587,16 +634,14 @@ def generate_collection( ) action_items.append(request) - # Create folder even if empty (for actions with no examples yet, like status) - folder = { - "name": action, - "item": action_items - } - collection_items.append(folder) + # Only create folder if it has requests if action_items: + folder = { + "name": action, + "item": action_items + } + collection_items.append(folder) print(f" Created folder '{action}' with {len(action_items)} request(s)") - else: - print(f" Created empty folder '{action}' (no examples found)") # Build collection collection = { @@ -639,9 +684,9 @@ def main(): parser.add_argument( "--devkit", type=str, - choices=["ev-charging", "p2p-trading"], + choices=["ev-charging", "p2p-trading", "p2p-enrollment", "p2p-trading-interdiscom"], required=True, - help="Devkit type: 'ev-charging' or 'p2p-trading'" + help="Devkit type: 'ev-charging', 'p2p-trading', 'p2p-enrollment', or 'p2p-trading-interdiscom'" ) parser.add_argument( "--role", diff --git a/scripts/validate_schema.py b/scripts/validate_schema.py index 7c990254..8f8ab96a 100644 --- a/scripts/validate_schema.py +++ b/scripts/validate_schema.py @@ -244,24 +244,81 @@ def load_schema_for_context_url(context_url, attribute_schemas_map, registry_lis return None -def _validate_attribute_object(data, schema_def, schema_type, schema_name, path, errors, registry_list): +def _validate_attribute_object(data, schema_def, schema_type, schema_name, path, errors, registry_list, schema_url=None): """ Validate a domain-specific attribute object against its schema. - Modifies the schema to allow @context and @type properties even when - additionalProperties is False, as these are required for JSON-LD. + Uses $ref to full document to allow nested $ref resolution, then handles + @context and @type properties which are required for JSON-LD. Args: data: Object data to validate - schema_def: Schema definition from attributes.yaml + schema_def: Schema definition from attributes.yaml (used as fallback) schema_type: Type name for logging (e.g., "ChargingOffer") schema_name: Schema name for logging (e.g., "EvChargingOffer") path: JSON path for error reporting errors: List to append validation errors to registry_list: Registry list for reference resolution + schema_url: Full URL to the attributes.yaml file (for $ref resolution) """ print(f" Validating {schema_type} (from {schema_name}) at {path or 'root'}...") + # Try using $ref to full document first (allows nested $ref resolution) + if schema_url: + try: + # Get the full document resource from registry + full_doc_resource = registry_list[0].get(schema_url) + if full_doc_resource: + full_doc = full_doc_resource.contents + # Extract the schema from the full document + if "components" in full_doc and "schemas" in full_doc["components"]: + target_schema = full_doc["components"]["schemas"].get(schema_type) + if target_schema: + # Recursively convert relative $ref to absolute $ref + # Also need to handle nested schemas referenced within this schema + def convert_relative_refs(obj, base_url, full_doc_schemas=None): + """Recursively convert relative $ref to absolute $ref""" + if isinstance(obj, dict): + result = {} + for k, v in obj.items(): + if k == "$ref" and isinstance(v, str) and v.startswith("#"): + # Convert relative ref to absolute + result[k] = f"{base_url}{v}" + elif k == "allOf" and isinstance(v, list): + # Handle allOf with $ref - convert $ref in allOf items + result[k] = [convert_relative_refs(item, base_url, full_doc_schemas) for item in v] + else: + result[k] = convert_relative_refs(v, base_url, full_doc_schemas) + return result + elif isinstance(obj, list): + return [convert_relative_refs(item, base_url, full_doc_schemas) for item in obj] + return obj + + # Get schema and convert relative $ref to absolute $ref + resolved_schema = copy.deepcopy(target_schema) + resolved_schema = convert_relative_refs(resolved_schema, schema_url) + + # Modify to allow @context and @type (required for JSON-LD) + if resolved_schema.get("additionalProperties") is False: + if "properties" not in resolved_schema: + resolved_schema["properties"] = {} + resolved_schema["properties"]["@context"] = {"type": "string"} + resolved_schema["properties"]["@type"] = {"type": "string"} + + # Validate against the resolved and modified schema + validate(instance=data, schema=resolved_schema, registry=registry_list[0]) + print(f" {schema_type} at {path or 'root'} is VALID.") + return + except ValidationError as e: + print(f" {schema_type} at {path or 'root'} is INVALID: {e.message}") + print(f" Path: {e.json_path}") + errors.append(f"{path} ({schema_type}): {e.message}") + return + except Exception as e: + # Fallback to direct validation if $ref resolution fails + pass + + # Fallback: direct validation with schema fragment (may fail on nested $ref) validation_schema = copy.deepcopy(schema_def) if validation_schema.get("additionalProperties") is False: if "properties" not in validation_schema: @@ -378,12 +435,12 @@ def find_and_validate_objects(data, path=""): # Try exact match first if schema_type in schemas: - _validate_attribute_object(data, schemas[schema_type], schema_type, schema_name, path, errors, registry_list) + _validate_attribute_object(data, schemas[schema_type], schema_type, schema_name, path, errors, registry_list, schema_url) else: # Try case-insensitive match for schema_key, schema_def in schemas.items(): if schema_key.lower() == schema_type.lower(): - _validate_attribute_object(data, schema_def, schema_key, schema_name, path, errors, registry_list) + _validate_attribute_object(data, schema_def, schema_key, schema_name, path, errors, registry_list, schema_url) break # Recursively check children diff --git a/specification/energy-credentials/examples/consumption-profile-vc.json b/specification/energy-credentials/examples/consumption-profile-vc.json new file mode 100644 index 00000000..34c6c0c2 --- /dev/null +++ b/specification/energy-credentials/examples/consumption-profile-vc.json @@ -0,0 +1,25 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org/", + "https://nfh-trust-labs.github.io/vc-schemas/energy-credentials/consumption-profile-vc/context.jsonld" + ], + "id": "urn:uuid:b2c3d4e5-6789-01ab-cdef-234567890123", + "type": ["VerifiableCredential", "ConsumptionProfileCredential"], + "issuer": { + "id": "did:web:bescom.karnataka.gov.in", + "name": "BESCOM - Bangalore Electricity Supply Company", + "licenseNumber": "KERC/DL/BESCOM/2024" + }, + "issuanceDate": "2025-01-15T10:30:00Z", + "credentialSubject": { + "id": "did:example:consumer:priya123", + "consumerNumber": "BESCOM-2025-MR4-567890", + "fullName": "Priya Sharma", + "premisesType": "Residential", + "connectionType": "Single-phase", + "sanctionedLoadKW": 5, + "tariffCategoryCode": "LT-2a", + "meterNumber": "BESCOM-SM-2025-789456" + } + } diff --git a/specification/energy-credentials/examples/generation-profile-vc.json b/specification/energy-credentials/examples/generation-profile-vc.json new file mode 100644 index 00000000..a84e1ff1 --- /dev/null +++ b/specification/energy-credentials/examples/generation-profile-vc.json @@ -0,0 +1,28 @@ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org/", + "https://nfh-trust-labs.github.io/vc-schemas/energy-credentials/generation-profile-vc/context.jsonld" + ], + "id": "urn:uuid:c3d4e5f6-7890-12ab-cdef-345678901234", + "type": ["VerifiableCredential", "GenerationProfileCredential"], + "issuer": { + "id": "did:web:bescom.karnataka.gov.in", + "name": "BESCOM - Bangalore Electricity Supply Company", + "licenseNumber": "KERC/DL/BESCOM/2024" + }, + "issuanceDate": "2025-01-15T10:30:00Z", + "credentialSubject": { + "id": "did:example:consumer:priya123", + "consumerNumber": "BESCOM-2025-MR4-567890", + "fullName": "Priya Sharma", + "meterNumber": "BESCOM-SM-2025-789456", + "assetId": "SRTPV-KA-BLR-2025-001234", + "generationType": "Solar", + "capacityKW": 3, + "commissioningDate": "2025-01-10", + "manufacturer": "Tata Power Solar", + "modelNumber": "TP300-Series" + } + } + diff --git a/specification/energy-credentials/examples/program-enrollment-vc.json b/specification/energy-credentials/examples/program-enrollment-vc.json new file mode 100644 index 00000000..d9608304 --- /dev/null +++ b/specification/energy-credentials/examples/program-enrollment-vc.json @@ -0,0 +1,23 @@ + { + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org/", + "https://nfh-trust-labs.github.io/vc-schemas/energy-credentials/program-enrollment-vc/context.jsonld" + ], + "id": "urn:uuid:7f8e9d0c-5678-1234-abcd-123456789abc", + "type": ["VerifiableCredential", "UtilityProgramEnrollmentCredential"], + "issuer": { + "id": "did:web:bescom.karnataka.gov.in", + "name": "BESCOM - Bangalore Electricity Supply Company", + "licenseNumber": "KERC/DL/BESCOM/2024" + }, + "issuanceDate": "2025-01-15T11:00:00Z", + "credentialSubject": { + "id": "did:example:consumer:priya123", + "consumerNumber": "BESCOM-2025-MR4-567890", + "fullName": "Priya Sharma", + "programName": "BESCOM Surya Raitha - Rooftop Solar Net Metering", + "programCode": "SRTPV-NM-2025", + "enrollmentDate": "2025-01-15" + } + } diff --git a/specification/energy-credentials/examples/storage-profile-vc.json b/specification/energy-credentials/examples/storage-profile-vc.json new file mode 100644 index 00000000..3e54592e --- /dev/null +++ b/specification/energy-credentials/examples/storage-profile-vc.json @@ -0,0 +1,26 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org/", + "https://nfh-trust-labs.github.io/vc-schemas/energy-credentials/storage-profile-vc/context.jsonld" + ], + "id": "urn:uuid:d4e5f6a7-8901-23ab-cdef-456789012345", + "type": ["VerifiableCredential", "StorageProfileCredential"], + "issuer": { + "id": "did:web:bescom.karnataka.gov.in", + "name": "BESCOM - Bangalore Electricity Supply Company", + "licenseNumber": "KERC/DL/BESCOM/2024" + }, + "issuanceDate": "2025-01-15T10:30:00Z", + "credentialSubject": { + "id": "did:example:consumer:priya123", + "consumerNumber": "BESCOM-2025-MR4-567890", + "fullName": "Priya Sharma", + "meterNumber": "BESCOM-SM-2025-789456", + "assetId": "BESS-KA-BLR-2025-000456", + "storageCapacityKWh": 10, + "powerRatingKW": 5, + "commissioningDate": "2025-01-12", + "storageType": "LithiumIon" + } + } diff --git a/specification/energy-credentials/examples/utility-customer-vc. json b/specification/energy-credentials/examples/utility-customer-vc. json new file mode 100644 index 00000000..16bd0e9f --- /dev/null +++ b/specification/energy-credentials/examples/utility-customer-vc. json @@ -0,0 +1,31 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://schema.org/", + "https://nfh-trust-labs.github.io/vc-schemas/energy-credentials/utility-customer-vc/context.jsonld" + ], + "id": "urn:uuid:a1b2c3d4-5678-90ab-cdef-123456789012", + "type": ["VerifiableCredential", "UtilityCustomerCredential"], + "issuer": { + "id": "did:web:bescom.karnataka.gov.in", + "name": "BESCOM - Bangalore Electricity Supply Company", + "licenseNumber": "KERC/DL/BESCOM/2024" + }, + "issuanceDate": "2025-01-15T10:30:00Z", + "credentialSubject": { + "id": "did:example:consumer:priya123", + "consumerNumber": "BESCOM-2025-MR4-567890", + "maskedIdNumber": "XXXX-XXXX-4523", + "fullName": "Priya Sharma", + "installationAddress": { + "fullAddress": "42, 3rd Cross, Indiranagar", + "city": "Bengaluru", + "district": "Bengaluru Urban", + "stateProvince": "Karnataka", + "postalCode": "560038", + "country": "IN" + }, + "meterNumber": "BESCOM-SM-2025-789456", + "serviceConnectionDate": "2020-03-15" + } + }