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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions commerce-api/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

The files in this directory are used as templates for the ant create-component target, +
please do not modify them without understanding the effect that it will have on that build target.
45 changes: 45 additions & 0 deletions commerce-api/api/commerce-api.rest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<api name="Commerce REST API" path="orders" displayName="Commerce API" description="Commerce REST API endpoints"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/rest-api.xsd">

<resource name="orders" path="/" displayName="Orders Resource" description="Create Order">
<operation verb="post" consumes="application/json" produces="application/json" description="Create a new Order">
<service name="commerceCreateOrder"/>
</operation>
</resource>

<resource name="order" path="{orderId}" displayName="Order Resource" description="Get Order details by ID">
<operation verb="get" produces="application/json" description="Get Order details by ID">
<service name="commerceGetOrder"/>
</operation>
<operation verb="put" consumes="application/json" produces="application/json" description="Update Order details by ID">
<service name="commerceUpdateOrder"/>
</operation>
</resource>

<resource name="orderStatus" path="{orderId}/status" displayName="Order Status Resource" description="Get Order status details by ID">
<operation verb="get" produces="application/json" description="Get Order status details by ID">
<service name="commerceGetOrderStatus"/>
</operation>
</resource>
</api>
37 changes: 37 additions & 0 deletions commerce-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

dependencies {
//Examples of compile-time and runtime dependencies

//pluginLibsCompile 'junit:junit-dep:4.10'
//pluginLibsRuntime 'junit:junit-dep:4.10'
}

task install {
doLast {
// Install logic for this plugin
}
}

task uninstall {
doLast {
// uninstall logic for this plugin
}
}
29 changes: 29 additions & 0 deletions commerce-api/data/Commerce-apiSecurityGroupDemoData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<entity-engine-xml>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="FULLADMIN" permissionId="COMMERCE-API_ADMIN"/>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="FLEXADMIN" permissionId="COMMERCE-API_CREATE"/>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="FLEXADMIN" permissionId="COMMERCE-API_DELETE"/>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="FLEXADMIN" permissionId="COMMERCE-API_UPDATE"/>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="FLEXADMIN" permissionId="COMMERCE-API_VIEW"/>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="VIEWADMIN" permissionId="COMMERCE-API_VIEW"/>
<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="BIZADMIN" permissionId="COMMERCE-API_ADMIN"/>
</entity-engine-xml>
30 changes: 30 additions & 0 deletions commerce-api/data/Commerce-apiSecurityPermissionSeedData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<entity-engine-xml>
<SecurityPermission description="View operations in the Commerce-api Component." permissionId="COMMERCE-API_VIEW"/>
<SecurityPermission description="Create operations in the Commerce-api Component." permissionId="COMMERCE-API_CREATE"/>
<SecurityPermission description="Update operations in the Commerce-api Component." permissionId="COMMERCE-API_UPDATE"/>
<SecurityPermission description="Delete operations in the Commerce-api Component." permissionId="COMMERCE-API_DELETE"/>
<SecurityPermission description="ALL operations in the Commerce-api Component." permissionId="COMMERCE-API_ADMIN"/>

<SecurityGroupPermission fromDate="2001-05-13 12:00:00.0" groupId="SUPER" permissionId="COMMERCE-API_ADMIN"/>

</entity-engine-xml>
39 changes: 39 additions & 0 deletions commerce-api/ofbiz-component.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<ofbiz-component name="commerce-api"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<!-- define resource loaders; most common is to use the component resource loader -->
<resource-loader name="main" type="component"/>

<!-- entity resources: model(s), eca(s), group, and data definitions -->
<entity-resource type="data" reader-name="seed" loader="main" location="data/Commerce-apiSecurityPermissionSeedData.xml"/>
<entity-resource type="data" reader-name="demo" loader="main" location="data/Commerce-apiSecurityGroupDemoData.xml"/>

<!-- service resources: model(s), eca(s) and group definitions -->
<service-resource type="model" loader="main" location="servicedef/services.xml"/>
<!--
<service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
<service-resource type="group" loader="main" location="servicedef/groups.xml"/>
-->

Check warning on line 36 in commerce-api/ofbiz-component.xml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=apache_ofbiz-plugins&issues=AZ9vXgopRRZ4eY3ujF39&open=AZ9vXgopRRZ4eY3ujF39&pullRequest=332

<test-suite loader="main" location="testdef/Commerce-apiTests.xml"/>
</ofbiz-component>
100 changes: 100 additions & 0 deletions commerce-api/servicedef/services.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/services.xsd">
<description>Commerce-api Services</description>
<vendor></vendor>
<version>1.0</version>

<service name="commerceCreateOrder" engine="groovy"
location="component://commerce-api/src/main/groovy/org/apache/ofbiz/commerce/OrderServices.groovy" invoke="commerceCreateOrder" auth="true">
<description>Create Order for REST API</description>
<attribute name="externalId" mode="IN" type="String" optional="true"/>
<attribute name="orderName" mode="IN" type="String" optional="true"/>
<attribute name="orderTypeId" mode="IN" type="String" optional="true" default-value="SALES_ORDER"/>
<attribute name="salesChannelEnumId" mode="IN" type="String" optional="true" default-value="WEB_SALES_CHANNEL"/>
<attribute name="orderDate" mode="IN" type="String" optional="true"/>
<attribute name="entryDate" mode="IN" type="String" optional="true"/>
<attribute name="priority" mode="IN" type="String" optional="true"/>
<attribute name="currencyCode" mode="IN" type="String" optional="true" default-value="USD"/>
<attribute name="status" mode="IN" type="String" optional="true" default-value="ORDER_CREATED"/>
<attribute name="customer" mode="IN" type="Map" optional="false"/>
<attribute name="billingAddress" mode="IN" type="Map" optional="true"/>
<attribute name="shippingAddress" mode="IN" type="Map" optional="true"/>
<attribute name="items" mode="IN" type="List" optional="false"/>
<attribute name="adjustments" mode="IN" type="List" optional="true"/>
<attribute name="paymentPreferences" mode="IN" type="List" optional="true"/>
<attribute name="agreements" mode="IN" type="List" optional="true"/>
<attribute name="attributes" mode="IN" type="List" optional="true"/>
<attribute name="note" mode="IN" type="List" optional="true"/>

<attribute name="orderId" mode="OUT" type="String" optional="false"/>
</service>

<service name="commerceGetOrder" engine="groovy"
location="component://commerce-api/src/main/groovy/org/apache/ofbiz/commerce/OrderServices.groovy" invoke="commerceGetOrder" auth="true">
<description>Get Order details for REST API</description>
<attribute name="orderId" mode="IN" type="String" optional="false"/>
<attribute name="orderId" mode="OUT" type="String" optional="false"/>
<attribute name="externalId" mode="OUT" type="String" optional="true"/>
<attribute name="orderName" mode="OUT" type="String" optional="true"/>
<attribute name="orderTypeId" mode="OUT" type="String" optional="true"/>
<attribute name="salesChannelEnumId" mode="OUT" type="String" optional="true"/>
<attribute name="orderDate" mode="OUT" type="String" optional="true"/>
<attribute name="entryDate" mode="OUT" type="String" optional="true"/>
<attribute name="priority" mode="OUT" type="String" optional="true"/>
<attribute name="currencyCode" mode="OUT" type="String" optional="true"/>
<attribute name="status" mode="OUT" type="String" optional="true"/>
<attribute name="customer" mode="OUT" type="Map" optional="true"/>
<attribute name="billingAddress" mode="OUT" type="Map" optional="true"/>
<attribute name="shippingAddress" mode="OUT" type="Map" optional="true"/>
<attribute name="items" mode="OUT" type="List" optional="true"/>
<attribute name="adjustments" mode="OUT" type="List" optional="true"/>
<attribute name="paymentPreferences" mode="OUT" type="List" optional="true"/>
<attribute name="agreements" mode="OUT" type="List" optional="true"/>
<attribute name="attributes" mode="OUT" type="List" optional="true"/>
<attribute name="note" mode="OUT" type="List" optional="true"/>
</service>

<service name="commerceUpdateOrder" engine="groovy"
location="component://commerce-api/src/main/groovy/org/apache/ofbiz/commerce/OrderServices.groovy" invoke="commerceUpdateOrder" auth="true">
<description>Update Order details for REST API</description>
<attribute name="orderId" mode="IN" type="String" optional="false"/>
<attribute name="priority" mode="IN" type="String" optional="true"/>
<attribute name="shippingAddress" mode="IN" type="Map" optional="true"/>
<attribute name="items" mode="IN" type="List" optional="true"/>
<attribute name="attributes" mode="IN" type="List" optional="true"/>
<attribute name="note" mode="IN" type="String" optional="true"/>
<attribute name="orderId" mode="OUT" type="String" optional="false"/>
<attribute name="externalId" mode="OUT" type="String" optional="true"/>
<attribute name="status" mode="OUT" type="String" optional="true"/>
<attribute name="message" mode="OUT" type="String" optional="true"/>
</service>

<service name="commerceGetOrderStatus" engine="groovy"
location="component://commerce-api/src/main/groovy/org/apache/ofbiz/commerce/OrderServices.groovy" invoke="commerceGetOrderStatus" auth="true">
<description>Get Order Status for REST API</description>
<attribute name="orderId" mode="IN" type="String" optional="false"/>
<attribute name="orderId" mode="OUT" type="String" optional="false"/>
<attribute name="statusId" mode="OUT" type="String" optional="false"/>
<attribute name="statusHistory" mode="OUT" type="List" optional="false"/>
</service>
</services>
Loading