Closed nikgilbe closed 4 months ago
I have also encountered this issue, what files specifically need to be modified to force it to work?
I must admit I was hacking around a bit, but these are the modified files:
selling-partner-api/src/Seller/ProductFeesV0/Dto
FeesEstimateByIdRequest.php
FeesEstimateRequest.php
GetMyFeesEstimateRequest.php
MoneyType.php
PriceToEstimateFees.php
I've capiltalized every feasible property in these files and I can't force a working response. I'm not sure even exactly where the case mismatch is.
This is the untouched version of FeesEstimateRequest.php
<?php
namespace SellingPartnerApi\Seller\ProductFeesV0\Dto;
use Crescat\SaloonSdkGenerator\BaseDto;
final class FeesEstimateRequest extends BaseDto
{
protected static array $attributeMap = [
'marketplaceId' => 'MarketplaceId',
'priceToEstimateFees' => 'PriceToEstimateFees',
'identifier' => 'Identifier',
'isAmazonFulfilled' => 'IsAmazonFulfilled',
'optionalFulfillmentProgram' => 'OptionalFulfillmentProgram',
];
/**
* @param string $marketplaceId A marketplace identifier.
* @param PriceToEstimateFees $priceToEstimateFees Price information for an item, used to estimate fees.
* @param string $identifier A unique identifier provided by the caller to track this request.
* @param ?bool $isAmazonFulfilled When true, the offer is fulfilled by Amazon.
* @param ?string $optionalFulfillmentProgram An optional enrollment program to return the estimated fees when the offer is fulfilled by Amazon (IsAmazonFulfilled is set to true).
*/
public function __construct(
public readonly string $marketplaceId,
public readonly PriceToEstimateFees $priceToEstimateFees,
public readonly string $identifier,
public readonly ?bool $isAmazonFulfilled = null,
public readonly ?string $optionalFulfillmentProgram = null,
) {
}
}
This is with the changes I made:
<?php
namespace SellingPartnerApi\Seller\ProductFeesV0\Dto;
use Crescat\SaloonSdkGenerator\BaseDto;
final class FeesEstimateRequest extends BaseDto
{
protected static array $attributeMap = [
'MarketplaceId' => 'MarketplaceId',
'PriceToEstimateFees' => 'PriceToEstimateFees',
'Identifier' => 'Identifier',
'isAmazonFulfilled' => 'IsAmazonFulfilled',
'optionalFulfillmentProgram' => 'OptionalFulfillmentProgram',
];
/**
* @param string $marketplaceId A marketplace identifier.
* @param PriceToEstimateFees $priceToEstimateFees Price information for an item, used to estimate fees.
* @param string $identifier A unique identifier provided by the caller to track this request.
* @param ?bool $isAmazonFulfilled When true, the offer is fulfilled by Amazon.
* @param ?string $optionalFulfillmentProgram An optional enrollment program to return the estimated fees when the offer is fulfilled by Amazon (IsAmazonFulfilled is set to true).
*/
public function __construct(
public readonly string $MarketplaceId,
public readonly PriceToEstimateFees $PriceToEstimateFees,
public readonly string $Identifier,
public readonly ?bool $isAmazonFulfilled = null,
public readonly ?string $optionalFulfillmentProgram = null,
) {
}
}
So MarketplaceId instead of marketplaceId, PriceToEstimateFees instead of priceToEstimateFees and Identifier instead of identifier in 2 places. I don't know if they all needed changing or not.
Similar changes were made in the other files mentioned.
I am not expert and maybe there is easy way of doing it but I had the same issue with the MerchantFulfilment API.
attribute map is not applyin to body while sending request. So I have change the line
From:
$originalName = $this->attributeMap[$name] ?? $name;
To:
$originalName = static::class::$attributeMap[$name] ?? $name;
in HasArrayableAttributes.php file in hightsightlabs saloon sdk generator (line 50). It is working now but I do not know what I am breaking with this :)
Thanks. That's certainly a cleaner fix for now, and is working for me too.
I am not expert and maybe there is easy way of doing it but I had the same issue with the MerchantFulfilment API.
attribute map is not applyin to body while sending request. So I have change the line From:
$originalName = $this->attributeMap[$name] ?? $name;
To:$originalName = static::class::$attributeMap[$name] ?? $name;
in HasArrayableAttributes.php file in hightsightlabs saloon sdk generator (line 50). It is working now but I do not know what I am breaking with this :)
Thanks, that is the solution and works fine! @jlevers can you fix in 6.0.6 ?
This fix is in main
and will be released in v7.
Released in v7.0.0
.
Problem description:
When attempting getMyFeesEstimateForSKU, the GetMyFeesEstimateRequest object properties appear to want an initial capital, but are showing as lower case when displayed, resulting in a '400' error. I edited a number of the files in 'vendor/jlevers/selling-partner-api/src/Seller/ProductFeesV0' to force initial capitals and managed to get a successful response, reverted back to the original and the error reappeared.
Error:
Code
Contents of $request when failed
Successful output using modified DTOs