Skip to content

Commit 1c4076d

Browse files
authored
Merge pull request #5 from akaunting/dev-30
Akaunting 3.0 compatibility
2 parents 8a95132 + 0163336 commit 1c4076d

File tree

8 files changed

+48
-48
lines changed

8 files changed

+48
-48
lines changed

.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/.idea
2-
/.history
3-
/.vscode
4-
/.vagrant
5-
/node_modules
6-
/storage/*.key
1+
/.idea
2+
/.history
3+
/.vscode
4+
/.vagrant
5+
/node_modules
6+
/storage/*.key
77
/vendor

Http/Controllers/Payment.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Payment extends PaymentController
1717

1818
public $type = 'redirect';
1919

20-
public function show(Document $invoice, PaymentRequest $request)
20+
public function show(Document $invoice, PaymentRequest $request, $cards = [])
2121
{
2222
$setting = $this->setting;
2323

@@ -30,8 +30,10 @@ public function show(Document $invoice, PaymentRequest $request)
3030
}
3131

3232
$invoice_url = $this->getInvoiceUrl($invoice);
33+
$return_url = $this->getReturnUrl($invoice);
34+
$confirm_url = $this->getConfirmUrl($invoice);
3335

34-
$html = view('paypal-standard::show', compact('setting', 'invoice', 'invoice_url'))->render();
36+
$html = view('paypal-standard::show', compact('setting', 'invoice', 'invoice_url', 'return_url', 'confirm_url'))->render();
3537

3638
return response()->json([
3739
'code' => $setting['code'],
@@ -66,13 +68,15 @@ public function return(Document $invoice, Request $request)
6668

6769
if ($success) {
6870
flash($message)->success();
71+
72+
$url = $this->getFinishUrl($invoice);
6973
} else {
7074
flash($message)->warning();
71-
}
7275

73-
$invoice_url = $this->getInvoiceUrl($invoice);
76+
$url = $this->getInvoiceUrl($invoice);
77+
}
7478

75-
return redirect($invoice_url);
79+
return redirect($url);
7680
}
7781

7882
public function complete(Document $invoice, Request $request)

Resources/views/show.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<?php $i = 1; ?>
2424
@foreach ($invoice->items as $item)
2525
<input type="hidden" name="item_name_{{ $i }}" value="{{ $item->name }}" />
26-
<input type="hidden" name="amount_{{ $i }}" value="{{ $invoice->amount }}" />
26+
<input type="hidden" name="amount_{{ $i }}" value="{{ $item->price }}" />
2727
<input type="hidden" name="quantity_{{ $i }}" value="{{ $item->quantity }}" />
2828
<?php $i++; ?>
2929
@endforeach
@@ -39,8 +39,8 @@
3939
<input type="hidden" name="no_note" value="1" />
4040
<input type="hidden" name="no_shipping" value="1" />
4141
<input type="hidden" name="charset" value="utf-8" />
42-
<input type="hidden" name="return" value="{{ route('portal.paypal-standard.invoices.return', $invoice->id) }}" />
43-
<input type="hidden" name="notify_url" value="{{ route('portal.paypal-standard.invoices.complete', $invoice->id) }}" />
42+
<input type="hidden" name="return" value="{{ $return_url }}" />
43+
<input type="hidden" name="notify_url" value="{{ $confirm_url }}" />
4444
<input type="hidden" name="cancel_return" value="{{ $invoice_url }}" />
4545
<input type="hidden" name="paymentaction" value="{{ $setting['transaction'] }}" />
4646
<input type="hidden" name="custom" value="{{ $invoice->id }}" />

Routes/guest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
Route::portal('paypal-standard', function () {
1212
Route::get('invoices/{invoice}/complete', 'Payment@return')->name('invoices.return');
13-
Route::post('invoices/{invoice}/complete', 'Payment@complete')->name('invoices.complete');
13+
Route::post('invoices/{invoice}/complete', 'Payment@complete')->name('invoices.confirm');
1414
}, ['middleware' => 'guest']);

Routes/signed.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@
1010

1111
Route::signed('paypal-standard', function () {
1212
Route::get('invoices/{invoice}', 'Payment@show')->name('invoices.show');
13+
Route::get('invoices/{invoice}/complete', 'Payment@return')->name('invoices.return');
14+
Route::post('invoices/{invoice}/complete', 'Payment@complete')->name('invoices.confirm');
1315
});

Tests/Feature/SettingsTest.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,20 @@
66

77
class SettingsTest extends FeatureTestCase
88
{
9-
public function testItShouldSeePaypalStandardInSettingsListPage()
10-
{
11-
$this->loginAs()
12-
->get(route('settings.index'))
13-
->assertStatus(200)
14-
->assertSeeText(trans('paypal-standard::general.description'));
15-
}
16-
179
public function testItShouldSeePaypalStandardSettingsUpdatePage()
1810
{
1911
$this->loginAs()
2012
->get(route('settings.module.edit', ['alias' => 'paypal-standard']))
21-
->assertStatus(200);
13+
->assertOk()
14+
->assertSeeText(trans('paypal-standard::general.name'))
15+
->assertSeeText(trans('paypal-standard::general.description'));
2216
}
2317

2418
public function testItShouldUpdatePaypalStandardSettings()
2519
{
2620
$this->loginAs()
2721
->patch(route('settings.module.edit', ['alias' => 'paypal-standard']), $this->getRequest())
28-
->assertStatus(200);
22+
->assertOk();
2923

3024
$this->assertFlashLevel('success');
3125
}

crowdin.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
"project_id_env": CROWDIN_PROJECT_ID
2-
"api_token_env": CROWDIN_PERSONAL_TOKEN
3-
"preserve_hierarchy": true
4-
5-
"files": [
6-
{
7-
"source": "Resources/lang/en-GB/general.php",
8-
"dest": "paypal-standard/general.php",
9-
"translation": "Resources/lang/%locale%/paypal-standard/general.php",
10-
"translation_replace": {
11-
"paypal-standard/": ""
12-
}
13-
}
14-
]
1+
"project_id_env": CROWDIN_PROJECT_ID
2+
"api_token_env": CROWDIN_PERSONAL_TOKEN
3+
"preserve_hierarchy": true
4+
5+
"files": [
6+
{
7+
"source": "Resources/lang/en-GB/general.php",
8+
"dest": "paypal-standard/general.php",
9+
"translation": "Resources/lang/%locale%/paypal-standard/general.php",
10+
"translation_replace": {
11+
"paypal-standard/": ""
12+
}
13+
}
14+
]

module.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"alias": "paypal-standard",
3-
"icon": "fab fa-paypal",
3+
"icon": "simple-icons-paypal",
44
"version": "2.0.1",
55
"active": 1,
66
"providers": [
@@ -14,7 +14,7 @@
1414
"widgets": [],
1515
"settings": [
1616
{
17-
"type": "textGroup",
17+
"type": "text",
1818
"name": "name",
1919
"title": "general.name",
2020
"icon": "fa fa-font",
@@ -24,7 +24,7 @@
2424
"rules": "required|string"
2525
},
2626
{
27-
"type": "textGroup",
27+
"type": "text",
2828
"name": "email",
2929
"title": "paypal-standard::general.form.email",
3030
"icon": "envelope",
@@ -34,7 +34,7 @@
3434
"rules": "required|email"
3535
},
3636
{
37-
"type": "selectGroup",
37+
"type": "select",
3838
"name": "mode",
3939
"title": "paypal-standard::general.form.mode",
4040
"icon": "plane",
@@ -49,7 +49,7 @@
4949
"rules": "required|string"
5050
},
5151
{
52-
"type": "selectGroup",
52+
"type": "select",
5353
"name": "transaction",
5454
"title": "paypal-standard::general.form.transaction",
5555
"icon": "exchange-alt",
@@ -64,23 +64,23 @@
6464
"rules": "required|string"
6565
},
6666
{
67-
"type": "accountSelectGroup",
67+
"type": "account",
6868
"name": "account_id",
6969
"attributes": {
7070
"required": "required"
7171
},
7272
"rules": "required"
7373
},
7474
{
75-
"type": "textGroup",
75+
"type": "text",
7676
"name": "order",
7777
"title": "paypal-standard::general.form.order",
7878
"icon": "sort",
7979
"attributes": {},
8080
"rules": "nullable|integer"
8181
},
8282
{
83-
"type": "radioGroup",
83+
"type": "toggle",
8484
"name": "customer",
8585
"title": "paypal-standard::general.form.customer",
8686
"enable": "general.yes",
@@ -89,7 +89,7 @@
8989
"rules": "required|integer"
9090
},
9191
{
92-
"type": "radioGroup",
92+
"type": "toggle",
9393
"name": "debug",
9494
"title": "paypal-standard::general.form.debug",
9595
"enable": "general.yes",

0 commit comments

Comments
 (0)