# eShop Example



# Overview

## Using Atollon to bill/invoice eShop purchases

How to use Atollon to quickly send invoices to eShop clients? See the illustration below describing the scheme necessary to adopt when billing from Atollon.

[![eShopIntegration.png](https://help.atollon.com/uploads/images/gallery/2020-05/scaled-1680-/eShopIntegration.png)](https://help.atollon.com/uploads/images/gallery/2020-05/eShopIntegration.png)

### Used Functions

Functions to create objects:  
(there may be some other functions necessary, if listing is required)

- CreateContact (main.wsdl) 
    - Use for both company &amp; person

- CreateSimpleFolder (project.wsdl) 
    - For both company &amp; person clients

- CreateProject (project.wsdl)
- CreateProjectItem (item.wsdl)

# Create New Customer (Person)

### First create new contact

#### CreateContact (main.wsdl) Request

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CreateContact>
         <server>acme</server>
         <session>6A941A9BC9EBEFAF585A4B936AA958755B1C85E2BD04</session>
     <PERSON>
        <name1>Jack</name1>
        <name3>Buyer</name3>
        <ADDRESSES>
          <ADDRESS>
            <cityName>London</cityName>
            <countryName>United Kingdom</countryName>
            <isPrimary>1</isPrimary>
            <regionName>London</regionName>
            <street>Our Street 10</street>
            <type>132027101</type>
            <zipName>1100</zipName>
          </ADDRESS>
        </ADDRESSES>
        <CONTACTS>
          <CONTACT>
            <content>jackbuyer@gmail.com</content>
            <isMain>1</isMain>
            <isPrimary>1</isPrimary>
            <type>132031101</type>
          </CONTACT>
          <CONTACT>
            <content>33999888</content>
            <isMain>0</isMain>
            <isPrimary>1</isPrimary>
            <type>132035101</type>
          </CONTACT>
          <CONTACT>
            <content>990888333</content>
            <isMain>0</isMain>
            <isPrimary>1</isPrimary>
            <type>132033101</type>
            <typeType>3</typeType>
          </CONTACT>
        </CONTACTS>
        <PERSONINFO>
          <salutation>Dear Adam</salutation>
          <preferedLang>131428101</preferedLang>
        </PERSONINFO>
      </PERSON>
      </wsdl:CreateContact>
   </soapenv:Body>
</soapenv:Envelope>
```

#### CreateContact Response

```XML
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://atollon.com/enterprise/wsdl">
   <ns0:Body>
      <ns1:CreateContactResponse>
         <result>OK</result>
         <time>0.08316803</time>
         <newId>139663101</newId>
      </ns1:CreateContactResponse>
   </ns0:Body>
</ns0:Envelope>
```

### Create New Customer Folder

#### CreateSimpleFolder (project.wsdl) Request

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CreateSimpleFolder>
         <server>acme</server>
         <session>6A941A9BC9EBEFAF585A4B936AA958755B1C85E2BD04</session>
      <FOLDER>
        <name>Buyer, Jack</name>
        <organization>130944101</organization>
        <template>139633101</template>
        <contact>139663101</contact>
        <parent>130944101</parent>
      </FOLDER>
      </wsdl:CreateSimpleFolder>
   </soapenv:Body>
</soapenv:Envelope>
```

#### CreateSimpleFolder Response

```XML
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://atollon.com/enterprise/wsdl">
   <ns0:Body>
      <ns1:CreateSimpleFolderResponse>
         <result>OK</result>
         <time>0.28198600</time>
         <newId>139676101</newId>
         <TYPE>
            <name>Client</name>
            <guiAction/>
            <id>132716101</id>
            <iType>1</iType>
            <masterProject>0</masterProject>
         </TYPE>
      </ns1:CreateSimpleFolderResponse>
   </ns0:Body>
</ns0:Envelope>
```

# Create New Deal

### First Create Project Folder

#### CreateProject (project.wsdl) Request

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CreateProject>
        <server>acme</server>
        <session>6A941A9BC9EBEFAF585A4B936AA958755B1C85E2BD04</session>
        <PROJECT>
          <customer>139676101</customer>
          <folder>139676101</folder>
          <invoiceJournal>133150101</invoiceJournal>
          <name>Super Sales</name>
          <projectTemplate>133297101</projectTemplate>
          <provider>132740101</provider>
        </PROJECT>
      </wsdl:CreateProject>
   </soapenv:Body>
</soapenv:Envelope>
```

#### CreateProject Response

```XML
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://atollon.com/enterprise/wsdl">
   <ns0:Body>
      <ns1:CreateProjectResponse>
         <result>OK</result>
         <time>0.24983001</time>
         <newId>139704101</newId>
         <TYPE>
            <id>133295101</id>
            <name>Deal</name>
            <masterProject>0</masterProject>
            <guiAction/>
            <iType>2</iType>
         </TYPE>
      </ns1:CreateProjectResponse>
   </ns0:Body>
</ns0:Envelope>
```

### Second Create Billing Item

#### CreateProjectItem (item.wsdl) Request

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CreateProjectItem>
         <server>acme</server>
         <session>6A941A9BC9EBEFAF585A4B936AA958755B1C85E2BD04</session>     
         <ITEM>
           <amount>1234</amount>
           <billingDate>2020-05-14T00:00:00</billingDate>
           <billingStatus>3</billingStatus>
           <totalQuantity>5</totalQuantity>
           <catalogPrice>190</catalogPrice>
           <currency>CZK</currency>
           <item>133629101</item>
           <name>AAA Batteries</name>
           <project>139704101</project>
           <purchasePrice>130</purchasePrice>
           <quantity>5</quantity>
           <totalAmount>6170</totalAmount>
           <totalAmountWithVat>6787</totalAmountWithVat>
           <vatValue>10</vatValue>
           <ratio>100</ratio>
      </ITEM>
      </wsdl:CreateProjectItem>
   </soapenv:Body>
</soapenv:Envelope>
```

#### CreateProjectItem Response

```XML
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://atollon.com/enterprise/wsdl">
   <ns0:Body>
      <ns1:CreateProjectItemResponse>
         <result>OK</result>
         <time>0.01379299</time>
         <count>0</count>
         <itemId>139721101</itemId>
      </ns1:CreateProjectItemResponse>
   </ns0:Body>
</ns0:Envelope>
```

# Create New Invoice

### Create Invoice from Billing Items in For approval Status

#### CreateInvoicesFromItems (invoice.wsdl) Request

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CreateInvoicesFromItems>
         <server>acme</server>
         <session>6A941A9BC9EBEFAF585A4B936AA958755B1C85E2BD04</session>
         <PROJECTS>
            <RECORD>
               <id>139704101</id>
            </RECORD>
         </PROJECTS>
      </wsdl:CreateInvoicesFromItems>
   </soapenv:Body>
</soapenv:Envelope>
```

#### CreateInvoicesFromItems Response

```XML
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://atollon.com/enterprise/wsdl">
   <ns0:Body>
      <ns1:CreateInvoicesFromItemsResponse>
         <result>OK</result>
         <time>0.52524996</time>
         <INVOICE>
            <id>139758101</id>
            <invoiceNumber>232010001</invoiceNumber>
         </INVOICE>
      </ns1:CreateInvoicesFromItemsResponse>
   </ns0:Body>
</ns0:Envelope>
```

# Create Recurring Billing Request

On top of created project (deal), it is possible to create recurring billing request.

See the documentation of [CreateFolderItem](https://help.atollon.com/books/atollon-api/page/createfolderitem "CreateFolderItem") function for more details.

#### Example CreateFolderItem (item.wsdl) Request

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CreateFolderItem>
         <server>acme</server>
         <session>7CDF678513DCBF0379DDD26A6961B604D7F1515CBD04</session>
         <ITEM>
            <amount>1234</amount>
            <billingDate>2020-05-14T00:00:00</billingDate>
            <billingStatus>2</billingStatus>
            <totalQuantity>5</totalQuantity>
            <catalogPrice>190</catalogPrice>
            <currency>CZK</currency>
            <item>133629101</item>
            <name>Repeated service</name>
            <note>Billing the yearly service.</note>
            <purchasePrice>130</purchasePrice>
            <quantity>5</quantity>
            <folder>139676101</folder>
            <totalAmount>6170</totalAmount>
            <totalAmountWithVat>6787</totalAmountWithVat>
            <vatValue>10</vatValue>
            <ratio>100</ratio>
            <taxationDate>2020-05-14T00:00:00</taxationDate>
            <isModelItem>1</isModelItem>
            <validFrom>2020-05-14T00:00:00</validFrom>
            <validTo>2099-05-04T00:00:00</validTo>
            <destinationProject>139704101</destinationProject>
            <billingFrequency>2</billingFrequency>
         </ITEM>
      </wsdl:CreateFolderItem>
   </soapenv:Body>
</soapenv:Envelope>
```

#### CreateFolderItem (Response)

```XML
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://atollon.com/enterprise/wsdl">
   <ns0:Body>
      <ns1:CreateFolderItemResponse>
         <result>OK</result>
         <time>0.01345706</time>
         <count>0</count>
         <itemId>139812101</itemId>
      </ns1:CreateFolderItemResponse>
   </ns0:Body>
</ns0:Envelope>
```

# Execute Workflow Actions Immediately

 In case your integration requires executing workflow actions immediately after your request, it is necessary to call **CheckWorkflowQueue** function that is part of **features.wsdl**.

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CheckWorkFlowQueue>
         <server>yourserver</server>
         <session>---yoursessionstring---</session>
      </wsdl:CheckWorkFlowQueue>
   </soapenv:Body>
</soapenv:Envelope>
```

# Create New Marketing Trigger

Marketing triggers are used to track any activity of the contact / public user, which have some meaning in your company sales or marketing process.

The example below notifies Atollon about new phone number added to contact. Atollon may therefore create call task.

#### Example Request

```XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://atollon.com/enterprise/wsdl">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:CreateMarketingTriggers>
         <server>acme</server>
         <session>61A...DBD04</session>
         <MARKETING_TRIGGER>
            <baseType>new-phone-number</baseType>
            <contextId>132716101</contextId>
            <contactId>139663101</contactId>
            <url>www.yourcompany.com/product/page</url>
            <trackingCode>www.company.com/product/page</trackingCode>
            <description>Extranet user added new phone number</description>
            <triggerDate>2020-07-31 12:00</triggerDate>
            <numberOfVisits>1</numberOfVisits>
         </MARKETING_TRIGGER>
      </wsdl:CreateMarketingTriggers>
   </soapenv:Body>
</soapenv:Envelope>
```

#### Example Response

```XML
<ns0:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://atollon.com/enterprise/wsdl">
   <ns0:Body>
      <ns1:CreateMarketingTriggersResponse>
         <result>OK</result>
         <time>0.22972488</time>
         <newId>400097101</newId>
      </ns1:CreateMarketingTriggersResponse>
   </ns0:Body>
</ns0:Envelope>
```

#### Fields Description

<table border="1" id="bkmrk-field-name-example-d" style="border-collapse: collapse; width: 100%; height: 261px;"><tbody><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">**Field name**</td><td style="width: 33.333333333333336%; height: 29px;">**Example**</td><td style="width: 33.333333333333336%; height: 29px;">**Description**</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">baseType</td><td style="width: 33.333333333333336%; height: 29px;">new-phone-number

url-visit

goal-achieved

</td><td style="width: 33.333333333333336%; height: 29px;">Text identification of the marketing trigger (what actually happened)</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">contextId</td><td style="width: 33.333333333333336%; height: 29px;">123456789000</td><td style="width: 33.333333333333336%; height: 29px;">Identification of Folder ID, Project ID or Activity ID in Atollon's context structure. It is necessary to enter context ID in case it should be displayed in context Timeline.</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">contactId</td><td style="width: 33.333333333333336%; height: 29px;">113456789000</td><td style="width: 33.333333333333336%; height: 29px;">Identification of contact, who caused the trigger</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">url</td><td style="width: 33.333333333333336%; height: 29px;">https://yourcompany.atollon.com/pub/23423432</td><td style="width: 33.333333333333336%; height: 29px;">Page that the contact visited (optional)</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">trackingCode</td><td style="width: 33.333333333333336%; height: 29px;">yourSuperCampaignXYZ</td><td style="width: 33.333333333333336%; height: 29px;">Any text string representing one particular campaign / marketing activity / message template</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">description</td><td style="width: 33.333333333333336%; height: 29px;">Contact visited URL</td><td style="width: 33.333333333333336%; height: 29px;">Any descriptive text that will be visible to Atollon users in Timeline</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">triggerDate</td><td style="width: 33.333333333333336%; height: 29px;">2020-08-12 12:00</td><td style="width: 33.333333333333336%; height: 29px;">When the trigger happened?</td></tr><tr style="height: 29px;"><td style="width: 33.333333333333336%; height: 29px;">numberOfVisits</td><td style="width: 33.333333333333336%; height: 29px;">45</td><td style="width: 33.333333333333336%; height: 29px;">In case the target user is super active (or robot), we may want to avoid spamming Atollon with unnecessary records and aggregate page visits</td></tr></tbody></table>