Closed Dakror closed 6 years ago
as this sdk is not fully up2date with the latest ebay api versions, in your case you should use business-policies anyway. you specify policies/profiles for return, shipping and payment and within your calls (revise,add) you just add the profile-id instead of every single field.
david said he is going to build some new stuff based on openapi, but i don´t know his plans for the trading api 😕
Didn't know about that feature, thanks! Very useful. Cheers :)
Another solution is to redefine several classes but a lot of them (DTS\eBaySDK\Trading\Services\TradingService, DTS\eBaySDK\Trading\Types\ReviseItemRequestType, DTS\eBaySDK\Trading\Types\VerifyAddFixedPriceItemRequestType, DTS\eBaySDK\Trading\Types\AddFixedPriceItemRequestType, \DTS\eBaySDK\Types\ItemType, \DTS\eBaySDK\Types\ReturnPolicyType)
Or make own fork this is better )
these files are generated, making any pushes here is useless. this project is dead since a long time, i really don´t understand, why people invest any time here. be smart and create your own stuff, then you don´t need to write at issues that are years old. i started myself and it´s not that complicated, because there are great code-generators out there: https://github.com/michabbb/php-ebay-sdk
Dirty hack with overriding, but works.
in composer.json
"exclude-from-classmap": [
"vendor\\dts\\ebay-sdk-php\\src\\MerchantData\\Types\\ReturnPolicyType.php"
],
"psr-4": {
"DTS\\eBaySDK\\": "core/Packages/dts"
}
Than create file with path /core/Packages/dts/eBaySdk/MerchantData/Types/ReturnPolicyType.php
(core/Packages) - replace it with your path
<?php
namespace DTS\eBaySDK\MerchantData\Types;
/**
*
* @property string $RefundOption
* @property string $Refund
* @property string $ReturnsWithinOption
* @property string $ReturnsWithin
* @property string $ReturnsAcceptedOption
* @property string $ReturnsAccepted
* @property string $InternationalReturnsAcceptedOption
* @property string $InternationalRefundOption
* @property string $InternationalReturnsWithinOption
* @property string $InternationalShippingCostPaidByOption
* @property string $Description
* @property string $WarrantyOfferedOption
* @property string $WarrantyOffered
* @property string $WarrantyTypeOption
* @property string $WarrantyType
* @property string $WarrantyDurationOption
* @property string $WarrantyDuration
* @property string $EAN
* @property string $ShippingCostPaidByOption
* @property string $ShippingCostPaidBy
* @property string $RestockingFeeValue
* @property string $RestockingFeeValueOption
* @property boolean $ExtendedHolidayReturns
*/
class ReturnPolicyType extends \DTS\eBaySDK\Types\BaseType
{
/**
* @var array Properties belonging to objects of this class.
*/
private static $propertyTypes = [
'RefundOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'RefundOption'
],
'Refund' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'Refund'
],
'ReturnsWithinOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ReturnsWithinOption'
],
'ReturnsWithin' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ReturnsWithin'
],
'ReturnsAcceptedOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ReturnsAcceptedOption'
],
'ReturnsAccepted' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ReturnsAccepted'
],
'InternationalReturnsAcceptedOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'InternationalReturnsAcceptedOption'
],
'InternationalRefundOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'InternationalRefundOption'
],
'InternationalReturnsWithinOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'InternationalReturnsWithinOption'
],
'InternationalShippingCostPaidByOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'InternationalShippingCostPaidByOption'
],
'Description' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'Description'
],
'WarrantyOfferedOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'WarrantyOfferedOption'
],
'WarrantyOffered' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'WarrantyOffered'
],
'WarrantyTypeOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'WarrantyTypeOption'
],
'WarrantyType' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'WarrantyType'
],
'WarrantyDurationOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'WarrantyDurationOption'
],
'WarrantyDuration' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'WarrantyDuration'
],
'EAN' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'EAN'
],
'ShippingCostPaidByOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ShippingCostPaidByOption'
],
'ShippingCostPaidBy' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ShippingCostPaidBy'
],
'RestockingFeeValue' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'RestockingFeeValue'
],
'RestockingFeeValueOption' => [
'type' => 'string',
'repeatable' => false,
'attribute' => false,
'elementName' => 'RestockingFeeValueOption'
],
'ExtendedHolidayReturns' => [
'type' => 'boolean',
'repeatable' => false,
'attribute' => false,
'elementName' => 'ExtendedHolidayReturns'
]
];
/**
* @param array $values Optional properties and values to assign to the object.
*/
public function __construct(array $values = [])
{
list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
parent::__construct($parentValues);
if (!array_key_exists(__CLASS__, self::$properties)) {
self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
}
if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
self::$xmlNamespaces[__CLASS__] = 'xmlns="urn:ebay:apis:eBLBaseComponents"';
}
$this->setValues(__CLASS__, $childValues);
}
}
now you can use it
$item->ReturnPolicy->InternationalReturnsAcceptedOption = ReturnsAcceptedOptionsCodeType::C_RETURNS_ACCEPTED;
$item->ReturnPolicy->InternationalRefundOption = RefundOptionsCodeType::C_MONEY_BACK;
$item->ReturnPolicy->InternationalReturnsWithinOption = ReturnsWithinOptionsCodeType::C_DAYS_30;
$item->ReturnPolicy->InternationalShippingCostPaidByOption = ShippingCostPaidByOptionsCodeType::C_BUYER;
Any better options?
@progsmile everything is better than hacks and sticking to a long-dead project. there are great code generators out there. instead of getting independent of a dead project and use generators, people are still hacking around - so sad. if you are a php developer, get some guts and try your own stuff.
the comments on this project will probably still amuse me for the next few years 😁
use this and chose which API you want: https://sdk.intradesys.com/ebay_api_sdk_online_generator
@michabbb have so many stuff to rewrite, done with that
@progsmile I hear ya on this. I use David's SDK for 2 years. works great with some fixes now and then. but I'm looking into what @michabbb recomomended and what I know for sure works: https://sdk.intradesys.com/ebay_api_sdk_online_generator
the guys behind https://github.com/WsdlToPhp/PackageGenerator
really care. they even contacted me personally and asked me, if i have any problems with ebay and they offered help, in case i would.
but everything is working like a charm !
AddItem / AddFixedPriceItem supports specification of international return handling, but this is not represented in the SDK
https://developer.ebay.com/devzone/xml/docs/reference/ebay/AddFixedPriceItem.html#Request.Item.ReturnPolicy.InternationalReturnsAcceptedOption
Could you please provide these attributes or guide me towards a simple solution for myself?