-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tier attributes to AddOn class and create Tier class
- Loading branch information
1 parent
a729540
commit 07ad7d8
Showing
5 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/** | ||
* class Recurly_Tier | ||
* @property int $unit_amount_in_cents Price of 1 unit of the add-on in cents. | ||
* @property int $ending_quantity The maximum number of units per tier. The final tier is always to infinity. This means the last tier should have a `ending_quantity` of `NULL` or `999999999`. | ||
*/ | ||
|
||
class Recurly_Tier extends Recurly_Resource | ||
{ | ||
function __construct($href = null, $client = null) { | ||
parent::__construct($href, $client); | ||
$this->unit_amount_in_cents = new Recurly_CurrencyList('unit_amount_in_cents'); | ||
} | ||
|
||
protected function getNodeName() { | ||
return 'tier'; | ||
} | ||
|
||
protected function populateXmlDoc(&$doc, &$node, &$obj, $nested = false) { | ||
if ($this->isEmbedded($node, 'tiers')) { | ||
$tierNode = $node->appendChild($doc->createElement($this->getNodeName())); | ||
parent::populateXmlDoc($doc, $tierNode, $obj, $nested); | ||
} else { | ||
parent::populateXmlDoc($doc, $node, $obj, $nested); | ||
} | ||
} | ||
|
||
protected function getWriteableAttributes() | ||
{ | ||
return array( | ||
'unit_amount_in_cents', 'ending_quantity' | ||
); | ||
} | ||
} |