定制 selltag/nacex-bundle 二次开发

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

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

selltag/nacex-bundle

Composer 安装命令:

composer require selltag/nacex-bundle

包简介

This module provides a client service for the Nacex SOAP server

README 文档

README

Build Status

This Bundle provides a client to access the Nacex SOAP API.

Installation

  1. Download the Bundle

    Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

    $ composer require selltag/nacex-bundle

    This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

  2. Enable the Bundle

    Add the following line in the app/AppKernel.php file to enable this bundle:

    <?php
    // app/AppKernel.php
    
    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            $bundles = array(
                // ...
    
                new Selltag\NacexBundle\SelltagNacexBundle()
    
                // ...
            )
    
            return $bundles;
        }
    
        // ...
    }
  3. Enable the nacex service adding the following configuration:

    # app/config/config.yml
    selltag_nacex:
        nacex_password: %nacex_username%
        nacex_password: %nacex_password%
        nacex_url: %nacex_url%
  4. You can define these parameters in your parameters.yml:

    # app/config/parameters.yml.dist
    nacex_username: MYUSERNAME
    nacex_password: MYPASSWORD
    nacex_url: http://gprs.nacex.com/nacex_ws/soap

Tests

You can run the tests using:

phpunit

I couldn't make tests for the NacexClient class because I don't have credentials anymore and I can't get a response soap to use as reference. If you find any errors, you can send me the SOAP response so I could also make tests for that part, thank you!

Use example on Symfony

$nacexClient = $this->getContainer()
    ->get('selltag_nacex.nacex_client');

$data = array(
    'reco_codigo' => null,
    'Del_Sol'     => '0001',
    'Num_Rec'     => '123456',
    'ref'         => null
);

$result = $nacexClient->putRecogida($data);

$recogida = array(
    'code'        => $result[0],
    'date'        => $result[1],
    'time'        => $result[2],
    'observation' => $result[3],
    'status'      => $result[4],
    'status_code' => $result[5]
);

Use example without using Symfony

use Selltag\NacexBundle\Services\NacexClientService;

$nacexClient = new NacexClientService(
    $nacexUser,
    $nacexPassword,
    $nacexUrl
);

$data = array(
    'reco_codigo' => null,
    'Del_Sol'     => '0001',
    'Num_Rec'     => '123456',
    'ref'         => null
);

$result = $nacexClient->putRecogida($data);

$recogida = array(
    'code'        => $result[0],
    'date'        => $result[1],
    'time'        => $result[2],
    'observation' => $result[3],
    'status'      => $result[4],
    'status_code' => $result[5]
);

NacexException

If the Nacex SOAP response returns any errors, a NacexClientException exception is raised, you can treat It accordingly for you project.

use Selltag\NacexBundle\Exceptions\NacexClientException;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-18