be-lenka/fhb-kika-api-client 问题修复 & 功能扩展

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

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

be-lenka/fhb-kika-api-client

最新稳定版本:v1.1.0

Composer 安装命令:

composer require be-lenka/fhb-kika-api-client

包简介

Library for accessing Kika API v3 of FHB Fulfillment

README 文档

README

Full API docs available at: https://kikaapi3.docs.apiary.io/#

Production API URL: https://api.fhb.sk/v3

Development API URL: https://api-dev.fhb.sk/v3

Library for API v3

Usage:

<?php

const API_ID  = '5275fe3ca57307bf8cecfb7b08a447c0';
const SECRET = 'ErYFgUCXWJeINyc89066ed90kcwr28ceta8s1t4a';
const ENDPOINT = 'https://api-dev.fhb.sk/v3';

$api = new belenka\FHB\Kika\ApiClient\RestApi(API_ID, SECRET);
$api->setEndpoint(ENDPOINT);

Products

$products = new belenka\FHB\Kika\ApiClient\Products($api);
$uniqueId = '123456';

$data = array(
	'id' => $uniqueId,
	'name' => 'Shampoo',
	'ean' => '8580000001234',
	'photoUrl' => 'http://example.com/image.png',
	'notifyLink' => '"http://example.com/api/product/123/notify',
	'customs_information'=>[
	    'hs_code'=>'00112233',
	    'country_of_origin' => 'SK',
	    'purchase_price' => 23.50
	]
);

try {

	//create
	$result = $products->create($data);
	echo '<pre>';
	print_r($result);
	echo '</pre>';

	//update
	$data['name'] = 'Šampón updated';
	$result = $products->update($uniqueId, $data);
	echo '<pre>';
	print_r($result);
	echo '</pre>';

	//read
	$result = $products->read($uniqueId);
	echo '<pre>';
	print_r($result);
	echo '</pre>';

	//readAll
	$result = $products->readAll();
	echo '<pre>';
	print_r($result);
	echo '</pre>';


} catch (Kika\ApiClient\RestApiException $e) {
	die($e->getMessage());
}

Orders

$orders = new belenka\FHB\Kika\ApiClient\Orders($api);

$uniqueId = '123456';

$data = array(
	'id' => $uniqueId,
	'variable_symbol =>'12345',
	'parcel_service'=> 'dpd',
	'delivery_point'=>'1234',
	'cod'=>22.50,
	'value'=> 22.50,
	'recipient'=>[
		'address'=>[
			'name'=>'john doe',
			'street'=>'Main street 1',
			'city'=>'New City',
			'zip'=>'12345',
			'province'=>'South',
			'country'=>'SK'
		],
		'contact'=[
			'email'=>'info@example.com',
			'phone'=>'421901234567'
		]
	],
	'items'=>[
		[
			'id'=>1234,
			'quantity'=> 2
		]
	],
	'notification'=>[
		'confirmed'=>'http://localhost',
		'sent'=>'http://localhost',
		'delivered'=>'http://localhost',
		'returned'=>'http://localhost',
		'ticket_created'=>'http://localhost',
		'ticket_updated'=>'http://localhost',
		'ticket_closed'=>'http://localhost',
	],
	'invoice'=>'http://localhost/file.pdf',
	'note' => 'no comment',
	'note_delivery' => 'no comment',
	'invoice_detail' => [
		'number'=>'INV0001',
		'total'=>22.50,
		'currency'=>'EUR',
		'date_of_issue'=>'2023-01-02',
		'products'=>[
			[
				'code'=> 123,
				'description' =>'socks white 38',
				'hs_code'=>112233,
				'value'=>12.50,
				'quantity'=>1,
				'country_of_origin'=>'SK'
			]
		],
		'fees'=>[
			[
				'type'=>'discount|shipping|other',
				'description'=>'Shipping Fee',
				'value'=>1.3
			]
		]
	]
	
);


try {

	//create
	$result = $orders->create($data);
	echo '<pre>';
	print_r($result);
	echo '</pre>';

	//update
	$data['name'] = 'Martin Novák updated';
	$result = $orders->update($uniqueId, $data);
	echo '<pre>';
	print_r($result);
	echo '</pre>';

	//read
	$result = $orders->read($uniqueId);
	echo '<pre>';
	print_r($result);
	echo '</pre>';

	//anonymization
	$result = $orders->anonymization($uniqueId);
	echo '<pre>';
	print_r($result);
	echo '</pre>';

	//delete
	$result = $orders->delete($uniqueId);
	echo '<pre>';
	print_r($result);
	echo '</pre>';


} catch (RestApiException $e) {
	die($e->getMessage());
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-10