File tree Expand file tree Collapse file tree 6 files changed +19
-11
lines changed Expand file tree Collapse file tree 6 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,12 @@ use Omnipay\Omnipay;
21
21
22
22
$gateway = Omnipay::create('OfflineDummy');
23
23
24
- $gateway->initialize([
25
- 'url_notify' => 'http://example.com/payment/notify',
26
- 'url_return' => 'http://example.com/payment/return',
27
- ]);
28
-
29
24
$request = $gateway->purchase([
30
25
'amount' => '12.00',
31
26
'description' => 'Test purchase',
32
27
'transactionId' => 1,
28
+ 'url_notify' => 'http://example.com/payment/notify',
29
+ 'url_return' => 'http://example.com/payment/return',
33
30
])->send();
34
31
35
32
$response->redirect();
Original file line number Diff line number Diff line change 34
34
<form method =" POST" action =" /payment/process" >
35
35
<input type =" hidden" name =" transition_id" value =" {{ $transactionId } }" />
36
36
<input type =" hidden" name =" amount" value =" {{ $amount } }" />
37
+ <input type =" hidden" name =" url_notify" value =" {{ $url_notify } }" />
38
+ <input type =" hidden" name =" url_return" value =" {{ $url_return } }" />
37
39
<input type =" submit" name =" status" value =" {{ $label_success } }" />
38
40
<input type =" submit" name =" status" value =" {{ $label_denied } }" />
39
41
</form >
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ public function __invoke(Request $request)
20
20
'transactionId ' => $ request ->input ('transaction_id ' ),
21
21
'description ' => $ request ->input ('description ' ),
22
22
'amount ' => $ request ->input ('amount ' ),
23
+ 'url_notify ' => $ request ->input ('url_notify ' ),
24
+ 'url_return ' => $ request ->input ('url_return ' ),
23
25
'label_success ' => App::STATUS_SUCCESS ,
24
26
'label_denied ' => App::STATUS_DENIED ,
25
27
]);
Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ public function __invoke(Request $request)
16
16
$ response = $ gateway ->completePurchase ($ request ->all ())->send ();
17
17
18
18
Http::acceptJson ()->post (
19
- $ gateway -> getUrlNotify ( ),
19
+ $ request -> input ( ' url_notify ' ),
20
20
$ response ->getData ()
21
21
);
22
22
23
- return response ()->redirectTo ($ gateway -> getUrlReturn ( ));
23
+ return response ()->redirectTo ($ request -> input ( ' url_return ' ));
24
24
}
25
25
}
Original file line number Diff line number Diff line change @@ -35,13 +35,17 @@ public function getData()
35
35
$ this ->validate (
36
36
'amount ' ,
37
37
'description ' ,
38
- 'transactionId '
38
+ 'transactionId ' ,
39
+ 'url_notify ' ,
40
+ 'url_return ' ,
39
41
);
40
42
41
43
return [
42
44
'transaction_id ' => $ this ->getTransactionId (),
43
45
'amount ' => $ this ->getAmount (),
44
46
'description ' => $ this ->getDescription (),
47
+ 'url_notify ' => $ this ->getUrlNotify (),
48
+ 'url_return ' => $ this ->getUrlReturn (),
45
49
];
46
50
}
47
51
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ public function testPurchase()
26
26
'amount ' => '12.00 ' ,
27
27
'description ' => 'Test purchase ' ,
28
28
'transactionId ' => 1 ,
29
+ 'notify_url ' => 'http://localhost:8080/gateway/notify ' ,
30
+ 'url_return ' => 'http://localhost:8080/gateway/return ' ,
29
31
]
30
32
)->send ();
31
33
@@ -45,13 +47,14 @@ public function testCompletePurchase()
45
47
'transaction_id ' => 1 ,
46
48
'amount ' => 12.00 ,
47
49
'description ' => 'Test purchase ' ,
48
- 'notify_url ' => 'http://localhost:8080/gateway/notify ' ,
50
+ 'url_notify ' => 'http://localhost:8080/gateway/notify ' ,
51
+ 'url_return ' => 'http://localhost:8080/gateway/return ' ,
49
52
'status ' => App::STATUS_SUCCESS ,
50
53
])->assertStatus (302 )
51
- ->assertRedirect ($ this -> gateway -> getUrlReturn () );
54
+ ->assertRedirect (' http://localhost:8080/ gateway/return ' );
52
55
53
56
Http::assertSent (function ($ request ) {
54
- return $ request ->url () === $ this -> gateway -> getUrlNotify () ;
57
+ return $ request ->url () === ' http://localhost:8080/ gateway/notify ' ;
55
58
});
56
59
}
57
60
}
You can’t perform that action at this time.
0 commit comments