Skip to content

Commit

Permalink
fixed bug for points
Browse files Browse the repository at this point in the history
  • Loading branch information
saleweaver committed Feb 9, 2021
1 parent a30e2d9 commit 8cc123b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='python-amazon-sp-api',
version='0.2.2',
version='0.2.3',
install_requires=[
"requests",
"six~=1.15.0",
Expand Down
8 changes: 4 additions & 4 deletions sp_api/api/product_fees/product_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ProductFees(Client):

@sp_endpoint('/products/fees/v0/listings/{}/feesEstimate', method='POST')
def get_product_fees_estimate_for_sku(self, seller_sku, price: float, shipping_price=None, currency='USD',
is_fba=False, points: dict = dict, **kwargs) -> ApiResponse:
is_fba=False, points: dict = None, **kwargs) -> ApiResponse:
"""
get_product_fees_estimate_for_sku(self, seller_sku, price: float, shipping_price=None, currency='USD', is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
Expand All @@ -33,7 +33,7 @@ def get_product_fees_estimate_for_sku(self, seller_sku, price: float, shipping_p

@sp_endpoint('/products/fees/v0/items/{}/feesEstimate', method='POST')
def get_product_fees_estimate_for_asin(self, asin, price: float, currency='USD', shipping_price=None, is_fba=False,
points: dict = dict,
points: dict = None,
**kwargs) -> ApiResponse:
"""
get_product_fees_estimate_for_asin(self, asin, price: float, currency='USD', shipping_price=None, is_fba=False, points: dict = dict, **kwargs) -> ApiResponse
Expand All @@ -56,7 +56,7 @@ def get_product_fees_estimate_for_asin(self, asin, price: float, currency='USD',
kwargs.update(self._create_body(price, shipping_price, currency, is_fba, asin, points))
return self._request(fill_query_params(kwargs.pop('path'), asin), data=kwargs)

def _create_body(self, price, shipping_price=None, currency='USD', is_fba=False, identifier=None, points=dict):
def _create_body(self, price, shipping_price=None, currency='USD', is_fba=False, identifier=None, points: dict=None):
"""
Create request body
Expand All @@ -83,7 +83,7 @@ def _create_body(self, price, shipping_price=None, currency='USD', is_fba=False,
'Amount': shipping_price,
'CurrencyCode': currency
} if shipping_price else None,
**points
'Points': points or None
},
'IsAmazonFulfilled': is_fba,
'MarketplaceId': self.marketplace_id
Expand Down
8 changes: 4 additions & 4 deletions tests/api/product_fees/product_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@

def test_get_fees_for_sku():
res = ProductFees().get_product_fees_estimate_for_sku("UmaS1", 10, currency='USD', shipping_price=10, is_fba=False,
points={"Points": {
points={
"PointsNumber": 0,
"PointsMonetaryValue": {
"CurrencyCode": "USD",
"Amount": 0
}
}})
})
assert res.payload.get('FeesEstimateResult').get('Status') == 'Success'


def test_get_fees_for_asin():
res = ProductFees().get_product_fees_estimate_for_asin("UmaS1", 10, currency='USD', shipping_price=10, is_fba=False,
points={"Points": {
points={
"PointsNumber": 0,
"PointsMonetaryValue": {
"CurrencyCode": "USD",
"Amount": 0
}
}})
})
assert res.payload.get('FeesEstimateResult').get('Status') == 'Success'

0 comments on commit 8cc123b

Please sign in to comment.