taxamo / taxamo-php

Other
10 stars 7 forks source link

Update composer.json to be compatible with the Composer autoload #13

Closed jcoby closed 9 years ago

jcoby commented 9 years ago

files section is required to be compatible with the Composer autoload. Composer attempts to include Taxamo.php multiple times otherwise and causes a Cannot redeclare Taxamo\startsWith() error when trying to use the Taxamo API

tlipski commented 9 years ago

Thanks, I'll give it a shot.

My tests on 2.0.0 passed ok with a project consisting of:

composer.json:

{
    "require": {
        "taxamo/taxamo-php": "2.*"
    }
}

test/Test.php:

<?php

require 'vendor/autoload.php';

$taxamo = new Taxamo\Taxamo(new Taxamo\APIClient('SamplePrivateTestKey1', 'https://api.taxamo.com'));

$transaction_line1 = new Taxamo\Input_transaction_line();
$transaction_line1->amount = 200;
$transaction_line1->custom_id = 'line1';

$transaction_line2 = new Taxamo\Input_transaction_line();
$transaction_line2->amount = 100;
$transaction_line2->custom_id = 'line2';
$transaction_line2->product_type = 'e-book';

$transaction = new Taxamo\Input_transaction();
$transaction->currency_code = 'USD';
$transaction->buyer_ip = '127.0.0.1';
$transaction->billing_country_code = 'IE';
$transaction->force_country_code = 'FR';
$transaction->transaction_lines = array($transaction_line1, $transaction_line2);

$resp = $taxamo->calculateTax(array('transaction' => $transaction));

echo "Total amount: ".$resp->transaction->total_amount;
tlipski commented 9 years ago

2.0.1 released, please let me know if that fixed it. I had to revert your change to test/TaxamoTest.php, as the tests weren't coming through in all situations.

jcoby commented 9 years ago

Weird. I reapplied the change to test/TaxamoTest.php and the first time I got a Revision error. Please try again. error but running it again came back clean.

At any rate the API works with Composer's autoload now. Thanks.