Field in API | Setter in php-client-v2 | Getter in php-client-v2 | Comments |
---|---|---|---|
document | setDocument(string $document) | getDocument() | Can't be empty |
setEmail(string $email) | getEmail() | Can't be empty | |
service_uid | setServiceUid(string $service_uid) | getServiceUid() | Can't be empty |
document_type | setDocumentType(string $document_type) | getDocumentType() | |
first_name | setFirstName(string $first_name) | getFirstName() | |
last_name | setLastName(string $last_name) | getLastName() | |
telephone | setTelephone(string $telephone) | getTelephone() | |
birthdate | setBirthdate(string $birthdate) | getBirthdate() | Format: YYYY-MM-DD |
gender | setGender(char $gender) | getGender() | Allowed values: 'M' or 'F' |
street | setStreet(string $street) | getStreet() | |
postcode | setPostcode(string $postcode) | getPostcode() | |
city | setCity(string $city) | getCity() | |
department | setDepartment(string $department) | getDepartment() | |
state | setState(string $state) | getState() | |
country | setCountry(string $country) | getCountry() | Format: ISO 3166-1 alpha-3 (e.g. ARG) |
marital_status | setMaritalStatus(string $marital_status) | getMaritalStatus() | Allowed values: 'single', 'commited', 'married', 'divorced' or 'widowed' |
tags | setTags(string $tags) | getTags() | Comma separated list of values (e.g. "tag1,tag2") |
points | setPoints(integer $points) | getPoints() | User's loyalty points |
mailing_enabled | setMailingEnabled(string $mailing_enabled) | getMailingEnabled() | Allowed values: 'enabled' or 'disabled' |
sms_enabled | setSmsEnabled(string $sms_enabled) | getSmsEnabled() | Allowed values: 'enabled' or 'disabled' |
mailing_disabled_reason | setMailingDisabledReason(string $mailing_disabled_reason) | getMailingDisabledReason() | Allowed values: 'bounce', 'unsuscribe', 'spamreport', 'dropped' or 'other'. |
sms_disabled_reason | setSmsDisabledReason(string $sms_disabled_reason) | getSmsDisabledReason() | Allowed values: 'bounce', 'unsuscribe', 'spamreport', 'dropped' or 'other'. |
custom_attributes | setCustomAttributes(array $custom_attributes) setCustomAttributes(stdClass $custom_attributes) addCustomAttribute(string $key, string $value) |
getCustomAttributes() | Usage is explained below |
club_inscription_date | setClubInscriptionDate(string $club_inscription_date) | getClubInscriptionDate() | Date of inscription to loyalty program. Format: "YYYY-MM-DD" or "YYYY-MM-DD H:i:s" |
To have a valid User the following fields must be defined:
- email, document and/or service_uid
<?php
include '\WoowUpV2\Models\UserModel';
// Creating empty user
$user = new \WoowUpV2\Models\UserModel();
// Setting document
$user->setDocument('12345678');
// Validation should return true
var_dump($user->validate());
// Setting names
$user->setFirstName('John');
$user->setLastName('Doe');
// Custom attributes example
$key = 'my_custom_attribute_key';
$value = 'my_value';
// Option 1
$customAttributes = [ $key => $value ];
$user->setCustomAttributes($customAttributes);
// Option 2
$user->addCustomAttribute($key, $value);