Skip to content

Commit

Permalink
Add taxable address sources to business entity and adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
ELepolt committed May 31, 2024
1 parent f820d95 commit e02db92
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Tests/Recurly/Adjustment_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public function testGetAdjustment() {
$this->assertEquals(5000, $adjustment->tax_in_cents);
$this->assertEquals(1200, $adjustment->total_in_cents);
$this->assertEquals('USD', $adjustment->currency);
$this->assertEquals('Business entity tax address', $adjustment->origin_tax_address_source);
$this->assertEquals('Customer tax address', $adjustment->destination_tax_address_source);
$this->assertEquals(false, $adjustment->taxable);
$this->assertEquals('2011-04-30T07:00:00+00:00', $adjustment->start_date->format('c'));
$this->assertEquals('2011-04-30T07:00:00+00:00', $adjustment->end_date->format('c'));
Expand Down
2 changes: 2 additions & 0 deletions Tests/Recurly/BusinessEntity_List_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public function testGetAll() {
$this->assertEquals($business_entity->tax_address->city, 'Oakland');
$this->assertEquals($business_entity->tax_address->country, 'US');
$this->assertEquals($business_entity->tax_address->phone, '718-555-1234');
$this->assertEquals($business_entity->origin_tax_address_source, 'Business entity tax address');
$this->assertEquals($business_entity->destination_tax_address_source, 'Customer tax address');
$this->assertEquals($business_entity->default_vat_number, '1234');
$this->assertEquals($business_entity->default_registration_number, '5678');
$this->assertInstanceOf('DateTime', $business_entity->created_at);
Expand Down
2 changes: 2 additions & 0 deletions Tests/Recurly/BusinessEntity_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public function testGetBusinessEntity() {
$this->assertEquals($business_entity->tax_address->city, 'Oakland');
$this->assertEquals($business_entity->tax_address->country, 'US');
$this->assertEquals($business_entity->tax_address->phone, '718-555-1234');
$this->assertEquals($business_entity->origin_tax_address_source, 'Business entity tax address');
$this->assertEquals($business_entity->destination_tax_address_source, 'Customer tax address');
$this->assertEquals($business_entity->default_vat_number, '1234');
$this->assertEquals($business_entity->default_registration_number, '5678');
$this->assertInstanceOf('DateTime', $business_entity->created_at);
Expand Down
2 changes: 2 additions & 0 deletions Tests/fixtures/adjustments/show-200-revrec.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Content-Type: application/xml; charset=utf-8
<tax_in_cents type="integer">0</tax_in_cents>
<total_in_cents type="integer">1200</total_in_cents>
<currency>USD</currency>
<origin_tax_address_source>Business entity tax address</origin_tax_address_source>
<destination_tax_address_source>Customer tax address</destination_tax_address_source>
<taxable type="boolean">false</taxable>
<start_date type="datetime">2011-04-30T07:00:00Z</start_date>
<end_date type="datetime">2011-04-30T07:00:00Z</end_date>
Expand Down
2 changes: 2 additions & 0 deletions Tests/fixtures/adjustments/show-200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Content-Type: application/xml; charset=utf-8
<tax_in_cents type="integer">5000</tax_in_cents>
<total_in_cents type="integer">1200</total_in_cents>
<currency>USD</currency>
<origin_tax_address_source>Business entity tax address</origin_tax_address_source>
<destination_tax_address_source>Customer tax address</destination_tax_address_source>
<tax_exempt type="boolean">false</tax_exempt>
<tax_details type="array">
<tax_detail>
Expand Down
2 changes: 2 additions & 0 deletions Tests/fixtures/business_entities/index-200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Content-Type: application/xml; charset=utf-8
<country>US</country>
<phone>718-555-1234</phone>
</tax_address>
<origin_tax_address_source>Business entity tax address</origin_tax_address_source>
<destination_tax_address_source>Customer tax address</destination_tax_address_source>
<subscriber_location_countries type="array">
<subscriber_location_country>GB</subscriber_location_country>
<subscriber_location_country>CO</subscriber_location_country>
Expand Down
2 changes: 2 additions & 0 deletions Tests/fixtures/business_entities/show-200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Content-Type: application/xml; charset=utf-8
<country>US</country>
<phone>718-555-1234</phone>
</tax_address>
<origin_tax_address_source>Business entity tax address</origin_tax_address_source>
<destination_tax_address_source>Customer tax address</destination_tax_address_source>
<subscriber_location_countries type="array">
<subscriber_location_country>GB</subscriber_location_country>
<subscriber_location_country>CO</subscriber_location_country>
Expand Down
2 changes: 2 additions & 0 deletions lib/recurly/adjustment.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* @property string $tax_type The tax type of the adjustment.
* @property string $tax_region The tax region of the adjustment.
* @property float $tax_rate The tax rate of the adjustment.
* @property string $origin_tax_address_source The source of the address that will be used as the "origin" in determining taxes.
* @property string $destination_tax_address_source The source of the address that will be used as the "destination" in determining taxes.
* @property boolean $tax_exempt true exempts tax on the charge, false applies tax on the charge. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative adjustments). Credits are always post-tax. Pre-tax discounts should use the Coupons feature.
* @property mixed[] $tax_details The nested address information of the adjustment: name, type, tax_rate, tax_in_cents.
* @property string $tax_code Optional field for EU VAT merchants and Avalara AvaTax Pro merchants. If you are using Recurly's EU VAT feature, you can use values of unknown, physical, or digital. If you have your own AvaTax account configured, you can use Avalara tax codes to assign custom tax rules.
Expand Down
2 changes: 2 additions & 0 deletions lib/recurly/business_entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* @property string $default_liability_gl_account_id
* @property Recurly_Address $invoice_display_address The nested invoice address information of the business entity: address1, address2, city, state, zip, country, phone.
* @property Recurly_Address $tax_address The nested tax address information of the business entity: address1, address2, city, state, zip, country, phone.
* @property string $origin_tax_address_source The source of the address that will be used as the "origin" in determining taxes.
* @property string $destination_tax_address_source The source of the address that will be used as the "destination" in determining taxes.
* @property Recurly_SubscriberLocationCountry[] $subscriber_location_countries
* @property string $default_vat_number
* @property string $default_registration_number
Expand Down

0 comments on commit e02db92

Please sign in to comment.