承接 idci/sam-client-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

idci/sam-client-bundle

Composer 安装命令:

composer require idci/sam-client-bundle

包简介

Symfony bundle that provides an api client for SAM app (SAVInsight)

README 文档

README

Symfony bundle that provides an api client for SAM app (SAVInsight)

Installation

Install this bundle using composer :

composer require idci/sam-client-bundle

Configuration

Create an Eightpoint Guzzle HTTP client

In the file config/packages/eight_points_guzzle.yaml, create a SAM API client :

eight_points_guzzle:
    clients:
        sam_api:
            base_url: 'https://sam-staging.savinsight.com/api/' # PROD = 'https://sam.savinsight.com/api/'

Configure a cache pool

Create a dedicated SAM cache, or use any of your existing pools :

In the file config/services.yaml, register your cache pool :

# Redis example
app.cache.adapter.redis.sam:
    parent: 'cache.adapter.redis'
    tags:
        - { name: 'cache.pool', namespace: 'SAM' }

In the file config/packages/cache.yaml, define your cache pool :

framework:
    cache:
        # ...
        pools:
            cache.sam:
                public: true

Configure sam-client-bundle

In config/packages/, create a idci_sam_client.yaml file :

idci_sam_client:
    guzzle_http_client_service_alias: 'eight_points_guzzle.client.sam_api'
    cache_pool_service_alias: 'cache.sam'
    client_id: '%env(string:IDCI_SAM_CLIENT_ID)%'
    client_secret: '%env(string:IDCI_SAM_CLIENT_SECRET)%'
    mode: '%env(string:IDCI_SAM_MODE)%'

Required parameters:

  • guzzle_http_client_service_alias : The guzzle HTTP client alias
  • client_id : The SAM client ID
  • client_secret : The SAM client secret
  • mode: live or staging

Then, add these environment variable in your .env file :

###> idci/sam-client-bundle ###
IDCI_SAM_CLIENT_ID=Y2xpZW50X2lk...
IDCI_SAM_CLIENT_SECRET=Y2xpZW50X3NlY3JldA==...
IDCI_SAM_MODE=live
###< idci/sam-client-bundle ###

To retrieve more informations about SAM API, go to https://sam-staging.savinsight.com/swagger/index.html.

Usage

Activity methods

Create activity

use IDCI\Bundle\SAMClientBundle\Client\SAMApiClient;
...
$this->samApiClient->createActivity(20000, [
    'date' => new \DateTime,
    'employeeCode' => 'JeanDupont',
]);

$this->samApiClient->createActivityByInternalNumber('internalNumber', [
    'date' => new \DateTime,
    'employeeCode' => 'JeanDupont',
]);

$this->samApiClient->createActivityByExternalId('externalId', [
    'date' => new \DateTime,
    'employeeCode' => 'JeanDupont',
]);
option name type
date DateTimeInterface, string, null
employeeCode string, null

Update activity

use IDCI\Bundle\SAMClientBundle\Client\SAMApiClient;
use IDCI\Bundle\SAMClientBundle\Client\Model\Enum\UpdateActivityInputState;
...
$this->samApiClient->updateActivity(20000, 'A020', [
    'status' => UpdateActivityInputState::Paused,
    'date' => new \DateTime,
    'employeeCode' => 'JeanDupont',
]);

$this->samApiClient->createActivityByInternalNumber('internalNumber', 'A020', [
    'status' => UpdateActivityInputState::Paused,
    'date' => new \DateTime,
    'employeeCode' => 'JeanDupont',
]);

$this->samApiClient->createActivityByExternalId('externalId', 'A020', [
    'status' => UpdateActivityInputState::Paused,
    'date' => new \DateTime,
    'employeeCode' => 'JeanDupont',
]);
option name type
status UpdateActivityInputState
date DateTimeInterface, string, null
employeeCode string, null

Diagnostic methods

Create diagnostic

use IDCI\Bundle\SAMClientBundle\Client\SAMApiClient;
use IDCI\Bundle\SAMClientBundle\Client\Model\Enum\CreateDiagnosticInputWatchStateProductState;
...
$this->samApiClient->createDiagnotic(20000, [
    'date' => new \DateTime,
    'watchStates' => [
        [
            'toPrint' => false,
            'internalComment' => 'Fermoir cassé',
            'materialReference' => 'xxxxxx',
            'productState' => CreateDiagnosticInputWatchStateProductState::Broken,
        ],
    ],
    'operations' => [
        [
            'toPrint' => false,
            'internalComment' => 'Remplacement fermoir',
            'materialReference' => 'xxxxxx',
            'mandatory' => true,
            'main' => false,
            'quantity' => 1.00,
        ],
    ],
]);

$this->samApiClient->createDiagnosticByInternalNumber('internalNumber', [
    'date' => new \DateTime,
    'watchStates' => [
        [
            'toPrint' => false,
            'internalComment' => 'Fermoir cassé',
            'materialReference' => 'xxxxxx',
            'productState' => CreateDiagnosticInputWatchStateProductState::Broken,
        ],
    ],
    'operations' => [
        [
            'toPrint' => false,
            'internalComment' => 'Remplacement fermoir',
            'materialReference' => 'xxxxxx',
            'mandatory' => true,
            'main' => false,
            'quantity' => 1.00,
        ],
    ],
]);

$this->samApiClient->createDiagnosticByExternalId('externalId', [
    'date' => new \DateTime,
    'watchStates' => [
        [
            'toPrint' => false,
            'internalComment' => 'Fermoir cassé',
            'materialReference' => 'xxxxxx',
            'productState' => CreateDiagnosticInputWatchStateProductState::Broken,
        ],
    ],
    'operations' => [
        [
            'toPrint' => false,
            'internalComment' => 'Remplacement fermoir',
            'materialReference' => 'xxxxxx',
            'mandatory' => true,
            'main' => false,
            'quantity' => 1.00,
        ],
    ],
]);
option name type
date DateTimeInterface, string, null
watchStates array, null
operations array, null

Business deal methods

Create business deal

use IDCI\Bundle\SAMClientBundle\Client\SAMApiClient;
...
$this->samApiClient->createBusinessDeal([
    'externalId' => 'externalRef',
    'partnerReference' => 'FR center',
    'brandReference' => 'Brand 002',
    'partnerSiteReference' => 'xxxxx',
    'initialRequestorPartnerSiteReference' => 'xxxxx',
    'initialRequestorPartnerReference' => 'xxxxx',
    'invoicingCode' => '001',
    'internalNumber' => 'internalRef',
    'productNature' => 'Watch',
    'productReference' => 'xxxxx',
    'productSerialNumber' => 'xxxxx'
    'batchReference' => 'xxxxx',
    'movementSerialNumberReference' => 'xxxxx',
    'movementReference' => 'xxxxx',
    'interventionCode' => 'INV',
    'progress' => [
        'receptionDate' => new \DateTime,
        'estimateDate' => null,
        'expectedDeliveryDate' => null,
        'workStartDate' => null,
        'workEndDate' => null,
        'deliveryDate' => null,
        'numberDaysWaitingParts' => 2,
    ],
    'accessCode' => 'trackingCode',
    'quickService' => true,
    'interventionInvoicingCode' => '000',
]);
option name type
externalId* string
partnerReference* string
brandReference* string
partnerSiteReference string, null
initialRequestorPartnerSiteReference string, null
initialRequestorPartnerReference string, null
invoicingCode string, null
internalNumber string, null
productNature string, null
productReference string, null
productSerialNumber string, null
batchReference string, null
movementSerialNumberReference string, null
movementReference string, null
interventionCode string, null
progress BusinessDealProgress, array
accessCode string, null
quickService bool, null
interventionInvoicingCode string, null

Get business deal

use IDCI\Bundle\SAMClientBundle\Client\SAMApiClient;
...
$this->samApiClient->getBusinessDeal(20000);

$this->samApiClient->getBusinessDealByInternalNumber('internalNumber');

$this->samApiClient->getBusinessDealByExternalId('externalId');

$this->samApiClient->getBusinessDealsModifiedSince('2024-12-01');

Update business deal

use IDCI\Bundle\SAMClientBundle\Client\SAMApiClient;
use IDCI\Bundle\SAMClientBundle\Client\Model\Enum\JsonPatchDocumentOperation;
...
$this->samApiClient->updateBusinessDeal(20000, [
    'jsonPatchDocuments' => [
        [
            'op' => JsonPatchDocumentOperation::Add,
            'path' => '',
            'value' => 'new value',
            'from' => '',
        ],
    ],
]);

$this->samApiClient->updateBusinessDealByInternalNumber('internalNumber', [
    'jsonPatchDocuments' => [
        [
            'op' => JsonPatchDocumentOperation::Add,
            'path' => '',
            'value' => 'new value',
            'from' => '',
        ],
    ],
]);

$this->samApiClient->updateBusinessDealByExternalId('externalId', [
    'jsonPatchDocuments' => [
        [
            'op' => JsonPatchDocumentOperation::Add,
            'path' => '',
            'value' => 'new value',
            'from' => '',
        ],
    ],
]);
option name type
jsonPatchDocuments array

Delete business deal

use IDCI\Bundle\SAMClientBundle\Client\SAMApiClient;
...
$this->samApiClient->deleteBusinessDeal(20000);

$this->samApiClient->deleteBusinessDealByInternalNumber('internalNumber');

$this->samApiClient->deleteBusinessDealByExternalId('externalId');

Support

If needed, you can contact Maëva.

idci/sam-client-bundle 适用场景与选型建议

idci/sam-client-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 175 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 idci/sam-client-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 idci/sam-client-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 idci/sam-client-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: CECILL-C
  • 更新时间: 2025-01-03