uru/digital-river-models 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

uru/digital-river-models

最新稳定版本:1.1.4

Composer 安装命令:

composer require uru/digital-river-models

包简介

Models for Digital River/ MyCommerce integrations

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Models for Digital River/ MyCommerce integrations

Описание API - https://api.shareit.com/HelpShareit/index.html

Установка

composer require uru/digital-river-models

Использование

Модель для добавления или обновление продукта:

        $data = new Product();
        $data->setVendorId($vendorId);
        $data->setProductCode($productCode);
        $data->setName($fullName);
        $data->setProductType((new ProductTypeEnum(ProductTypeEnum::NMP)));
        $data->setStatus((new ProductStatusEnum(ProductStatusEnum::NSE)));
        $data->setDefaultCurrency(self::DEFAULT_CURRENCY);

        $priceScale = new PriceScale();
        $priceScale->setQuantityFrom(1);

        $price = new Price();
        $price->setCurrency(self::DEFAULT_CURRENCY);
        $price->setPrice($price);

        $priceScale->setPrices([$price]);
        $data->setPriceScale([$priceScale]);

        $productDescriptions = new ProductDescriptions();
        $productDescriptions->setLanguage('en');
        $productDescriptions->setDisplayName($fullName);
        $productDescriptions->setShortDescription($description);
        $productDescriptions->setFullDescription($fullDescription);

        $data->setDescriptions([$productDescriptions]);

        $exportRegulation = new ExportRegulations();
        $exportRegulation->setECCN((new ECCNIdEnum(ECCNIdEnum::EAR99)));
        $exportRegulation->setCountryOfOrigin('ru');
        if (!$licenseIsRequire) {
            $exportRegulation->setLicenseException((new LicenseExceptionsEnum(LicenseExceptionsEnum::NLR)));
        }
        $data->setExportRegulations($exportRegulation);

        $deliveryItems = new ProductDelivery();
        $deliveryItems->setDeliveryType((new DeliveryTypeEnum(DeliveryTypeEnum::EL5_KEY_INL)));
        $deliveryItems->setLicenseKeyDefinition((new LicenseKey($url)));

        $data->setProductDelivery([$deliveryItems]);
        
        // output to curl
        echo json_encode($data);

Модель корзины

        $data = new Cart();
        $items = [];


        foreach ($basket as $basketItem) {
  
        $item = new CartItem();
        $item->setProductId($product_id);
        $item->setQuantity((int)$basketItem->getQuantity());
        $item->setVendorId((int)$basketItem->vendor_id);
        $item->addAdditionals(["name" => static::ADDITIONAL_BASKET_ITEM_FIELD, "value" => $basketItem->getId(), "hidden" => true]);
        // optional dinamic price
        $dyn_price = $basketItem->getPrice() . self::DEFAULT_CURRENCY . ",N";
        $item->setDynPrice($dyn_price, $dyn_price_pass);

        $items[] = $item;
        }

        $data->setItems($items);

        $address = new Address();
        $address->setFirstName($user['NAME']);
        $address->setLastName($user['LAST_NAME']);
        $address->setCompany($user->getCompanyName());
        $address->setAddress($user->getBillingAddressFull());
        $address->setPostalCode($user->getBillingAddressCode());
        $address->setCity($user->getBillingAddressCity());
        $address->setEmail($user->getEmail());
        $address->setCountry($user->countryCode());

        $data->setBillingAddress($address);

        $address->setCountry($user->countryCode());
        $address->setAddress($user->getDeliveryAddressFull());
        $address->setPostalCode($user->getDeliveryAddressCode());
        $address->setCity($user->getDeliveryAddressCity());

        $data->setShippingAddress($address);

        $dr_shopper_id = $user->findDigitalRiverShopperId();
        if ($dr_shopper_id) {
            $data->setShopperId($dr_shopper_id);
        }

        $data->setDisplayCurrency(self::DEFAULT_CURRENCY);
        $data->setProtect('all');
        $data->setFinalPageUrl($url);

        // output to curl
        echo json_encode($data);

Модель для создание подписок в продукте

        ...
        $subscription = new Subscription();
        $subscription->setIntervalId(new IntervalIdEnum(IntervalIdEnum::YEA));
        
        $priceScale = new PriceScale();
        $priceScale->setQuantityFrom(1);

        $price = new Price();
        $price->setCurrency(self::DEFAULT_CURRENCY);
        $price->setPrice($price);

        $priceScale->setPrices([$price]);
        $subscription->setRenewalPriceScale([$priceScale]);
        
        $data->setSubscription($subscription);
        ...

统计信息

  • 总下载量: 6.1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固