public function testFindParent()
 {
     $this->mockClient->returns['getAuthorizationDetails'][] = 'Declined';
     $this->mockClient->returns['getAuthorizationDetails'][] = 'Closed';
     $parentId = AmazonApi::findRefundParentId('P01-0133129-0199515-R019658');
     $this->assertEquals('P01-0133129-0199515-C019658', $parentId, 'Did not get the right refund parent ID');
 }
 public function execute(ListenerMessage $msg)
 {
     // Bail out if not a refund
     if (get_class($msg) !== self::MESSAGE_CLASS) {
         return true;
     }
     $refundId = $msg->getGatewayTransactionId();
     Logger::info("Looking up ID of original transaction for refund {$refundId}");
     try {
         $parentId = AmazonApi::findRefundParentId($refundId);
         $msg->setParentId($parentId);
         return true;
     } catch (SmashPigException $ex) {
         Logger::error($ex->getMessage());
         return false;
     }
 }