定制 deutschepost/sdk-api-oneclickforrefund 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

deutschepost/sdk-api-oneclickforrefund

最新稳定版本:1.3.0

Composer 安装命令:

composer require deutschepost/sdk-api-oneclickforrefund

包简介

Deutsche Post INTERNETMARKE 1C4R API SDK

README 文档

README

The DP OneClickForRefund API SDK package offers an interface to the following web services:

  • OneClickForRefund

Requirements

System Requirements

  • PHP 8.1+ with SOAP extension

Package Requirements

  • psr/log: PSR-3 logger interfaces

Development Package Requirements

  • phpunit/phpunit: Testing framework

Installation

$ composer require deutschepost/sdk-api-oneclickforrefund

Uninstallation

$ composer remove deutschepost/sdk-api-oneclickforrefund

Testing

$ ./vendor/bin/phpunit -c test/phpunit.xml

Features

The DP OneClickForRefund API SDK supports the following features:

  • Cancel vouchers

The web service requires an authentication token. The library retrieves a token but discards it after the process terminates. In order to reuse the token, a persistent storage can be passed in (Persist Authentication Token).

Cancel Vouchers

Submit a return for INTERNETMARKE stamps.

Public API

The library's components suitable for consumption comprise

  • services:
    • service factory
    • refund service
  • data transfer objects:
    • credentials

Usage

$shopOrderId = '1234567890';
$voucherIds = ['A0031C630F0000000135', 'A0031C630F0000000398'];

$logger = new \Psr\Log\Test\TestLogger();
$tokenStorage = new \DeutschePost\Sdk\OneClickForRefund\Auth\TokenStorage();
$credentials = new \DeutschePost\Sdk\OneClickForRefund\Auth\Credentials(
    $username = 'max.mustermann@example.com',
    $password = 'portokasse321',
    $partnerId = 'PARTNER_ID',
    $partnerKey = 'SCHLUESSEL_DPWN_MEINMARKTPLATZ',
    $keyPhase = 1,
    $tokenStorage
);

$serviceFactory = new \DeutschePost\Sdk\OneClickForRefund\Service\ServiceFactory();
$service = $serviceFactory->createRefundService($credentials, $logger);

// cancel all the original order's vouchers OR
$service->cancelVouchers($shopOrderId);

// cancel some of the original order's vouchers
$service->cancelVouchers($shopOrderId, $voucherIds);

Persist Authentication Token

To reuse a token during its lifetime, the credentials object can be created with a custom token storage. Implement access to a database, cache, or any other suitable source.

Usage

// PersistentTokenStorage implements \DeutschePost\Sdk\OneClickForRefund\Api\TokenStorageInterface
$tokenStorage = new \My\OneClickForRefund\Auth\PersistentTokenStorage();
$credentials = new \DeutschePost\Sdk\OneClickForRefund\Auth\Credentials(
    $username = 'max.mustermann@example.com',
    $password = 'portokasse321',
    $partnerId = 'PARTNER_ID',
    $partnerKey = 'SCHLUESSEL_DPWN_MEINMARKTPLATZ',
    $keyPhase = 1,
    $tokenStorage
);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-26