Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
+ changed the errors on Order
Browse files Browse the repository at this point in the history
  • Loading branch information
matteocacciola committed May 30, 2019
1 parent e96e972 commit 5479ba6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,12 @@ public static function listAllWithAllCursors(array $config = [])
*/
public function cancel($purchaseOrderId, $order)
{
if (!is_numeric($purchaseOrderId)) {
throw new \Exception("purchaseOrderId must be numeric", 1448480746);
if (empty($purchaseOrderId)) {
throw new \Exception("purchaseOrderId cannot be empty", 1448480746);
}

if (empty($order)) {
throw new \Exception("$order cannot be empty", 1448480746);
}

$schema = [
Expand Down Expand Up @@ -286,10 +290,14 @@ public function cancel($purchaseOrderId, $order)
*/
public function ship($purchaseOrderId, $order)
{
if (!is_numeric($purchaseOrderId)) {
if (empty($purchaseOrderId)) {
throw new \Exception("purchaseOrderId must be numeric", 1448480750);
}

if (empty($order)) {
throw new \Exception("$order cannot be empty", 1448480746);
}

$schema = [
'/orderShipment' => [
'namespace' => 'ns3',
Expand Down Expand Up @@ -326,10 +334,14 @@ public function ship($purchaseOrderId, $order)
*/
public function refund($purchaseOrderId, $order)
{
if (!is_numeric($purchaseOrderId)) {
if (empty($purchaseOrderId)) {
throw new \Exception("purchaseOrderId must be numeric", 1448480783);
}

if (empty($order)) {
throw new \Exception("$order cannot be empty", 1448480746);
}

$schema = [
'/orderRefund' => [
'namespace' => 'ns3',
Expand Down

0 comments on commit 5479ba6

Please sign in to comment.