mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Test mode for company gateway
This commit is contained in:
parent
23a8acccc2
commit
a5248f7a93
@ -201,6 +201,18 @@ class CompanyGateway extends BaseModel
|
||||
return floatval($this->fee_amount) || floatval($this->fee_percent);
|
||||
}
|
||||
|
||||
public function isTestMode()
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
|
||||
if($this->gateway->provider == 'Stripe' && strpos($config->publishableKey, 'test'))
|
||||
return true;
|
||||
|
||||
if(property_exists($config, 'testMode') && $config->testMode)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Get Publishable Key
|
||||
* Only works for STRIPE and PAYMILL
|
||||
|
@ -14,6 +14,8 @@ class CompanyGatewayObserver
|
||||
*/
|
||||
public function created(CompanyGateway $company_gateway)
|
||||
{
|
||||
|
||||
/* Set company gateway if not exists*/
|
||||
if(!$company_gateway->label){
|
||||
$company_gateway->label = $company_gateway->gateway->name;
|
||||
$company_gateway->save();
|
||||
|
@ -64,6 +64,7 @@ class CompanyGatewayTransformer extends EntityTransformer
|
||||
'custom_value4' => $company_gateway->custom_value4 ?: '',
|
||||
'label' => (string)$company_gateway->label ?: '',
|
||||
'token_billing' => (string)$company_gateway->token_billing,
|
||||
'test_mode' => (bool)$company_gateway->isTestMode(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,18 @@ class AddIsPublicToDocumentsTable extends Migration
|
||||
$table->timestamps(6);
|
||||
});
|
||||
|
||||
Schema::table('recurring_invoices', function ($table) {
|
||||
$table->string('auto_bill');
|
||||
});
|
||||
|
||||
Schema::table('recurring_expenses', function ($table) {
|
||||
$table->table('auto_bill');
|
||||
});
|
||||
|
||||
Schema::table('companies', function ($table) {
|
||||
$table->enum('default_auto_bill', ['off', 'always','optin','optout'])->default('off');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user