mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added rbits data
This commit is contained in:
parent
9c97c50947
commit
2ccb54bf42
@ -411,6 +411,7 @@ class AccountGatewayController extends BaseController
|
|||||||
'description' => trans('texts.wepay_account_description'),
|
'description' => trans('texts.wepay_account_description'),
|
||||||
'theme_object' => json_decode(WEPAY_THEME),
|
'theme_object' => json_decode(WEPAY_THEME),
|
||||||
'callback_uri' => $accountGateway->getWebhookUrl(),
|
'callback_uri' => $accountGateway->getWebhookUrl(),
|
||||||
|
'rbits' => $account->present()->rBits,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (WEPAY_ENABLE_CANADA) {
|
if (WEPAY_ENABLE_CANADA) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php namespace App\Models;
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use Laracasts\Presenter\PresentableTrait;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7,7 +8,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
*/
|
*/
|
||||||
class InvoiceItem extends EntityModel
|
class InvoiceItem extends EntityModel
|
||||||
{
|
{
|
||||||
|
use PresentableTrait;
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $presenter = 'App\Ninja\Presenters\InvoiceItemPresenter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
@ -61,6 +61,8 @@ class WePayPaymentDriver extends BasePaymentDriver
|
|||||||
$data['paymentMethodType'] = 'payment_bank';
|
$data['paymentMethodType'] = 'payment_bank';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data['transaction_rbits'] = $this->invoice()->present()->rBits;
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php namespace App\Ninja\Presenters;
|
<?php namespace App\Ninja\Presenters;
|
||||||
|
|
||||||
|
use stdClass;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Laracasts\Presenter\Presenter;
|
use Laracasts\Presenter\Presenter;
|
||||||
|
|
||||||
@ -34,4 +35,49 @@ class AccountPresenter extends Presenter
|
|||||||
$currency = Utils::getFromCache($currencyId, 'currencies');
|
$currency = Utils::getFromCache($currencyId, 'currencies');
|
||||||
return $currency->code;
|
return $currency->code;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function industry()
|
||||||
|
{
|
||||||
|
return $this->entity->industry ? $this->entity->industry->name : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function size()
|
||||||
|
{
|
||||||
|
return $this->entity->size ? $this->entity->size->name : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function createRBit($type, $source, $properties)
|
||||||
|
{
|
||||||
|
$data = new stdClass();
|
||||||
|
$data->receive_time = time();
|
||||||
|
$data->type = $type;
|
||||||
|
$data->source = $source;
|
||||||
|
$data->properties = new stdClass();
|
||||||
|
|
||||||
|
foreach ($properties as $key => $val) {
|
||||||
|
$data->properties->$key = $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rBits()
|
||||||
|
{
|
||||||
|
$account = $this->entity;
|
||||||
|
$user = $account->users()->first();
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
$data[] = $this->createRBit('business_name', 'user', ['business_name' => $account->name]);
|
||||||
|
$data[] = $this->createRBit('industry_code', 'user', ['industry_detail' => $account->present()->industry]);
|
||||||
|
$data[] = $this->createRBit('comment', 'partner_database', ['comment_text' => 'Logo image not present']);
|
||||||
|
$data[] = $this->createRBit('business_description', 'user', ['business_description' => $account->present()->size]);
|
||||||
|
|
||||||
|
$data[] = $this->createRBit('person', 'user', ['name' => $user->getFullName()]);
|
||||||
|
$data[] = $this->createRBit('email', 'user', ['email' => $user->email]);
|
||||||
|
$data[] = $this->createRBit('phone', 'user', ['phone' => $user->phone]);
|
||||||
|
$data[] = $this->createRBit('website_uri', 'user', ['uri' => $account->website]);
|
||||||
|
$data[] = $this->createRBit('external_account', 'partner_database', ['is_partner_account' => 'yes', 'account_type' => 'Invoice Ninja', 'create_time' => time()]);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
17
app/Ninja/Presenters/InvoiceItemPresenter.php
Normal file
17
app/Ninja/Presenters/InvoiceItemPresenter.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php namespace App\Ninja\Presenters;
|
||||||
|
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class InvoiceItemPresenter extends EntityPresenter
|
||||||
|
{
|
||||||
|
public function rBits()
|
||||||
|
{
|
||||||
|
$data = new stdClass();
|
||||||
|
$data->description = $this->entity->notes;
|
||||||
|
$data->item_price = floatval($this->entity->cost);
|
||||||
|
$data->quantity = floatval($this->entity->qty);
|
||||||
|
$data->amount = round($data->item_price * $data->quantity, 2);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
<?php namespace App\Ninja\Presenters;
|
<?php namespace App\Ninja\Presenters;
|
||||||
|
|
||||||
|
use stdClass;
|
||||||
use Utils;
|
use Utils;
|
||||||
use App\Libraries\Skype\InvoiceCard;
|
use App\Libraries\Skype\InvoiceCard;
|
||||||
|
|
||||||
@ -141,4 +142,24 @@ class InvoicePresenter extends EntityPresenter {
|
|||||||
{
|
{
|
||||||
return new InvoiceCard($this->entity);
|
return new InvoiceCard($this->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function rBits()
|
||||||
|
{
|
||||||
|
$properties = new stdClass();
|
||||||
|
$properties->terms_text = $this->entity->terms;
|
||||||
|
$properties->note = $this->entity->public_notes;
|
||||||
|
$properties->itemized_receipt = [];
|
||||||
|
|
||||||
|
foreach ($this->entity->invoice_items as $item) {
|
||||||
|
$properties->itemized_receipt[] = $item->present()->rBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = new stdClass();
|
||||||
|
$data->receive_time = time();
|
||||||
|
$data->type = 'transaction_details';
|
||||||
|
$data->source = 'user';
|
||||||
|
$data->properties = $properties;
|
||||||
|
|
||||||
|
return [$data];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
58
composer.lock
generated
58
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "5d41e236e8354f33899fbac05995eaee",
|
"hash": "5268e0c573a4094ea670e2eb7555b962",
|
||||||
"content-hash": "cf263546eb8ba91f81f26bdc5470573e",
|
"content-hash": "cf263546eb8ba91f81f26bdc5470573e",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
@ -1088,12 +1088,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hillelcoren/omnipay-wepay.git",
|
"url": "https://github.com/hillelcoren/omnipay-wepay.git",
|
||||||
"reference": "916785146c5433e9216f295d09d1cbcec2fdf33a"
|
"reference": "f8bb3e4010c236018e4bd936f1b930b87f17e063"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/hillelcoren/omnipay-wepay/zipball/916785146c5433e9216f295d09d1cbcec2fdf33a",
|
"url": "https://api.github.com/repos/hillelcoren/omnipay-wepay/zipball/f8bb3e4010c236018e4bd936f1b930b87f17e063",
|
||||||
"reference": "916785146c5433e9216f295d09d1cbcec2fdf33a",
|
"reference": "f8bb3e4010c236018e4bd936f1b930b87f17e063",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1125,7 +1125,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/hillelcoren/omnipay-wepay/tree/address-fix"
|
"source": "https://github.com/hillelcoren/omnipay-wepay/tree/address-fix"
|
||||||
},
|
},
|
||||||
"time": "2016-11-01 10:54:54"
|
"time": "2016-12-12 18:28:29"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "container-interop/container-interop",
|
"name": "container-interop/container-interop",
|
||||||
@ -7270,7 +7270,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/event-dispatcher",
|
"name": "symfony/event-dispatcher",
|
||||||
"version": "v2.8.13",
|
"version": "v2.8.14",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||||
@ -7379,16 +7379,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/http-foundation",
|
"name": "symfony/http-foundation",
|
||||||
"version": "v2.8.13",
|
"version": "v2.8.14",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/http-foundation.git",
|
"url": "https://github.com/symfony/http-foundation.git",
|
||||||
"reference": "a6e6c34d337f3c74c39b29c5f54d33023de8897c"
|
"reference": "4f8c167732bbf3ba4284c0915f57b332091f6b68"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/a6e6c34d337f3c74c39b29c5f54d33023de8897c",
|
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/4f8c167732bbf3ba4284c0915f57b332091f6b68",
|
||||||
"reference": "a6e6c34d337f3c74c39b29c5f54d33023de8897c",
|
"reference": "4f8c167732bbf3ba4284c0915f57b332091f6b68",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -7430,7 +7430,7 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony HttpFoundation Component",
|
"description": "Symfony HttpFoundation Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2016-10-24 15:52:36"
|
"time": "2016-11-15 23:02:12"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/http-kernel",
|
"name": "symfony/http-kernel",
|
||||||
@ -7570,16 +7570,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-mbstring",
|
"name": "symfony/polyfill-mbstring",
|
||||||
"version": "v1.2.0",
|
"version": "v1.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||||
"reference": "dff51f72b0706335131b00a7f49606168c582594"
|
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594",
|
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
|
||||||
"reference": "dff51f72b0706335131b00a7f49606168c582594",
|
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -7591,7 +7591,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.2-dev"
|
"dev-master": "1.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -7625,20 +7625,20 @@
|
|||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2016-05-18 14:26:46"
|
"time": "2016-11-14 01:06:16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-php54",
|
"name": "symfony/polyfill-php54",
|
||||||
"version": "v1.2.0",
|
"version": "v1.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-php54.git",
|
"url": "https://github.com/symfony/polyfill-php54.git",
|
||||||
"reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1"
|
"reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1",
|
"url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0",
|
||||||
"reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1",
|
"reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -7647,7 +7647,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.2-dev"
|
"dev-master": "1.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -7683,20 +7683,20 @@
|
|||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2016-05-18 14:26:46"
|
"time": "2016-11-14 01:06:16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-php55",
|
"name": "symfony/polyfill-php55",
|
||||||
"version": "v1.2.0",
|
"version": "v1.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-php55.git",
|
"url": "https://github.com/symfony/polyfill-php55.git",
|
||||||
"reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d"
|
"reference": "03e3f0350bca2220e3623a0e340eef194405fc67"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d",
|
"url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67",
|
||||||
"reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d",
|
"reference": "03e3f0350bca2220e3623a0e340eef194405fc67",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -7706,7 +7706,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.2-dev"
|
"dev-master": "1.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -7739,7 +7739,7 @@
|
|||||||
"portable",
|
"portable",
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"time": "2016-05-18 14:26:46"
|
"time": "2016-11-14 01:06:16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-php56",
|
"name": "symfony/polyfill-php56",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user