Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "fillup/walmart-partner-api-sdk-php",
"name": "jpnathannew/walmart-partner-api-sdk-php",
"description": "PHP client for Walmart Partner APIs",
"type": "library",
"license": "MIT",
Expand All @@ -13,10 +13,10 @@
"require": {
"php": ">=5.4",
"guzzlehttp/guzzle": "^5.3.1",
"fillup/guzzle-services": "0.5.1",
"jpnathannew/guzzle-services": "0.5.1",
"guzzlehttp/retry-subscriber": "^2.0.2",
"fillup/walmart-auth-signature-php": "^1.0.3",
"fillup/array2xml": "^0.5.1"
"jpnathannew/walmart-auth-signature-php": "^1.0.3",
"jpnathannew/array2xml": "^0.5.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8.24",
Expand Down
16 changes: 13 additions & 3 deletions src/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ class Price extends BaseClient
public function __construct(array $config = [], $env = self::ENV_PROD)
{
// Apply some defaults.
$config += [
$this->wmConsumerChannelType = $config['wmConsumerChannelType'];

// Apply some defaults.
$config = array_merge_recursive($config, [
'description_path' => __DIR__ . '/descriptions/price.php',
];
'http_client_options' => [
'defaults' => [
'headers' => [
'WM_CONSUMER.CHANNEL.TYPE' => $this->wmConsumerChannelType,
],
],
],
]);

// Create the client.
parent::__construct(
Expand Down Expand Up @@ -77,4 +87,4 @@ public function bulk($items)
'file' => $file,
]);
}
}
}
2 changes: 1 addition & 1 deletion src/descriptions/price.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php return [
'baseUrl' => 'https://marketplace.walmartapis.com',
'apiVersion' => 'v2',
'apiVersion' => 'v3',
'operations' => [
'Update' => [
'httpMethod' => 'PUT',
Expand Down
4 changes: 2 additions & 2 deletions src/mock/feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</ns2:FeedAcknowledgement>'
],

'POST /v2/feeds?feedType=price' => [
'POST /v3/feeds?feedType=price' => [
'status' => 200,
'headers' => [],
'body' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Expand All @@ -155,4 +155,4 @@
</ns2:FeedAcknowledgement>'
]

];
];
4 changes: 2 additions & 2 deletions src/mock/prices.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
return [
'PUT /v2/prices?sku=1131270&currency=USD&price=55' => [
'PUT /v3/prices?sku=1131270&currency=USD&price=55' => [
'status' => 200,
'headers' => [],
'body' => '<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -13,4 +13,4 @@
</ns2:ItemPriceResponse>'
],

];
];
23 changes: 2 additions & 21 deletions tests/PriceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,12 @@ public function __construct()
],
'consumerId' => Env::get('CONSUMER_ID', 'hw30cqp3-35fi-1bi0-3312-hw9fgm30d2p4'),
'privateKey' => Env::get('PRIVATE_KEY', 'MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKzXEfCYdnBNkKAwVbCpg/tR40WixoZtiuEviSEi4+LdnYAAPy57Qw6+9eqJGTh9iCB2wP/I8lWh5TZ49Hq/chjTCPeJiOqi6bvX1xzyBlSq2ElSY3iEVKeVoQG/5f9MYQLEj5/vfTWSNASsMwnNeBbbHcV1S1aY9tOsXCzRuxapAgMBAAECgYBjkM1j1OA9l2Ed9loWl8BQ8X5D6h4E6Gudhx2uugOe9904FGxRIW6iuvy869dchGv7j41ki+SV0dpRw+HKKCjYE6STKpe0YwIm/tml54aNDQ0vQvF8JWILca1a7v3Go6chf3Ib6JPs6KVsUuNo+Yd+jKR9GAKgnDeXS6NZlTBUAQJBANex815VAySumJ/n8xR+h/dZ2V5qGj6wu3Gsdw6eNYKQn3I8AGQw8N4yzDUoFnrQxqDmP3LOyr3/zgOMNTdszIECQQDNIxiZOVl3/Sjyxy9WHMk5qNfSf5iODynv1OlTG+eWao0Wj/NdfLb4pwxRsf4XZFZ1SQNkbNne7+tEO8FTG1YpAkAwNMY2g/ty3E6iFl3ea7UJlBwfnMkGz8rkye3F55f/+UCZcE2KFuIOVv4Kt03m3vg1h6AQkaUAN8acRl6yZ2+BAkEAke2eiRmYANiR8asqjGqr5x2qcm8ceiplXdwrI1kddQ5VUbCTonSewOIszEz/gWp6arLG/ADHOGWaCo8rptAyiQJACXd1ddXUAKs6x3l752tSH8dOde8nDBgF86NGvgUnBiAPPTmJHuhWrmOZmNaB68PsltEiiFwWByGFV+ld9VKmKg=='),
'wmConsumerChannelType' => Env::get('WM_CONSUMER_CHANNEL_TYPE', 'ABC123'),
];

parent::__construct();
}

public function testUpdate()
{
$client = $this->getClient();
try {
$update = $client->update([
'sku' => '1131270',
'currency' => 'USD',
'price' => '55',
]);
$this->assertEquals(200, $update['statusCode']);
$this->assertEquals('WALMART_US', $update['mart']);
$this->debug($update);
} catch (CommandClientException $e) {
$error = $e->getResponse()->getHeader('X-Error');
$this->fail($e->getMessage() . 'Error: ' . $error);
} catch (\Exception $e) {
$this->fail($e->getMessage());
}
}

public function testBulk()
{
$client = $this->getClient();
Expand Down Expand Up @@ -145,4 +126,4 @@ private function debug($output)
fwrite(STDERR, print_r($output, true));
}
}
}
}