mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
More test cases
This commit is contained in:
parent
4172f60002
commit
8e622c81fa
@ -315,4 +315,41 @@ class CompanyGatewayApiTest extends TestCase
|
||||
|
||||
$this->assertEquals(11, $company_gateway->calcGatewayFee(10));
|
||||
}
|
||||
|
||||
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuation()
|
||||
{
|
||||
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||
$fee = new FeesAndLimits;
|
||||
$fee->fee_amount = 10;
|
||||
// $fee->fee_percent = 2;
|
||||
$fee->fee_tax_name1 = 'GST';
|
||||
$fee->fee_tax_rate1 = '10.0';
|
||||
$fee->fee_tax_name2 = 'GST';
|
||||
$fee->fee_tax_rate2 = '10.0';
|
||||
|
||||
|
||||
$fee_arr[1] = (array)$fee;
|
||||
|
||||
$data = [
|
||||
'config' => 'random config',
|
||||
'gateway_key' => '3b6621f970ab18887c4f6dca78d3f8bb',
|
||||
'fees_and_limits' => $fee_arr,
|
||||
];
|
||||
|
||||
/* POST */
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token
|
||||
])->post('/api/v1/company_gateways', $data);
|
||||
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$arr = $response->json();
|
||||
$id = $this->decodePrimaryKey($arr['data']['id']);
|
||||
|
||||
$company_gateway = CompanyGateway::find($id);
|
||||
|
||||
$this->assertEquals(12, $company_gateway->calcGatewayFee(10));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user