Plugin Directory

Changeset 2212575


Ignore:
Timestamp:
12/16/2019 12:39:25 AM (6 years ago)
Author:
xcoobee
Message:

version 1.6.5

Location:
xcoobee/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • xcoobee/trunk/CHANGELOG

    r2183457 r2212575  
    2121* update cache directory to be inside WP instance
    2222
     23= 1.6.5 - 2019-12-15 =
     24* autodetect security and make cache optional
     25
  • xcoobee/trunk/includes/sdk/API.md

    r2183457 r2212575  
    33- [Call limits](#call-limits)
    44- [Logs](#logs)
    5 - [PGP Secret and password](#pgp)
     5- [PGP Secret and password](#about-pgp-secret-and-password)
    66- [Responses](#responses)
    77    - [Success package](#success-package)
     
    3232        - [UserMessage](#usermessage-2)
    3333- [System API](#system-api)
    34     - [ping](#ping)
    35     - [addEventSubscription](#add-event-subscription)
    36     - [listEventSubscriptions](#list-event-subscriptions)
    37     - [deleteEventSubscription](#delete-event-subscription)
    38     - [triggerEvent](#trigger-event)
    39     - [handleEvents](#handle-events)
    40     - [getEvents](#get-events)
     34    - [ping](#pingconfig)
     35    - [addEventSubscription](#addeventsubscriptionarrayofeventandhandlerpairs-campaignid-config)
     36    - [listEventSubscriptions](#listeventsubscriptionscampaignid-config)
     37    - [deleteEventSubscription](#deleteeventsubscriptionarrayofeventnames-campaignid-config)
     38    - [triggerEvent](#triggereventtype-config)
     39    - [handleEvents](#handleeventsevents)
     40    - [getEvents](#geteventsconfig)
    4141- [Consent Administration API](#consent-administration-api)
    42     - [getCampaignInfo](#get-campaign-info)
    43     - [listCampaigns](#list-campaigns)
    44     - [getDataPackage](#get-data-package)
    45     - [listConsents](#list-consents)
    46     - [getConsentData](#get-consent-data)
    47     - [getCookieConsent](#get-cookie-consent)
    48     - [requestConsent](#request-consent)
    49     - [confirmConsentChange](#confirm-consent-change)
    50     - [declineConsentChange](#decline-consent-change)
    51     - [confirmDataDelete](#confirm-data-delete)
    52     - [setUserDataResponse](#set-user-data-response)
    53     - [registerConsents](#register-consents)
    54     - [getCampaignIdByRef](#get-campaign-id)
     42    - [getCampaignInfo](#getcampaigninfocampaignid-config)
     43    - [listCampaigns](#listcampaignsconfig)
     44    - [getDataPackage](#getdatapackageconsentid-config)
     45    - [listConsents](#listconsentsfilters-config)
     46    - [getConsentData](#getconsentdataconsentid-config)
     47    - [getCookieConsent](#getcookieconsentxid-campaignid-config)
     48    - [requestConsent](#requestconsentxid-refid-campaignid-config)
     49    - [confirmConsentChange](#confirmconsentchangeconsentid-config)
     50    - [declineConsentChange](#declineconsentchangeconsentid-config)
     51    - [confirmDataDelete](#confirmdatadeleteconsentid-config)
     52    - [setUserDataResponse](#setuserdataresponsemessage-requestref-filename-targeturl-eventhandler-config)
     53    - [registerConsents](#registerconsentsfilename-targets-reference-campaignid-config)
     54    - [getCampaignIdByRef](#getcampaignidbyrefcampaignref-config)
     55    - [shareConsents](#shareconsentscampaignref-campaignid-consentids-config)
     56    - [dontSellData](#dontselldataemail-config)
    5557- [User API](#user-api)
    56     - [getUsePublicKey](#get-user-public-key)
    57     - [sendUserMessage](#send-user-message)
    58     - [getConversations](#get-conversations)
    59     - [getConversation](#get-conversation)
     58    - [getUsePublicKey](#getuserpublickeyxid-config)
     59    - [sendUserMessage](#sendusermessagemessage-reference-config)
     60    - [getConversations](#getconversationsconfig)
     61    - [getConversation](#getconversationuserid-config)
    6062- [Bee API](#bee-api)
    61     - [listBees](#list-bees)
    62     - [uploadFiles](#upload-files)
    63     - [takeOff](#take-off)
     63    - [listBees](#listbeessearchtext-config)
     64    - [uploadFiles](#uploadfilesfiles-endpoint-config)
     65    - [takeOff](#takeoffbees-options-subscriptions-config)
    6466- [Inbox API](#inbox-api)
    65     - [listInbox](#list-inbox)
    66     - [getInboxItem](#get-inbox-item)
    67     - [deleteInboxItem](#delete-inbox-item)
     67    - [listInbox](#listinboxconfig)
     68    - [getInboxItem](#getinboxitemmessageid-config)
     69    - [deleteInboxItem](#deleteinboxitemmessageid-config)
    6870- [Troubleshooting](#troubleshooting)
    6971
     
    8789
    8890
    89 # About PGP Secret and password {#pgp}
     91# About PGP Secret and password
    9092
    9193All PGP data is optional to the configuration object.  If you do not supply it,
     
    381383For example: `$pingResult = $sdk->system->ping();`
    382384
    383 ## ping([config]) {#ping}
     385## ping([config])
    384386
    385387Can be called to see whether current configuration will connect to XcooBee system. This will return an error if your API user does not have a public PGP key on its profile.
     
    398400
    399401
    400 ## addEventSubscription(arrayOfEventAndHandlerPairs[, campaignId, config]) {#add-event-subscription}
     402## addEventSubscription(arrayOfEventAndHandlerPairs[, campaignId, config])
    401403
    402404You can register subscriptions to hooks by calling the addEventSubscription function and providing the event (as specified in this document) and handler pairs `eventname: handler`.
     
    436438
    437439
    438 ## listEventSubscriptions([campaignId, config]) {#list-event-subscriptions}
     440## listEventSubscriptions([campaignId, config])
    439441
    440442list current subscriptions.
     
    454456
    455457
    456 ## deleteEventSubscription(arrayOfEventNames[, campaignId, config]) {#delete-event-subscription}
     458## deleteEventSubscription(arrayOfEventNames[, campaignId, config])
    457459
    458460delete existing subscriptions.
     
    474476
    475477
    476 ## triggerEvent(type[, config]) {#trigger-event}
     478## triggerEvent(type[, config])
    477479
    478480Trigger test event to configured campaign webhook. The structure will be the same as real event (with encrypted payload and HMAC signature).
     
    524526
    525527
    526 ## getEvents([config]) {#get-events}
     528## getEvents([config])
    527529
    528530In cases where you are not able to use direct webhook posts to your sites, for example you are in development or your system cannot be accessed via the Internet directly, you can pull your events from XcooBee.
     
    552554For example: `$campaigns = $sdk->consents->listCampaigns();`
    553555
    554 ## getCampaignInfo([campaignId, config]) {#get-campaign-info}
     556## getCampaignInfo([campaignId, config])
    555557get basic info on campaign (setup, datatypes and options). The information will not return the users registered with the campaign.
    556558
     
    569571- status 400 if error
    570572
    571 ## listCampaigns([config]) {#list-campaigns}
     573## listCampaigns([config])
    572574get all user campaigns
    573575
     
    585587- status 400 if error
    586588
    587 ## getDataPackage(consentId[, config]) {#get-data-package}
     589## getDataPackage(consentId[, config])
    588590
    589591When data is hosted for you at XcooBee you can request the data package each time you need to use it. You will need to provide `consentId`. This call will only respond to authorized call source.
     
    600602standard response object
    601603- status 200 if success:
    602     - result will contain requested data object
     604    - result will contain array of data objects
    603605        The SDK will decrypt this for you if it has access to PGP keys otherwise you have to decrypt this object
    604606- status 400 if error
    605607
    606 ## listConsents([statuses, config]) {#list-consents}
    607 
    608 Query for list of consents for a given campaign. Company can get general consentId for any consent that was created as part of a campaign. This is a multi-page recordset. Data returned: consentId, creation date, expiration date, xcoobeeId
    609 
    610 possible response/filter for status:
     608## listConsents([statuses, config])
     609
     610Query for list of consents for a given campaign. Company can get general consentId for any consent that was created as part of a campaign. This is a multi-page recordset.
     611
     612options:
     613
     614```
     615filters   => optional: array of different filters, if not specified all will be returned
     616config    => optional: the config object
     617```
     618
     619example:
     620```
     621$filters = [
     622   'search'         => 'Cool',
     623   'country'        => 'US',
     624   'province'       => 'California',
     625   'city'           => 'Los Angeles',
     626   'dateFrom'       => '2019-01-01',
     627   'dateTo'         => '2019-12-31',
     628   'statuses'       => ['expired', 'rejected'],
     629   'consentTypes'   => ['perform_contract', 'perform_a_service'],
     630   'dataTypes'      => ['first_name', 'middle_name', 'last_name'],
     631];
     632```
     633
     634`search` - filters out consents with name or campaign description, that include passed string
     635`country` - country code of consent owner
     636`province` - country province of consent owner
     637`city` - city of consent owner
     638`dateFrom` - string date. Min date, when consent was created
     639`dateTo` - string date. Max date, when consent was created
     640
     641possible `statuses`:
    611642
    612643pending, active, updating, offer, cancelled, expired, rejected
    613644
    614 options:
    615 
    616 ```
    617 statuses  => optional: array of numbers, one of the valid consent statuses, if not specified all will be returned
    618 config    => optional: the config object
    619 ```
    620 
    621 ### response
    622 
    623 standard response object
    624 - status 200 if success:
    625     - result will contain consent data object: consent_id, status_id, date_c, date_e, xcoobee_id
    626 - status 400 if error
    627 
    628 ## getConsentData(consentId[, config]) {#get-consent-data}
     645possible `consentTypes`:
     646
     647missing, perform_contract, perform_a_service, deliver_a_product, order_fullfillment, shipping, billing, subscription, support, support_a_service, support_a_product, warranty, create_custom_service_and_product, create_custom_service, create_custom_product, travel, deliver_itiniary_changes, government_services, emergency_services, law_enforcement, health_care_services, care_delivery, health_billing, emergency_request, product_announcement, product_information, survey, marketing, promotion, data_aggregation, anonymized_data_aggregation, company_information, press_releaseases, financial_reports, website_tracking, web_application_tracking, mobile_device_tracking, iot_device_tracking, payment_processing, donation, private_consent, employee_administration, employee_management, contractor_management, training, it_administration, supplier_screening, other
     648
     649possible `dataTypes`:
     650
     651first_name, middle_name, last_name, name_prefix, name_suffix, xcoobee_id, email, alternate_email, phone, alternate_phone, street1, street2, city, state, postal_code, country, date_of_birth, image, ethnicity_race, genetic_data, biometric_data, bank_account_description, bank_name, bank_routing_number, bank_swift, bank_isfc, bank_account_number, bank_iban, paypal_email, payment_token, government_document_references, government_id, location_data, health_record, emergency_medical_record, physical_health_record, dental_record, mental_health_record, health_metrics, internet_access_record, ip_address, device_identifiers, browser_details, meter_reading, party_affiliation, religion, sexual_orientation, criminal_conviction, membership, application_cookie, usage_cookie, statistics_cookie, advertising_cookie, social_posts, twitter_handle, family_members, friends, colleagues, custom, other1, other2, other3, other4, other5, other6, other7, other8, other9
     652
     653### response
     654
     655standard response object
     656- status 200 if success:
     657    - result will contain consent data objects
     658- status 400 if error
     659
     660## getConsentData(consentId[, config])
    629661
    630662Query for a specific consent given. Company can get consent definition for any consent that was created. The data normally has three areas: Who, what data types, what the uses are, how long.
     
    644676- status 400 if error
    645677
    646 ## getCookieConsent(xid[, campaignId, config]) {#get-cookie-consent}
     678## getCookieConsent(xid[, campaignId, config])
    647679
    648680This is a shortcut mechanism to query the XcooBee system for existing user consent for consent type `Website Tracking (1400), Web Application Tracking (1410)` for specific use data types (`application cookie (1600), usage cookie (1610), and advertising cookie (1620)`). We will retrieve only active consent for the cookies on the website identified in the campaign Id and return whether user has agreed to any cookies.
     
    670702- status 400 if error
    671703
    672 ## requestConsent(xid[, refId, campaignId, config]) {#request-consent}
     704## requestConsent(xid[, refId, campaignId, config])
    673705
    674706Sends out the consent or consent and data request to a specific user using the data in the campaign. The campaign definition determines what data (only consent or consent + data) we will ask from the user.
     
    692724
    693725
    694 ## confirmConsentChange(consentId[, config]) {#confirm-consent-change}
     726## confirmConsentChange(consentId[, config])
    695727Use this call to confirm that data has been changed in company systems according to change requested by user.
    696728
     
    709741
    710742
    711 ## declineConsentChange(consentId[, config]) {#decline-consent-change}
     743## declineConsentChange(consentId[, config])
    712744Use this call to open dispute on consent.
    713745
     
    725757- status 400 if error
    726758
    727 ## confirmDataDelete(consentId[, config]) {#confirm-data-delete}
     759## confirmDataDelete(consentId[, config])
    728760Send by company to confirm that data has been purged from company systems
    729761
     
    742774
    743775
    744 ## setUserDataResponse(message, requestRef, filename, targetUrl, eventHandler[, config]) {#set-user-data-response}
     776## setUserDataResponse(message, requestRef, filename, targetUrl, eventHandler[, config])
    745777
    746778Companies can respond to user data requested via this call. Standard hiring points will be deducted for this. The call will send a `message` to user's communication center. You also need to send a file with user's data in order to close data request.
     
    764796
    765797
    766 ## registerConsents([filename, targets, reference, campaignId, config]) {#register-consents}
     798## registerConsents([filename, targets, reference, campaignId, config])
    767799
    768800Generally register/save consents that you received outside of XcooBee.
    769801
    770802a) You may have already a list of consents that you have obtained from user but wish to use XcooBee as a system of record so you can manage them through XcooBee.
    771 b) Or, you would like for XcooBee to verify the consent that you have in your corporate system. 
     803b) Or, you would like for XcooBee to verify the consent that you have in your corporate system.
    772804
    773805You can upload a list of emails for your campaign and, if your campaign is setup for it,  XcooBee will validate the consent for you with the users.
     
    778810options:
    779811```
    780 filename    => optional: pointer to the csv file which contains list of targets. 
     812filename    => optional: pointer to the csv file which contains list of targets.
    781813targets     => optional: list of users whose consents we need to register
    782814
     
    793825date_received   => date when a consent was received, optional, we'll use current date as default
    794826date_expires    => date when a consent expires, optional, we'll set expiration date based on campaign's settings if missing
     827contract_ref    => unique reference provided to allow match specific consent
    795828```
    796829
     
    798831```
    799832[
    800    [ 'target' => 'example@test.com' ],
     833   [ 'target' => 'example@test.com', 'contract_ref' => 'refId123' ],
    801834   [ 'target' => 'someTestXid', 'date_expires' => '2019-06-14T08:35:35.866Z' ],
    802835]
     
    808841it must be a csv format where each line represents target, file should not contain headers
    809842
    810 | target           | date_received            | date_expires             |
    811 |------------------|--------------------------|--------------------------|
    812 | example@test.com | 2019-06-14T08:35:35.866Z | 2019-06-14T08:35:35.866Z |
    813 | ~someTestXid     | 2019-06-14T08:35:35.866Z | 2019-06-14T08:35:35.866Z |
    814 
    815 ### response
    816 
    817 You should save the refId that is returned from XcooBee. This is your reference to the consent for lookup purposes. 
    818 XcooBee does not save the actual email of the user for the consent record, it uses a one way hash pattern. XcooBee technology is unable to resolve consent record via email until user has created an account.  Thus, you should save the refId returned. This is the only link between data stored in your system and XcooBee consent. 
     843| target           | date_received            | date_expires             | contract_ref             |
     844|------------------|--------------------------|--------------------------|--------------------------|
     845| example@test.com | 2019-06-14T08:35:35.866Z | 2019-06-14T08:35:35.866Z | qwerty123                |
     846| ~someTestXid     | 2019-06-14T08:35:35.866Z | 2019-06-14T08:35:35.866Z | qwerty456                |
     847
     848### response
     849
     850You should save the refId that is returned from XcooBee. This is your reference to the consent for lookup purposes.
     851XcooBee does not save the actual email of the user for the consent record, it uses a one way hash pattern. XcooBee technology is unable to resolve consent record via email until user has created an account.  Thus, you should save the refId returned. This is the only link between data stored in your system and XcooBee consent.
    819852
    820853When you submit multiple records via array object or file, the refId returned is only the **prefix** to the final reference for each consent. The final reference Id can be determined by the ordinal position (zero based index) of the record you submitted `refId-[ordinal position]`. Thus if you have a reference Id of `3657f2c0-d6a7-4a83-88db-0ad8ac4ca4e9` and you submitted two records, the final reference Id for each of the consent records would be:
    821854
    822 - `3657f2c0-d6a7-4a83-88db-0ad8ac4ca4e9-0` for first record
    823 - `3657f2c0-d6a7-4a83-88db-0ad8ac4ca4e9-1` for second record etc.
     855- `3657f2c0-d6a7-4a83-88db-0ad8ac4ca4e9-1` for first record
     856- `3657f2c0-d6a7-4a83-88db-0ad8ac4ca4e9-2` for second record etc.
    824857
    825858
     
    830863- status 400 if error
    831864
    832 ## getCampaignIdByRef(campaignRef[, config]) {#get-campaign-id}
     865## getCampaignIdByRef(campaignRef[, config])
    833866get campaign id by it's reference
    834867
     
    847880- status 400 if error
    848881
     882## shareConsents(campaignRef[, campaignId, consentIds, config])
     883Creates new consents based on existing ones on behalf of other company
     884
     885options:
     886```
     887campaignRef => the campaign reference which consents will be shared with
     888campaignId  => the campaign id which consents will be shared from
     889consentIds  => the consent ids which will be shared
     890config      => optional: the config object
     891```
     892
     893Either `campaignId` or `consentIds` should be provided.
     894
     895### response
     896
     897standard response object
     898- status 200 if success:
     899    - result will contain reference
     900- status 400 if error
     901
     902## dontSellData(email[, config])
     903
     904Set `Do Not Sell` flag for user. Consents for this user won't be shared between campaigns for 1 year. After expiration, it should be extended.
     905
     906options:
     907```
     908email  => the email of user, that flag should be set for
     909config => optional: the config object
     910```
     911
     912### response
     913
     914standard response object
     915- status 200 if success:
     916    - result will contain true
     917- status 400 if error
     918
    849919
    850920# User API
     
    853923For example: `$conversations = $sdk->users->getConversations();`
    854924
    855 ## getUserPublicKey(xid[, config]) {#get-user-public-key}
     925## getUserPublicKey(xid[, config])
    856926
    857927Retrieves a user's public PGP key as published on their public profile. If the user chose to hide it or the user is not known, it returns `null`.
     
    871941public PGP or empty string
    872942
    873 ## sendUserMessage(message, reference, [config]) {#send-user-message}
     943## sendUserMessage(message, reference, [config])
    874944This function allows you to send a message to users. You can communicate issues regarding consent, ticket and data request this way. It will create a threaded discussion for the user and for you and append to it this message.
    875945
     
    892962- status 400 if error
    893963
    894 ## getConversations([config]) {#get-conversations}
     964## getConversations([config])
    895965This function allows you to get a list of discussions with users regarding breaches, consents and so on.
    896966
     
    906976- status 400 if error
    907977
    908 ## getConversation(userId[, config]) {#get-conversation}
     978## getConversation(userId[, config])
    909979This function allows you to get full discussion with selected user.
    910980
     
    9331003
    9341004
    935 ## listBees([searchText, config]) {#list-bees}
     1005## listBees([searchText, config])
    9361006
    9371007This function will help you search through the bees in the system that your account is able to hire. This is a simple keyword search interface.
     
    9501020- status 400 if error
    9511021
    952 ## uploadFiles(files[, endpoint, config]) {#upload-files}
     1022## uploadFiles(files[, endpoint, config])
    9531023
    9541024You use the uploadFiles function to upload files from your server to XcooBee. You can upload multiple files and you can optionally supply an outbox endpoint. If you have an outbox endpoint you do not need to call the [`takeOff()`](#take-off) function as the endpoint already specifies all processing parameters. If your subscription allows you can configure the outbox endpoints in the XcooBee UI.
     
    9681038- status 400 if error
    9691039
    970 ## takeOff(bees, options[, subscriptions, config]) {#take-off}
     1040## takeOff(bees, options[, subscriptions, config])
    9711041
    9721042You normally use this as follow up call to [`uploadFiles()`](#upload-files). This will start your processing. You specify the bee(s) that you want to hire and the parameter that are needed for the bee to work on your file(s). If you want to be kept up to date you can supply subscriptions. Please note that subscriptions will deduct points from your balance and will cause errors when your balance is insufficient.
     
    11191189For example: `$inboxItems = $sdk->inbox->listInbox();`
    11201190
    1121 ## listInbox([config]) {#list-inbox}
     1191## listInbox([config])
    11221192
    11231193This method will present a paged list of inbox items that you can download. The listing will be for the user connected to you API key. You cannot check any other user's inbox using this method. You can return up to 100 items in one call.
     
    11481218
    11491219
    1150 ## getInboxItem(messageId[, config]) {#get-inbox-item}
     1220## getInboxItem(messageId[, config])
    11511221
    11521222This method will return a file and file meta tags. Upon first downloaded, the `downloadDate` for the item will be populated.
     
    11651235
    11661236
    1167 ## deleteInboxItem(messageId[, config]) {#delete-inbox-item}
     1237## deleteInboxItem(messageId[, config])
    11681238
    11691239This method will delete a file that corresponds to your messageid. If the file does not exist, an error will be returned.
     
    11911261
    11921262Once you have exceeded your call limits, your call will return status `429` too many requests. Please update your subscription or contact support.
    1193 
  • xcoobee/trunk/includes/sdk/src/XcooBee/Core/Api/Api.php

    r2126380 r2212575  
    1414    /** @var GraphQLClient */
    1515    protected $_client;
    16    
     16
    1717    /** @var XcooBee */
    1818    protected $_xcoobee;
    19    
     19
    2020    public function __construct(XcooBee $xcoobee)
    2121    {
     
    5050            $config = \XcooBee\Models\ConfigModel::createFromData($config);
    5151        }
    52        
     52
    5353        return $this->_client->request($query, $variables, [
    5454            'Content-Type' => 'application/json',
    5555        ], $config);
    5656    }
    57    
     57
    5858    /**
    5959     * Get default Campaign
    6060     */
    61     protected function _getDefaultCampaignId() 
     61    protected function _getDefaultCampaignId()
    6262    {
    63         return $this->_xcoobee->getStore()->getStore(CachedData::CONFIG_KEY)->campaignId;
     63        return $this->_xcoobee->getConfig()->campaignId;
    6464    }
    65    
     65
    6666    /**
    6767     * Get Campaign id
    68      * 
     68     *
    6969     * @param String $campaignId
    7070     * @param array $config
    71      * 
     71     *
    7272     * @return String
    73      * 
     73     *
    7474     * @throws XcooBeeException
    7575     */
     
    8282            return $config['campaignId'];
    8383        }
    84        
     84
    8585        if ($campaignId = $this->_getDefaultCampaignId()) {
    8686            return $campaignId;
    8787        }
    88        
     88
    8989        throw new XcooBeeException('No "campaignId" provided');
    9090    }
    91    
     91
    9292    /**
    9393     * Get page size.
     
    104104        }
    105105
    106         $cachedPageSize = $this->_xcoobee->getStore()->getStore(CachedData::CONFIG_KEY)->pageSize;
     106        $cachedPageSize = $this->_xcoobee->getConfig()->pageSize;
    107107
    108108        return  is_null($cachedPageSize) || $cachedPageSize > self::MAX_PAGE_SIZE ? self::MAX_PAGE_SIZE : $cachedPageSize;
  • xcoobee/trunk/includes/sdk/src/XcooBee/Core/Api/Consents.php

    r2126380 r2212575  
    271271     * list all consents
    272272     *
    273      * @param int $statusId
    274      * @param array $config
    275      *
    276      * @return Response
    277      *
    278      * @throws XcooBeeException
    279      */
    280     public function listConsents($statusIds = [], $config = [])
    281     {
    282         $query = 'query listConsents($userId: String!, $statuses: [ConsentStatus], $first : Int, $after: String) {
    283             consents(campaign_owner_cursor: $userId, statuses : $statuses, first : $first , after : $after) {
     273     * @param array $filters
     274     * @param array $config
     275     *
     276     * @return Response
     277     *
     278     * @throws XcooBeeException
     279     */
     280    public function listConsents($filters = [], $config = [])
     281    {
     282        $query = 'query listConsents($userId: String!, $statuses: [ConsentStatus], $consentTypes: [ConsentType], $dataTypes: [ConsentDatatype], $dateFrom: String, $dateTo: String, $search: String, $country: String, $province: String, $city: String, $first: Int, $after: String) {
     283            consents(campaign_owner_cursor: $userId, statuses : $statuses, consent_types: $consentTypes, data_types: $dataTypes, date_from: $dateFrom, date_to: $dateTo, search: $search, country: $country, province: $province, city: $city, first: $first, after: $after) {
    284284                data {
    285                     consent_cursor,
    286                     consent_status,
    287                     user_xcoobee_id,
    288                     date_c,
    289                     date_e,
     285                    consent_cursor
     286                    user_cursor
     287                    user_display_name
     288                    user_xcoobee_id
     289                    campaign_cursor
     290                    campaign_status
     291                    consent_name
     292                    consent_description
     293                    consent_status
     294                    consent_type
     295                    consent_source
     296                    consent_details {
     297                        datatype
     298                        marker
     299                        share_hash
     300                    }
     301                    date_c
     302                    date_e
     303                    date_u
     304                    date_approved
     305                    date_deleted
     306                    update_confirmed
     307                    deletion_confirmed
     308                    request_data_types
     309                    request_data_sections {
     310                        section_fields {
     311                            datatype
     312                        }
     313                    }
     314                    is_data_request
     315                    user_email_mask
    290316                }
    291317                page_info {
     
    296322        }';
    297323
    298         $statuses = [];
    299         foreach ($statusIds as $statusId) {
    300             $statuses[] = $this->_getConsentStatus($statusId);
    301         }
    302 
    303         return $this->_request($query, [
    304             'statuses' => $statuses ? : null,
     324        $variables = [
    305325            'userId' => $this->_getUserId($config),
    306326            'first' => $this->_getPageSize($config),
    307327            'after' => null,
    308         ], $config);
     328        ];
     329
     330        if (array_key_exists('search', $filters)) {
     331            $variables['search'] = $filters['search'];
     332        }
     333
     334        if (array_key_exists('country', $filters)) {
     335            $variables['country'] = $filters['country'];
     336        }
     337
     338        if (array_key_exists('province', $filters)) {
     339            $variables['province'] = $filters['province'];
     340        }
     341
     342        if (array_key_exists('city', $filters)) {
     343            $variables['city'] = $filters['city'];
     344        }
     345
     346        if (array_key_exists('dateFrom', $filters)) {
     347            $dateString = $filters['dateFrom'];
     348            try {
     349                $from = new \DateTime($dateString);
     350                $variables['dateFrom'] = $dateString;
     351            } catch (\Exception $e) {
     352                throw new XcooBeeException("Invalid date string '$dateString' provided");
     353            }
     354        }
     355
     356        if (array_key_exists('dateTo', $filters)) {
     357            $dateString = $filters['dateTo'];
     358            try {
     359                $from = new \DateTime($dateString);
     360                $variables['dateTo'] = $dateString;
     361            } catch (\Exception $e) {
     362                throw new XcooBeeException("Invalid date string '$dateString' provided");
     363            }
     364        }
     365
     366        if (array_key_exists('statuses', $filters)) {
     367            $availableStatuses = [
     368                'pending',
     369                'active',
     370                'updating',
     371                'offer',
     372                'cancelled',
     373                'expired',
     374                'rejected'
     375            ];
     376            foreach ($filters['statuses'] as $status) {
     377                if (!in_array($status, $availableStatuses)) {
     378                    throw new XcooBeeException("Invalid status '$status' provided");
     379                }
     380            }
     381
     382            $variables['statuses'] = $filters['statuses'];
     383        }
     384
     385        if (array_key_exists('consentTypes', $filters)) {
     386            $availableTypes = [
     387                'missing', 'perform_contract', 'perform_a_service', 'deliver_a_product', 'order_fullfillment', 'shipping',
     388                'billing', 'subscription', 'support', 'support_a_service', 'support_a_product', 'warranty',
     389                'create_custom_service_and_product', 'create_custom_service', 'create_custom_product', 'travel',
     390                'deliver_itiniary_changes', 'government_services', 'emergency_services', 'law_enforcement',
     391                'health_care_services', 'care_delivery', 'health_billing', 'emergency_request', 'product_announcement',
     392                'product_information', 'survey', 'marketing', 'promotion', 'data_aggregation', 'anonymized_data_aggregation',
     393                'company_information', 'press_releaseases', 'financial_reports', 'website_tracking', 'web_application_tracking',
     394                'mobile_device_tracking', 'iot_device_tracking', 'payment_processing', 'donation', 'private_consent',
     395                'employee_administration', 'employee_management', 'contractor_management', 'training', 'it_administration',
     396                'supplier_screening', 'other',
     397            ];
     398            foreach ($filters['consentTypes'] as $type) {
     399                if (!in_array($type, $availableTypes)) {
     400                    throw new XcooBeeException("Invalid type '$type' provided");
     401                }
     402            }
     403
     404            $variables['consentTypes'] = $filters['consentTypes'];
     405        }
     406
     407        if (array_key_exists('dataTypes', $filters)) {
     408            $availableDataTypes = [
     409                'first_name', 'middle_name', 'last_name', 'name_prefix', 'name_suffix', 'xcoobee_id',
     410                'email', 'alternate_email', 'phone', 'alternate_phone', 'street1', 'street2', 'city',
     411                'state', 'postal_code', 'country', 'date_of_birth', 'image', 'ethnicity_race', 'genetic_data',
     412                'biometric_data', 'bank_account_description', 'bank_name', 'bank_routing_number', 'bank_swift',
     413                'bank_isfc', 'bank_account_number', 'bank_iban', 'paypal_email', 'payment_token',
     414                'government_document_references', 'government_id', 'location_data', 'health_record',
     415                'emergency_medical_record', 'physical_health_record', 'dental_record', 'mental_health_record',
     416                'health_metrics', 'internet_access_record', 'ip_address', 'device_identifiers', 'browser_details',
     417                'meter_reading', 'party_affiliation', 'religion', 'sexual_orientation', 'criminal_conviction', 'membership',
     418                'application_cookie', 'usage_cookie', 'statistics_cookie', 'advertising_cookie', 'social_posts',
     419                'twitter_handle', 'family_members', 'friends', 'colleagues', 'custom', 'other1', 'other2', 'other3',
     420                'other4', 'other5', 'other6', 'other7', 'other8', 'other9'
     421            ];
     422            foreach ($filters['dataTypes'] as $type) {
     423                if (!in_array($type, $availableDataTypes)) {
     424                    throw new XcooBeeException("Invalid data type '$type' provided");
     425                }
     426            }
     427
     428            $variables['dataTypes'] = $filters['dataTypes'];
     429        }
     430
     431        return $this->_request($query, $variables, $config);
    309432    }
    310433
     
    392515
    393516        // Try to decrypt the data.
    394         if ($response->code === 200 && !empty($response->result->data_package->data)) {
    395             try {
    396                 $decryptedData = $this->_encryption->decrypt($response->result->data_package->data);
    397 
    398                 if ($decryptedData !== null) {
    399                     $response->result->data_package->data = $decryptedData;
    400                 }
    401             } catch (EncryptionException $e) {
    402                 // Do nothing, we will pass on the data as it is.
     517        if ($response->code === 200 && !empty($response->result->data_package)) {
     518            foreach ($response->result->data_package as $key => $dataPackage) {
     519                try {
     520                    $decryptedData = $this->_encryption->decrypt($dataPackage->data);
     521
     522                    if ($decryptedData !== null) {
     523                        $response->result->data_package[$key]->data = $decryptedData;
     524                    }
     525                } catch (EncryptionException $e) {
     526                    // Do nothing, we will pass on the data as it is.
     527                }
    403528            }
    404529        }
     
    470595    }
    471596
    472     protected function _getXcoobeeIdByConsent($consentId, $config = [])
    473     {
    474         $consent = $this->getConsentData($consentId, $config = []);
    475         if (!empty($consent->result->consent)) {
    476             return $consent->result->consent->user_xcoobee_id;
    477         }
    478 
    479         return false;
    480     }
    481 
    482     protected function _getConsentStatus($statusId)
    483     {
    484         if ($statusId === null) {
    485             return null;
    486         }
    487 
    488         $availableStatus = [
    489             'pending',
    490             'active',
    491             'updating',
    492             'offer',
    493             'cancelled',
    494             'expired',
    495             'rejected'
    496         ];
    497 
    498         if (array_key_exists($statusId, $availableStatus)) {
    499             return $availableStatus[$statusId];
    500         }
    501 
    502         throw new XcooBeeException('invalid "statusId" provided');
     597    /**
     598     * Share consents to another campaign
     599     *
     600     * @param string $campaignRef
     601     * @param string $campaignId
     602     * @param array $consetnIds
     603     * @param array $config
     604     * @return Response
     605     * @throws XcooBeeException
     606     */
     607    public function shareConsents($campaignRef, $campaignId = null, $consentIds = [], $config = [])
     608    {
     609        if (!$campaignId && !$consentIds) {
     610            throw new XcooBeeException('Either campaignId or consentIds should be provided');
     611        }
     612
     613        $query = 'mutation shareConsents($config: ShareConsentsConfig!){
     614            share_consents(config: $config){
     615                ref_id
     616            }
     617        }';
     618
     619        return  $this->_request($query, [
     620            'config' => [
     621                'campaign_reference' => $campaignRef,
     622                'campaign_cursor' => $campaignId,
     623                'consent_cursors' => $consentIds,
     624            ]
     625        ], $config);
     626    }
     627
     628    /**
     629     * Set or extend `Do Not Sell Data` flag
     630     *
     631     * @param string $email
     632     * @param array $config
     633     *
     634     * @return Response
     635     * @throws XcooBeeException
     636     */
     637    public function dontSellData($email, $config = [])
     638    {
     639        if (!$email) {
     640            throw new XcooBeeException('No "email" provided');
     641        }
     642
     643        $query = 'mutation dontSellData($email: String!) {
     644            do_not_sell_data(email: $email) {
     645              user_email
     646            }
     647        }';
     648
     649        $response = $this->_request($query, ['email' => $email], $config);
     650        if ($response->code !== 200) {
     651            return $response;
     652        }
     653
     654        $response = new Response();
     655        $response->code = 200;
     656        $response->result = true;
     657
     658        return $response;
    503659    }
    504660}
  • xcoobee/trunk/includes/sdk/src/XcooBee/Core/Configuration.php

    r2126380 r2212575  
    1111    /** @var XcooBee */
    1212    protected $_xcoobee;
    13    
     13
     14    /** @var ConfigModel */
     15    protected $_config = null;
     16
    1417    public function __construct(XcooBee $xcoobee)
    1518    {
    1619        $this->_xcoobee = $xcoobee;
    1720    }
    18    
     21
    1922    /**
    2023     * Set configuration data
     
    2427    public function setConfig(ConfigModel $config)
    2528    {
     29        $this->_config = $config;
     30
    2631        $savedConfig = $this->_xcoobee->getStore()->getStore(CachedData::CONFIG_KEY);
    2732        if($savedConfig != $config){
     
    3742    public function getConfig()
    3843    {
     44        if ($this->_config !== null) {
     45            return $this->_config;
     46        }
     47
    3948        return $this->_xcoobee->getStore()->getStore(CachedData::CONFIG_KEY);
    4049    }
  • xcoobee/trunk/includes/sdk/src/XcooBee/Http/Client.php

    r2126380 r2212575  
    7171
    7272        if($token === null){
    73             $config = $store->getStore(CachedData::CONFIG_KEY);
     73            $config = $this->_xcoobee->getConfig();
    7474            $token = $this->_fetchToken($config);
    7575            $store->setStore(CachedData::AUTH_TOKEN_KEY, $token);
  • xcoobee/trunk/includes/sdk/src/XcooBee/Store/CachedData.php

    r2183457 r2212575  
    1717    protected static $_instance = null;
    1818
    19     protected $_store;
     19    protected $_store = null;
    2020
    21     public function __construct(FileSystem $driver)
     21    public function __construct(FileSystem $driver = null)
    2222    {
    23         $this->_store = new Pool($driver);
     23        if ($driver !== null) {
     24            $this->_store = new Pool($driver);
     25        }
    2426    }
    2527
     
    5456                return new FileSystem([]);
    5557            } catch (\Exception $ex) {
    56                 throw new XcooBeeException('Couldn\'t init cache driver. Add correct permission to SDK directory');
     58                // in case we weren't able to use filesystem, don't use cache at all
     59                return null;
    5760            }
    5861        }
     
    6770    public function setStore($key, $value)
    6871    {
     72        if ($this->_store === null) {
     73            return null;
     74        }
     75
    6976        $item = $this->_store->getItem(md5($key));
    7077        $this->_store->save($item->set($value));
     
    7986    public function getStore($key)
    8087    {
     88        if ($this->_store === null) {
     89            return null;
     90        }
     91
    8192        $item = $this->_store->getItem(md5($key));
    8293        return $item->get();
     
    8899    public function clearStore()
    89100    {
     101        if ($this->_store === null) {
     102            return null;
     103        }
     104
    90105        $this->_store->clear();
    91106    }
  • xcoobee/trunk/includes/sdk/src/XcooBee/XcooBee.php

    r2126380 r2212575  
    3333    /** @var CachedData */
    3434    private $_store;
    35    
     35
    3636    public function __construct()
    3737    {
     
    7373        $this->configuration->clearConfig();
    7474    }
    75    
     75
    7676    /**
    7777     * Get CachedData
     
    8181    public function getStore()
    8282    {
    83        
    8483        return $this->_store;
    8584    }
  • xcoobee/trunk/includes/sdk/test/src/XcooBee/Core/Api/ConsentsTest.php

    r2126380 r2212575  
    123123    }
    124124
    125     public function testListConsents()
     125    public function testListConsents_WithoutFilters()
    126126    {
    127127        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     
    133133            ->method('_request')
    134134            ->will($this->returnCallback(function ($query, $params) {
    135                 $this->assertEquals(['statuses' => null, 'userId' => 'testUser', 'first' => true, 'after' => null], $params);
     135                $this->assertEquals(['userId' => 'testUser', 'first' => true, 'after' => null], $params);
    136136            }));
    137137
     
    142142     * @expectedException \XcooBee\Exception\XcooBeeException
    143143     */
     144    public function testListConsents_invalidDateFrom()
     145    {
     146        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     147            '_request' => true,
     148            '_getPageSize' => true,
     149            '_getUserId' => 'testUser'
     150        ]);
     151
     152        $consentsMock->listConsents(['dateFrom' => 'invalid_date']);
     153    }
     154
     155    /**
     156     * @expectedException \XcooBee\Exception\XcooBeeException
     157     */
     158    public function testListConsents_invalidDateTo()
     159    {
     160        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     161            '_request' => true,
     162            '_getPageSize' => true,
     163            '_getUserId' => 'testUser'
     164        ]);
     165
     166        $consentsMock->listConsents(['dateTo' => 'invalid_date']);
     167    }
     168
     169    /**
     170     * @expectedException \XcooBee\Exception\XcooBeeException
     171     */
    144172    public function testListConsents_invalidStatus()
    145173    {
    146174        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
    147175            '_request' => true,
     176            '_getPageSize' => true,
    148177            '_getUserId' => 'testUser'
    149178        ]);
    150179
    151         $consentsMock->listConsents(['testStatus']);
    152     }
    153 
    154     public function testListConsents_withStatus()
    155     {
    156         $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
    157             '_request' => true,
    158             '_getConsentStatus' => 'testStatus',
     180        $consentsMock->listConsents(['statuses' => ['testStatus']]);
     181    }
     182
     183    /**
     184     * @expectedException \XcooBee\Exception\XcooBeeException
     185     */
     186    public function testListConsents_invalidConsentType()
     187    {
     188        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     189            '_request' => true,
     190            '_getPageSize' => true,
     191            '_getUserId' => 'testUser'
     192        ]);
     193
     194        $consentsMock->listConsents(['consentTypes' => ['testType']]);
     195    }
     196
     197    /**
     198     * @expectedException \XcooBee\Exception\XcooBeeException
     199     */
     200    public function testListConsents_invalidDataType()
     201    {
     202        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     203            '_request' => true,
     204            '_getPageSize' => true,
     205            '_getUserId' => 'testUser'
     206        ]);
     207
     208        $consentsMock->listConsents(['dataTypes' => ['testType']]);
     209    }
     210
     211    public function testListConsents_withFilters()
     212    {
     213        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     214            '_request' => true,
    159215            '_getUserId' => 'testUser',
    160216            '_getPageSize' => true,
     
    163219            ->method('_request')
    164220            ->will($this->returnCallback(function ($query, $params) {
    165                 $this->assertEquals(['statuses' => ['testStatus'], 'userId' => 'testUser', 'first' => true, 'after' => null], $params);
    166             }));
    167 
    168         $consentsMock->listConsents(['testStatus']);
    169     }
    170 
    171     public function testListConsents__UseConfig()
    172     {
    173         $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
    174             '_request' => true,
    175             '_getUserId' => 'testUser',
    176             '_getPageSize' => true,
    177         ]);
    178         $consentsMock->expects($this->once())
    179             ->method('_request')
    180             ->will($this->returnCallback(function ($query, $params, $config) {
    181                 $this->assertEquals(['statuses' => null, 'userId' => 'testUser', 'first' => true, 'after' => null], $params);
    182                 $this->assertEquals(['apiKey' => 'testapikey', 'apiSecret' => 'testapisecret'], $config);
    183             }));
    184 
    185         $consentsMock->listConsents([], [
    186             'apiKey' => 'testapikey',
    187             'apiSecret' => 'testapisecret'
     221                $this->assertEquals([
     222                    'search'        => 'Cool',
     223                    'country'       => 'US',
     224                    'province'      => 'California',
     225                    'city'          => 'Los Angeles',
     226                    'dateFrom'      => '2019-01-01',
     227                    'dateTo'        => '2019-12-31',
     228                    'statuses'      => ['expired', 'rejected'],
     229                    'consentTypes'  => ['perform_contract', 'perform_a_service'],
     230                    'dataTypes'     => ['first_name', 'middle_name', 'last_name'],
     231                    'userId'        => 'testUser',
     232                    'first'         => true,
     233                    'after'         => null,
     234                ], $params);
     235            }));
     236
     237        $consentsMock->listConsents([
     238            'search'        => 'Cool',
     239            'country'       => 'US',
     240            'province'      => 'California',
     241            'city'          => 'Los Angeles',
     242            'dateFrom'      => '2019-01-01',
     243            'dateTo'        => '2019-12-31',
     244            'statuses'      => ['expired', 'rejected'],
     245            'consentTypes'  => ['perform_contract', 'perform_a_service'],
     246            'dataTypes'     => ['first_name', 'middle_name', 'last_name'],
    188247        ]);
    189248    }
     
    639698                200,
    640699                (object) [
    641                     'data_package' => (object) [
    642                         'data' => 'encrypted data package'
     700                    'data_package' => [
     701                        (object) [
     702                            'data' => 'encrypted data package'
     703                        ]
    643704                    ]
    644705                ]
     
    656717
    657718        $response = $consentsMock->getDataPackage('testConsentId');
    658         $this->assertEquals('{"test": true}', $response->result->data_package->data);
     719        $this->assertEquals('{"test": true}', $response->result->data_package[0]->data);
    659720    }
    660721
     
    665726                200,
    666727                (object) [
    667                     'data_package' => (object) [
    668                         'data' => 'encrypted data package'
     728                    'data_package' => [
     729                        (object) [
     730                            'data' => 'encrypted data package'
     731                        ]
    669732                    ]
    670733                ]
     
    682745
    683746        $response = $consentsMock->getDataPackage('testConsentId');
    684         $this->assertEquals('encrypted data package', $response->result->data_package->data);
     747        $this->assertEquals('encrypted data package', $response->result->data_package[0]->data);
    685748    }
    686749
     
    691754                200,
    692755                (object) [
    693                     'data_package' => (object) [
    694                         'data' => 'encrypted data package'
     756                    'data_package' => [
     757                        (object) [
     758                            'data' => 'encrypted data package'
     759                        ],
    695760                    ]
    696761                ]
     
    708773
    709774        $response = $consentsMock->getDataPackage('testConsentId');
    710         $this->assertEquals('encrypted data package', $response->result->data_package->data);
     775        $this->assertEquals('encrypted data package', $response->result->data_package[0]->data);
    711776    }
    712777
     
    742807        $this->assertEquals(null, $consentsMock->getCampaignIdByRef("testRef")->result);
    743808    }
     809
     810    public function testShareConsents()
     811    {
     812        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     813            '_request' => $this->_createResponse(200, true)
     814        ]);
     815        $consentsMock->expects($this->once())
     816            ->method('_request')
     817            ->will($this->returnCallback(function ($query, $params, $config) {
     818                $this->assertEquals([
     819                    'config' => [
     820                        'campaign_reference' => 'campaignRef',
     821                        'campaign_cursor' => 'campaignId',
     822                        'consent_cursors' => [],
     823                    ]
     824                ], $params);
     825            }));
     826
     827        $consentsMock->shareConsents('campaignRef', 'campaignId');
     828    }
     829
     830    /**
     831     * @expectedException \XcooBee\Exception\XcooBeeException
     832     */
     833    public function testShareConsents_InvalidArguments()
     834    {
     835        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, []);
     836        $consentsMock->shareConsents('campaignRef');
     837    }
     838
     839    public function testDontSellData()
     840    {
     841        $consentsMock = $this->_getMock(\XcooBee\Core\Api\Consents::class, [
     842            '_request' => $this->_createResponse(200, true),
     843        ]);
     844        $consentsMock->expects($this->once())
     845            ->method('_request')
     846            ->will($this->returnCallback(function ($query, $params) {
     847                $this->assertEquals(['email' => 'test@test.email'], $params);
     848            }));
     849
     850        $consentsMock->dontSellData('test@test.email');
     851    }
    744852}
  • xcoobee/trunk/includes/sdk/test/src/XcooBee/Core/Api/UsersTest.php

    r2126380 r2212575  
    1515        ]);
    1616        $usersMock->expects($this->once())
    17                 ->method('_request')
    18                 ->will($this->returnCallback(function ($query, $params) {
    19                             $this->assertEquals(['first' => true, 'after' => null, 'userId' => 'testuserId'], $params);
    20                         }));
     17            ->method('_request')
     18            ->will($this->returnCallback(function ($query, $params) {
     19                $this->assertEquals(['first' => true, 'after' => null, 'userId' => 'testuserId'], $params);
     20            }));
    2121
    2222        $usersMock->getConversation('testuserId');
     
    3030        ]);
    3131        $usersMock->expects($this->once())
    32                 ->method('_request')
    33                 ->will($this->returnCallback(function ($query, $params, $config) {
    34                             $this->assertEquals(['first' => true, 'after' => null, 'userId' => 'testuserId'], $params);
    35                             $this->assertEquals(['apiKey' => 'testapikey', 'apiSecret' => 'testapisecret'], $config);
    36                         }));
     32            ->method('_request')
     33            ->will($this->returnCallback(function ($query, $params, $config) {
     34                $this->assertEquals(['first' => true, 'after' => null, 'userId' => 'testuserId'], $params);
     35                $this->assertEquals(['apiKey' => 'testapikey', 'apiSecret' => 'testapisecret'], $config);
     36            }));
    3737
    3838        $usersMock->getConversation('testuserId', [
     
    176176            ->will($this->returnCallback(function ($query, $params) {
    177177                $this->assertEquals(['config' => [
    178                         'message' => 'test message',
    179                         'reference_cursor' => 'testconsentId',
    180                         'note_type' => 'consent',
    181                         'user_cursor' => 'testuserID',
    182                     ]], $params);
     178                    'message' => 'test message',
     179                    'reference_cursor' => 'testconsentId',
     180                    'note_type' => 'consent',
     181                    'user_cursor' => 'testuserID',
     182                ]], $params);
    183183            }));
    184184
     
    197197            ->will($this->returnCallback(function ($query, $params) {
    198198                $this->assertEquals(['config' => [
    199                         'message' => 'test message',
    200                         'reference_cursor' => 'testTicketId',
    201                         'note_type' => 'ticket',
    202                         'user_cursor' => 'testuserID',
    203                     ]], $params);
     199                    'message' => 'test message',
     200                    'reference_cursor' => 'testTicketId',
     201                    'note_type' => 'ticket',
     202                    'user_cursor' => 'testuserID',
     203                ]], $params);
    204204            }));
    205205
  • xcoobee/trunk/includes/sdk/test/src/XcooBee/Store/CachedDataTest.php

    r2126380 r2212575  
    2222    }
    2323
     24    public function testSetStore_StoreIsNull()
     25    {
     26        $store = new Store();
     27        $this->assertEquals(null, $store->getStore('key'));
     28    }
     29
    2430    public function testGetStore()
    2531    {
     
    2733        Store::getInstance()->setStore('key', 'value');
    2834        $this->assertEquals('value', Store::getInstance()->getStore('key'));
     35    }
     36
     37    public function testGetStore_StoreIsNull()
     38    {
     39        $store = new Store();
     40        $this->assertEquals(null, $store->getStore('key', 'value'));
    2941    }
    3042
     
    3951        $this->assertNull(Store::getInstance()->getStore('key2'));
    4052    }
     53
     54    public function testClearStore_StoreIsNull()
     55    {
     56        $store = new Store();
     57        $this->assertEquals(null, $store->getStore('key', 'value'));
     58        $this->assertEquals(null, $store->getStore('key'));
     59    }
    4160}
  • xcoobee/trunk/readme.txt

    r2183457 r2212575  
    33Tags: xcoobee, privacy, cookie, gdpr, ccpa, consent, security
    44Requires at least: 4.4.0
    5 Tested up to: 5.2.4
    6 Stable tag: 1.6.4
     5Tested up to: 5.3.0
     6Stable tag: 1.6.5
    77License: GPLv3
    88License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • xcoobee/trunk/xcoobee.php

    r2183457 r2212575  
    55 * Author URI:  https://www.xcoobee.com/
    66 * Description: Connects your website to the XcooBee privacy network and enables secure password recovery and login. Base library for XcooBee GDPR and CCPA Add-ons.
    7  * Version:     1.6.4
     7 * Version:     1.6.5
    88 * Author:      XcooBee
    99 * License:     GPLv3
     
    1414 *
    1515 * Requires at least: 4.4.0
    16  * Tested up to: 5.2.4
     16 * Tested up to: 5.3.0
    1717 *
    1818 * @package XcooBee
Note: See TracChangeset for help on using the changeset viewer.