ljpc/jumboextras

与 Jumbo 服务器通信

1.0.2 2020-02-10 08:14 UTC

This package is auto-updated.

Last update: 2024-09-10 19:12:55 UTC


README

此 API 的目的是做与 Jumbo Extra 的 API 相同的事情。

安装

使用 composer 将此仓库包含到您的项目中

composer require ljpc/jumboextras

身份验证

身份验证相当简单。

使用用户名/密码

$jumboExtraInstance = new \LJPc\JumboExtras\Calls\JumboExtras();
$jumboExtraInstance->login($username, $password);

使用访问令牌/刷新令牌

$jumboExtraInstance = new \LJPc\JumboExtras\Calls\JumboExtras();
$jumboExtraInstance::setAccessToken($accessToken);
$jumboExtraInstance::setRefreshToken($refreshToken);

刷新访问令牌

$jumboExtraInstance->refreshToken();

获取余额

调用

$balance = $jumboExtraInstance->getBalance();

返回

{
    "balance": 123,
    "cardId": "2622274330410"
}

获取储蓄优惠

调用

$savingOffers = $jumboExtraInstance->getSavingOffers();

返回

[
    ...
    {
        "id": "1500000168",
        "promotionType": "GENERAL",
        "points": 35,
        "spendType": "UNIT",
        "minimumSpent": 1,
        "incentiveVersion": "PRODUCT_EARN",
        "image": "https:\/\/www.jumbo.com\/dam\/extra\/instore\/p2\/Lor_espressocapsules.png",
        "title": "L'or koffiecups",
        "description": "Pak 10 stuks",
        "startDate": "2020-01-29",
        "expirationDate": "2020-02-25"
    },
    ...
]

获取兑换优惠

调用

$redeemOffers = $jumboExtraInstance->getRedeemOffers();

返回

[
    ...
    {
        "id": "1500000190",
        "incentiveVersion": "PRODUCT_BURN",
        "image": "https:\/\/www.jumbo.com\/dam\/extra\/instore\/p2\/Jumbo_cola.png",
        "title": "Jumbo regular, light en zero cola",
        "description": "Fles 1,5L",
        "startDate": "2020-01-29",
        "expirationDate": "2020-02-25",
        "percentageDiscount": 100,
        "burnPointsAmount": 100,
        "buyItemsAmount": 1
    },
    ...
]

获取主页

调用

$homescreen = $jumboExtraInstance->getHomescreen();

返回

[
    {
        "id": "1500000082",
        "incentiveVersion": "MASS_CASH_BURN",
        "image": "https:\/\/www.jumbo.com\/dam\/extra\/alg\/2.50-korting.png",
        "title": "2,50 euro korting",
        "description": "Op je kassabon",
        "startDate": "2019-12-04",
        "expirationDate": "2020-04-28",
        "eurosDiscount": 2.5,
        "extraMoneyAmount": 2.5,
        "burnPointsAmount": 500
    },
    {
        "id": "1500000080",
        "points": 100,
        "spendType": "TRANSACTION",
        "minimumSpent": 3,
        "incentiveVersion": "WELCOME_CONTINUITY",
        "image": "https:\/\/www.jumbo.com\/dam\/extra\/alg\/card-100points.png",
        "title": "Welkomstpunten",
        "description": "Speciaal voor jou",
        "startDate": "2019-12-04",
        "expirationDate": "2020-04-21"
    }
]

获取个人资料

调用

$profile = $jumboExtraInstance->getProfile();

返回

{
    "customerId": "f0a206b9----------------c249e6463f45",
    "name": {
        "familyName": "Jansen",
        "givenName": "Lars"
    },
    "birthDate": "[yyyy-mm-dd]",
    "email": "[HIDDEN]",
    "primaryPhone": {
        "primary": false,
        "typeCode": "Home",
        "countryCode": 31,
        "number": "[HIDDEN]"
    },
    "homeAddress": {
        "country": {
            "code": "NL",
            "name": "Netherlands"
        },
        "city": "[HIDDEN]",
        "postalCode": "[HIDDEN]",
        "street": "[HIDDEN]",
        "number": "[HIDDEN]"
    },
    "avgProfiling": {
        "isAllowed": true
    },
    "termsAndConditions": {
        "accepted": true
    },
    "checkoutPreferences": {
        "purchaseStamps": false,
        "promotionStamps": false,
        "printReceipt": false
    },
    "storePreferences": {
        "complexNumber": "[HIDDEN]",
        "name": "[HIDDEN]",
        "city": "[HIDDEN]"
    },
    "loyaltyCard": {
        "number": "2622274330410"
    }
}

更新个人资料

调用

$jumboExtraInstance->updateProfile( bool $purchaseStamps, bool $promotionStamps, bool $printReceipt );

返回

true