FIWARE-TMForum / Business-API-Ecosystem

The FIWARE/TMForum Business API Ecosystem allows the monetization of different kind of assets (both digital and physical) during the whole service life cycle, from offering creation to its charging, accounting and revenue settlement and sharing
https://business-api-ecosystem.rtfd.io/
GNU Affero General Public License v3.0
39 stars 22 forks source link

Failed to retrieve charge periods AND Failed to retrieve currency codes starting business-ecosystem-logic-proxy #35

Closed Urtza2 closed 6 years ago

Urtza2 commented 6 years ago

Hi, When I start business-ecosystem-logic-proxy appears this error.

root@CkanServer:/home/user1/Business-API-Ecosystem/business-ecosystem-logic-proxy# node server
(node:9281) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client
Subscribed to inventory hub!
2018-09-27 12:24:20.538  - INFO: Server - Business Ecosystem Logic Proxy starting on port 81
2018-09-27 12:24:20.547  - INFO: Server - URL DATA:{"path":"charging","host":"localhost","port":"8006","appSsl":false}
2018-09-27 12:24:21.674  - **ERROR: Server - Failed to retrieve currency codes**

I don't know if it is mandatory or not for BIZ Ecosystem. I can't find the urls that in server.js (function onlistening() appear. These are the following:

pathname: '/'+ urldata.path + '/api/assetManagement/chargePeriods/', pathname: '/'+ urldata.path + '/api/assetManagement/currencyCodes/',

I take a look in /home/user1/Business-API-Ecosystem/business-ecosystem-charging-backend/src/wstore/urls.py (DJANGO) and I have the followings:

urlpatterns = patterns('',
    # API
    url(r'^charging/api/assetManagement/assets/?$', offering_views.AssetCollection(permitted_methods=('GET',))),
    url(r'^charging/api/assetManagement/assets/uploadJob/?$', offering_views.UploadCollection(permitted_methods=('POST',))),
    url(r'^charging/api/assetManagement/assets/validateJob/?$', offering_views.ValidateCollection(permitted_methods=('POST',))),
    url(r'^charging/api/assetManagement/assets/offeringJob/?$', offering_views.ValidateOfferingCollection(permitted_methods=('POST',))),
    url(r'^charging/api/assetManagement/assets/(?P<asset_id>\w+)/?$', offering_views.AssetEntry(permitted_methods=('GET',))),
    url(r'^charging/api/assetManagement/assets/(?P<asset_id>\w+)/upgradeJob/?$', offering_views.UpgradeCollection(permitted_methods=('POST',))),
    url(r'^charging/api/assetManagement/assets/product/(?P<product_id>\w+)/?$', offering_views.AssetEntryFromProduct(permitted_methods=('GET',))),
    url(r'^charging/api/assetManagement/assetTypes/?$', plugins_views.PluginCollection(permitted_methods=('GET', ))),
    url(r'^charging/api/assetManagement/assetTypes/(?P<plugin_id>[\w -]+)/?$', plugins_views.PluginEntry(permitted_methods=('GET',))),

    url(r'^charging/api/orderManagement/orders/?$', ordering_views.OrderingCollection(permitted_methods=('POST',))),
    url(r'^charging/api/orderManagement/orders/accept/?$', charging_views.PayPalConfirmation(permitted_methods=('POST',))),
    url(r'^charging/api/orderManagement/orders/cancel/?$', charging_views.PayPalCancellation(permitted_methods=('POST',))),
    url(r'^charging/api/orderManagement/orders/refund/?$', charging_views.PayPalRefund(permitted_methods=('POST',))),
    url(r'^charging/api/orderManagement/products/?$', ordering_views.InventoryCollection(permitted_methods=('POST',))),
    url(r'^charging/api/orderManagement/products/renewJob/?$', ordering_views.RenovationCollection(permitted_methods=('POST',))),
    url(r'^charging/api/orderManagement/accounting/?$', accounting_views.ServiceRecordCollection(permitted_methods=('POST',))),
    url(r'^charging/api/orderManagement/accounting/refresh/?$', accounting_views.SDRRefreshCollection(permitted_methods=('POST',))),
    url(r'^charging/api/reportManagement/created/?$', reports_views.ReportReceiver(permitted_methods=('POST',)))
)

Please someone can help with this. Thanks.

jivung commented 6 years ago

I had the same problem. I fixed it when i got the charging backend to run properly.

Urtza2 commented 6 years ago

How to do you know the charging backend is runnning properly? I deploy backend in Apache and I have no errors.

Another issue, I don't know if it is related with the charging backend. I am not able to create an admin user for the BAE. Do you know how to create and assign admin role to an IDM user?

Thanks

jivung commented 6 years ago

All I know is that first I did not have any charging backend running at all. Then I installed it and ran it, of which after the "Failed to retrieve currency codes" disappeared. I installed the charging backend using Django and virtualenv.

I haven't tried assigning a admin role yet. I will let you know when I tried.

Urtza2 commented 6 years ago

At the end I have installed again all BIZ and errors dissapear. Thanks

Urtza2 commented 6 years ago

Hi again, I get the same error again. I have this configuration of logic proxy:

var config = {};`
// The PORT used by 
config.port = 81;
config.host = 'localhost';

config.proxy = {
    enabled: false,
    host: 'localhost',
    secured: false,
    port: 81
}

// Set this var to undefined if you don't want the server to listen on HTTPS
config.https = {
    enabled: false,
    certFile: 'cert/cert.crt',
    keyFile: 'cert/key.key',
    caFile: 'cert/ca.crt',
    port: 443
};

// Express configuration
config.proxyPrefix = '';
config.portalPrefix = '';
config.logInPath = '/login';
config.logOutPath = '/logOut';
config.sessionSecret = 'keyboard cat';
config.theme = '';

// OAuth2 configuration
config.oauth2 = {
    'server': 'https://localhost:8443',
    'clientID': '9b5425d4-41cc-496f-b368-054b64e5e9fd',
    'clientSecret': 'c877e186-1620-476e-89b8-263bb252ffec',
    'callbackURL': 'http://localhost:81/auth/fiware/callback',
    'isLegacy': false,
    'roles': {
        'admin': 'admin',
        'customer': 'customer',
        'seller': 'seller',
        'orgAdmin': 'orgAdmin'

    }

};

// Customer Role Required to buy items
config.customerRoleRequired = false;

// MongoDB
config.mongoDb = {
    server: 'localhost',
    port: 27017,
    user: '',
    password: '',
    db: 'belp'
};

// Configure endpoints
config.endpoints = {
    'management': {
        'path': 'management',
        'host': 'localhost',
    'port': config.port,
        'appSsl': config.https.enabled
    },
    'catalog': {
        'path': 'DSProductCatalog',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    },
    'ordering': {
        'path': 'DSProductOrdering',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    },
    'inventory': {
        'path': 'DSProductInventory',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    },
    'charging': {
        'path': 'charging',
        'host': 'localhost',
        'port': '8006',
    'appSsl': false
    },
    'rss': {
        'path': 'DSRevenueSharing',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    },
    'party': {
        'path': 'DSPartyManagement',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    },
    'billing':{
        'path': 'DSBillingManagement',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    },
    'customer': {
        'path': 'DSCustomerManagement',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    },
    'usage':  {
        'path': 'DSUsageManagement',
        'host': 'localhost',
        'port': '8085',
        'appSsl': false
    }
};

// Percentage of the generated revenues that belongs to the system
config.revenueModel = 30;

// Tax rate
config.taxRate = 20;

// Billing Account owner role
config.billingAccountOwnerRole = 'bill receiver';

// list of paths that will not check authentication/authorization
// example: ['/public/*', '/static/css/']
config.publicPaths = [];

config.magicKey = undefined;

config.usageChartURL = 'https://mashup.lab.fiware.org/fdelavega/UsageChart?mode=embedded&theme=wirecloud.fiwarelabtheme';

module.exports = config;


I try to run charging backend with two options:  using Django and deploying with apache.
And in the logic proxy appear this error.
The problem is that it is neccesary to create an Offering in BAE. I can't create an offering taking this error.

And after I can't publish anything in CKAN because it is neccesary an offering from BAE.

I have BIZ ecosystem V6.4.0 develop branch version
Please someone can help me?
What are the steps that I have to follow?, 

Thanks 
Urtza
Urtza2 commented 6 years ago

It works now. I don't know why but in setting.py file I have not included information related to charge periods and currency codes