*
*
BillingAgreement: OffAmazonPaymentsNotifications_Model_BillingAgreement
*
*
*/
class OffAmazonPaymentsNotifications_Model_BillingAgreementNotification extends OffAmazonPaymentsNotifications_NotificationImpl
{
/**
* Construct new OffAmazonPaymentsNotifications_Model_BillingAgreementNotification
*
* @param OffAmazonPaymentsNotifications_NotificationMetadata $notificationMetadata metadata for request
* @param mixed $data DOMElement or Associative Array
* to construct from.
*
* Valid properties:
*
*
* - BillingAgreement: OffAmazonPaymentsNotifications_Model_BillingAgreement
*
*
*/
public function __construct (
OffAmazonPaymentsNotifications_NotificationMetadata $notificationMetadata, $data = null)
{
$this->fields = array(
'BillingAgreement' => array(
'FieldValue' => null,
'FieldType' => 'OffAmazonPaymentsNotifications_Model_BillingAgreement'
)
);
parent::__construct($notificationMetadata, "BillingAgreementNotification", $data);
}
/**
* Construct OffAmazonPaymentsNotifications_Model_BillingAgreementNotification
* from XML string
*
* @param string $xml XML string to construct from
*
* @return OffAmazonPaymentsNotifications_Model_BillingAgreementNotification
*/
public static function fromXML ($xml)
{
$dom = new DOMDocument();
$dom->loadXML($xml);
$xpath = new DOMXPath($dom);
$xpath->registerNamespace('a', self::getNamespace());
$response = $xpath->query('//a:BillingAgreementNotification');
if ($response->length == 1) {
return new OffAmazonPaymentsNotifications_Model_BillingAgreementNotification(
$response->item(0));
} else {
throw new Exception(
"Unable to construct " .
"OffAmazonPaymentsNotifications_Model_BillingAgreementNotification" .
"from provided XML. Make sure that BillingAgreementNotification" .
"is a root element");
}
}
/**
* Gets the value of the BillingAgreement.
*
* @return BillingAgreement property value
*/
public function getBillingAgreement ()
{
return $this->fields['BillingAgreement']['FieldValue'];
}
/**
* Sets the value of the BillingAgreement.
*
* @param BillingAgreement $value new value
*
* @return void
*/
public function setBillingAgreement ($value)
{
$this->fields['BillingAgreement']['FieldValue'] = $value;
return;
}
/**
* Sets the value of the BillingAgreement
* and returns this instance
*
* @param BillingAgreementNotification $value BillingAgreement
*
* @return OffAmazonPaymentsServices_Model_BillingAgreementNotification instance
*/
public function withBillingAgreement ($value)
{
$this->setBillingAgreement($value);
return $this;
}
/**
* Checks if BillingAgreement is set
*
* @return bool true if BillingAgreement property is set
*/
public function isSetBillingAgreement ()
{
return ! is_null($this->fields['BillingAgreement']['FieldValue']);
}
/**
* XML Representation for this object
*
* @return string XML for this object
*/
public function toXML ()
{
$xml = "";
$xml .= "";
$xml .= $this->_toXMLFragment();
$xml .= "";
return $xml;
}
}