<?php

require_once dirname(__FILE__) . '/CallerServicesBase.php';

class DoCaptureTest extends CallerServicesBase
{
    function testCapture()
    {
        if (Services_PayPal::isError($this->caller)) {
            return $this->fail("Failed to instantiate CallerServices: " . $this->caller->getMessage());
        }

        $amount =& Services_PayPal::getType('BasicAmountType');
        $amount->setval(100);
        $amount->setattr('currencyID', 'USD');

        $dcrt =& Services_PayPal::getType('DoCaptureRequestType');
        $dcrt->setAuthorizationID('authorizationid001');
        $dcrt->setAmount($amount);
        $dcrt->setCompleteType('Complete');

        $response = $this->caller->DoCapture($dcrt);

	    $this->assertFalse(Services_PayPal::isError($response), "Got back an error, perhaps a SOAP Fault.");
        $this->assertTrue(is_a($response, 'DoCaptureResponseType'), "Response is not the correct type.");
    }

}
