api-create-client-membership-flectra

functions to create client from membership app to flectra

Usage no npm install needed!

<script type="module">
  import apiCreateClientMembershipFlectra from 'https://cdn.skypack.dev/api-create-client-membership-flectra';
</script>

README

api-create-client-membership-flectra

Dependencies

async-sema

odoo-xmlrpc

Installation

  1. Install the npm package
    npm i api-create-client-membership-flectra
  1. You need to install async-sema and odoo-xmlrpc
    npm i async-sema odoo-xmlrpc

Create a Flectra customer

const { CreateClient } = require('api-create-client-membership-flectra')

const config = "FLECTRA": {
        "APP_NAME": "Flectra",
        "APP_INSTANCE": "flectra",
        "DEPLOY": {
            "url": "http://localhost/",
            "port": 7073,
            "db": "flectra",
            "username": "admin",
            "password": "admin"
        },
        "CRM": {
            "SOURCE": "Membership App",
            "MEDIUM": "desconocido",
            "LEAD_TAGS": {
                "MEMBERSHIP_PENDANT": {
                    "name": "MEMBERSHIP:PENDIENTE",
                    "color": "9",
                    "FIELD": {
                        "NAME": "status",
                        "VALUE": "pender"
                    }
                },
                "MEMBERSHIP_ACTIONABLE": {
                    "name": "MEMBERSHIP:PROCESABLE",
                    "color": "9",
                    "FIELD": {
                        "NAME": "status",
                        "VALUE": "processable"
                    }
                }
            },
            "STAGE": {
                "DEFAULT_STAGE": {
                    "color": 4,
                    "stage": 1
                }
            },
            "CONTACT_TAGS": {
                "MEMBERSHIP_PENDANT": {
                    "name": "MEMBERSHIP:PENDIENTE",
                    "color": "9",
                    "FIELD": {
                        "NAME": "status",
                        "VALUE": "pender"
                    }
                },
                "MEMBERSHIP_ACTIONABLE": {
                    "name": "MEMBERSHIP:PROCESABLE",
                    "color": "9",
                    "FIELD": {
                        "NAME": "status",
                        "VALUE": "processable"
                    }
                }
            },
            "MEMBERSHIP_TAGS": {
                "MEMBERSHIP_TITULAR": {
                    "name": "MEMBERSHIP:TITULAR",
                    "color": "9"
                },
                "MEMBERSHIP_COTITULAR": {
                    "name": "MEMBERSHIP:COTITULAR",
                    "color": "9"
                },
                "MEMBERSHIP_BENEFICIARIO": {
                    "name": "MEMBERSHIP:BENEFICIARIO",
                    "color": "9"
                }
            },
            "FILTER_TAGS": {
                "CLUB": {
                    "name": "CLUB:",
                    "color": "9"
                },
                "APP": {
                    "name": "APP:",
                    "color": "9"
                }
            }
        }
    }

const Flectra = require('api-flectra').Flectra
const flectra = new Flectra(config)

const api = new CreateClient(FLECTRA, flectra)

api.membershipClientToContact(member)

Here is a member to test

{

    "_id": "k4RPbwigiGgYLcegS",
    "firstName": "Jhon",
    "lastName": "Rodriguez",
    "birthDate": "2019-11-12T00:00:00Z",
    "email": "jhonny@gmail.com",
    "phone": "+5354444924",
    "cell": "+5354444924",
    "officePhone": "+5354444924",
    "address": "26 de julio",
    "zip": "960000",
    "country": "UK",
    "state": "LD",
    "city": "London",
    "purchaseDetails": {
        "nationality": "Britich",
        "DPAmount": 10,
        "balanceToFinance": 184,
        "contractCelebrationDate": "2019-11-15T00:00:00Z",
        "legalRepresentative": "a",
        "usageYears": 6,
        "ADP1": 3,
        "ADP1date": "2019-11-04T00:00:00Z",
        "ADP2": 3,
        "ADP2date": "2019-11-14T00:00:00Z",
        "downPayment": 5,
        "firstMonthlyPaymentDate": "2019-11-05T00:00:00Z",
        "interestFactor": 5,
        "interestPercent": 5,
        "listPrice": 200,
        "processingFee": 200
    },
    "hasCoMember": false,
    "hasBeneficiary": false,
    "servicesDocs": [{
        "_id": "RS8MwmtsGjjprTYoY",
        "active": true,
        "name": {
            "en_EN": "servicio",
            "es_ES": "servicio"
        },
        "description": {
            "en_EN": "servicio",
            "es_ES": "servicio"
        },
        "terms": {
            "en_EN": "servicio",
            "es_ES": "servicio"
        },
        "isPriced": true,
        "price": 200,
        "hasQuantity": true,
        "measureUnit": {
            "en_EN": "200",
            "es_ES": "200"
        },
        "qtyManager": "vrAdmin",
        "createdAt": "2019-11-15 09:20:02",
        "quantity": 4
    }],
    "specialIncentivesDocs": [],
    "contract": {
        "fol": "MTYVR000002",
        "reg": "MTYVRRP471140"
    },
    "totalPaid": 0,
    "clubDoc": {
        "_id": "zjb3LGwkTy43JGXqD",
        "name": "clubname",
        "active": true,
        "publicName": "Default Public Name",
        "email": "default@email.com",
        "address": "Default Address",
        "country": "MX",
        "state": "Default State",
        "city": "Default City",
        "postalCode": "Default ZIP/PC",
        "description": "Default Description",
        "paymentsInfo": {
            "bankAccount": "Default Bank Account"
        },
        "type": "light",
        "createdAt": "2019-11-15 09:20:01",
        "owner": null,
        "paysQty": [{
            "noQty": 7,
            "percent": 5,
            "factor": 5
        }],
        "contractPrice": 200
    },
    "createdAt": "2019-11-15 09:25:19",
    "ownerDoc": {
        "_id": "uk4GxAbsbjztwE5uR",
        "active": true,
        "firstName": "Administrator",
        "lastName": "Admin/Manager",
        "email": "admin@vr.com",
        "type": "ADMIN",
        "clubId": "zjb3LGwkTy43JGXqD",
        "owner": "vrAdmin",
        "createdAt": "2019-11-15T19:06:30.823Z",
        "phone": "15231263",
        "address": "Vacancyrewards address",
        "city": "Cancun",
        "state": "Cancun",
        "country": "Mexico",
        "zip": "654423",
        "root": true,
        "userId": "nYzgTJP9iX2G8ZoAv"
    },
    "sales_person": "a",
    "currency": "MXN",
    "membershipType": "member",
    "paysQty": 7,
    "paysValue": 920,
    "status": "processable",
    "activationDate": "2019-11-15T19:25:19.597Z",
    "services": ["RS8MwmtsGjjprTYoY"],
    "observations": "algo",
    "payments": [{
        "type": "PF",
        "responsable": "titular",
        "date": "2019-11-04T00:00:00Z",
        "qty": 4,
        "bank": "MIFEL",
        "referenceID": "Nbe6nPFR8z3CKfWpb",
        "owner": "nYzgTJP9iX2G8ZoAv",
        "createdAt": "2019-11-15 09:25:19",
        "charges": [{
            "date": "2019-11-04T00:00:00Z"
        }]
    }]
}

Built With

  • NodeJS - The web framework used
  • npm - Dependency Management

Contributing

Versioning

version 1.0.7

Authors

License

MIT

Acknowledgments