mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
commit
b3c2953e19
@ -23,6 +23,6 @@ class PingController extends BaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return response()->json(['company_name' => auth()->user()->getCompany()->present()->name()], 200);
|
||||
return response()->json(['company_name' => auth()->user()->getCompany()->present()->name() - auth()->user()->present()->name()], 200);
|
||||
}
|
||||
}
|
||||
|
@ -377,6 +377,29 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getBankTransferGateway() :?CompanyGateway
|
||||
{
|
||||
$company_gateways = $this->getSetting('company_gateway_ids');
|
||||
|
||||
if (strlen($company_gateways)>=1) {
|
||||
$gateways = $this->company->company_gateways->whereIn('id', $company_gateways);
|
||||
} else {
|
||||
$gateways = $this->company->company_gateways;
|
||||
}
|
||||
|
||||
foreach ($gateways as $gateway) {
|
||||
if ($this->currency()->code == 'USD' && in_array(GatewayType::BANK_TRANSFER, $gateway->driver($this)->gatewayTypes())) {
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
if ($this->currency()->code == 'EUR' && in_array(GatewayType::SEPA, $gateway->driver($this)->gatewayTypes())) {
|
||||
return $gateway;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getCurrencyCode()
|
||||
{
|
||||
if ($this->currency()) {
|
||||
@ -385,6 +408,7 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
|
||||
return 'USD';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an array of payment urls per client
|
||||
* for a given amount.
|
||||
@ -404,14 +428,14 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
//this method will get all the possible gateways a client can pay with
|
||||
//but we also need to consider payment methods that are already stored
|
||||
//so we MUST filter the company gateways and remove duplicates.
|
||||
//
|
||||
|
||||
//Also need to harvest the list of client gateway tokens and present these
|
||||
//for instant payment
|
||||
|
||||
$company_gateways = $this->getSetting('company_gateway_ids');
|
||||
|
||||
if ($company_gateways) {
|
||||
$gateways = $this->company->company_gateways->whereIn('id', $payment_gateways);
|
||||
$gateways = $this->company->company_gateways->whereIn('id', $payment_gateways); //this will never hit
|
||||
} else {
|
||||
$gateways = $this->company->company_gateways;
|
||||
}
|
||||
@ -434,7 +458,6 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$payment_methods_collections = collect($payment_methods);
|
||||
|
||||
//** Plucks the remaining keys into its own collection
|
||||
|
@ -50,6 +50,10 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
||||
/** Instance of \Checkout\CheckoutApi */
|
||||
public $gateway;
|
||||
|
||||
public static $methods = [
|
||||
GatewayType::CREDIT_CARD => '',
|
||||
];
|
||||
|
||||
/** Since with Checkout.com we handle only credit cards, this method should be empty. */
|
||||
public function setPaymentMethod($string = null)
|
||||
{
|
||||
|
46
composer.lock
generated
46
composer.lock
generated
@ -107,16 +107,16 @@
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.144.2",
|
||||
"version": "3.145.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "0a0b9e4d485fe0cd53db2a4075eba9a416d8331c"
|
||||
"reference": "df5406b49f4f5774045e51e8fecc75717c4d6454"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0a0b9e4d485fe0cd53db2a4075eba9a416d8331c",
|
||||
"reference": "0a0b9e4d485fe0cd53db2a4075eba9a416d8331c",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/df5406b49f4f5774045e51e8fecc75717c4d6454",
|
||||
"reference": "df5406b49f4f5774045e51e8fecc75717c4d6454",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -188,7 +188,7 @@
|
||||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2020-07-01T18:18:54+00:00"
|
||||
"time": "2020-07-02T18:12:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "checkout/checkout-sdk-php",
|
||||
@ -1089,6 +1089,20 @@
|
||||
"sqlserver",
|
||||
"sqlsrv"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://www.doctrine-project.org/sponsorship.html",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpdoctrine",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-04-20T17:19:26+00:00"
|
||||
},
|
||||
{
|
||||
@ -3776,16 +3790,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v4.5.0",
|
||||
"version": "v4.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463"
|
||||
"reference": "c346bbfafe2ff60680258b631afb730d186ed864"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53c2753d756f5adb586dca79c2ec0e2654dd9463",
|
||||
"reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c346bbfafe2ff60680258b631afb730d186ed864",
|
||||
"reference": "c346bbfafe2ff60680258b631afb730d186ed864",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3824,7 +3838,7 @@
|
||||
"parser",
|
||||
"php"
|
||||
],
|
||||
"time": "2020-06-03T07:24:19+00:00"
|
||||
"time": "2020-07-02T17:12:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nwidart/laravel-modules",
|
||||
@ -4278,16 +4292,16 @@
|
||||
},
|
||||
{
|
||||
"name": "php-http/discovery",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-http/discovery.git",
|
||||
"reference": "10d9019f393773345aedc0dc79e7fd678da874ee"
|
||||
"reference": "9ab7668fee74a5ad61996095e50917bd50ee8bfe"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-http/discovery/zipball/10d9019f393773345aedc0dc79e7fd678da874ee",
|
||||
"reference": "10d9019f393773345aedc0dc79e7fd678da874ee",
|
||||
"url": "https://api.github.com/repos/php-http/discovery/zipball/9ab7668fee74a5ad61996095e50917bd50ee8bfe",
|
||||
"reference": "9ab7668fee74a5ad61996095e50917bd50ee8bfe",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4310,7 +4324,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.7-dev"
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -4339,7 +4353,7 @@
|
||||
"message",
|
||||
"psr7"
|
||||
],
|
||||
"time": "2020-06-14T10:44:12+00:00"
|
||||
"time": "2020-07-02T11:43:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/guzzle6-adapter",
|
||||
|
@ -319,44 +319,44 @@ class RandomDataSeeder extends Seeder
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
// if (config('ninja.testvars.paypal')) {
|
||||
// $cg = new CompanyGateway;
|
||||
// $cg->company_id = $company->id;
|
||||
// $cg->user_id = $user->id;
|
||||
// $cg->gateway_key = '38f2c48af60c7dd69e04248cbb24c36e';
|
||||
// $cg->require_cvv = true;
|
||||
// $cg->show_billing_address = true;
|
||||
// $cg->show_shipping_address = true;
|
||||
// $cg->update_details = true;
|
||||
// $cg->config = encrypt(config('ninja.testvars.paypal'));
|
||||
// $cg->save();
|
||||
// }
|
||||
if (config('ninja.testvars.paypal')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '38f2c48af60c7dd69e04248cbb24c36e';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.paypal'));
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
// if(config('ninja.testvars.checkout')) {
|
||||
// $cg = new CompanyGateway;
|
||||
// $cg->company_id = $company->id;
|
||||
// $cg->user_id = $user->id;
|
||||
// $cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
|
||||
// $cg->require_cvv = true;
|
||||
// $cg->show_billing_address = true;
|
||||
// $cg->show_shipping_address = true;
|
||||
// $cg->update_details = true;
|
||||
// $cg->config = encrypt(config('ninja.testvars.checkout'));
|
||||
// $cg->save();
|
||||
// }
|
||||
if(config('ninja.testvars.checkout')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.checkout'));
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
// if(config('ninja.testvars.authorize')) {
|
||||
// $cg = new CompanyGateway;
|
||||
// $cg->company_id = $company->id;
|
||||
// $cg->user_id = $user->id;
|
||||
// $cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb';
|
||||
// $cg->require_cvv = true;
|
||||
// $cg->show_billing_address = true;
|
||||
// $cg->show_shipping_address = true;
|
||||
// $cg->update_details = true;
|
||||
// $cg->config = encrypt(config('ninja.testvars.authorize'));
|
||||
// $cg->save();
|
||||
// }
|
||||
if(config('ninja.testvars.authorize')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.authorize'));
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user