This is where your description should go. Take a look at contributing.md to see a to do list.
Via Composer
$ composer require innovaweb/transbank
private $webpay_plus;
public function __construct()
{
if (env('APP_ENV') == 'production') {
$this->webpay_plus = new WebpayPlus(
env('TBK_CC'),
env('TBK_API_KEY'),
WebpayPlus::PRODUCTION
);
} else {
$this->webpay_plus = new WebpayPlus();
}
}
createTransaction($buy_order, $session_id, $amount, $url_return);
commitTransaction($token_ws);
refundTransaction($token, $amount);
getTransactionStatus($token);
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Innovaweb\Transbank\Helpers\HelperTransbankResponseCode;
use Innovaweb\Transbank\WebpayPlus;
class WebpayPlusController extends Controller
{
private $webpay_plus;
public function __construct()
{
if (env('APP_ENV') == 'production') {
$this->webpay_plus = new WebpayPlus(
env('TBK_CC'),
env('TBK_API_KEY'),
WebpayPlus::PRODUCTION
);
} else {
$this->webpay_plus = new WebpayPlus();
}
}
public function create(Request $request)
{
$response = $this->webpay_plus->createTransaction(
$request->buy_order,
'session' . $request->buy_order,
$request->amount,
route('response-wp-plus')
);
return $this->webpay_plus->redirectHTML();
}
public function response(Request $request)
{
if ($request->token_ws) {
$commit = $this->webpay_plus->commitTransaction($request->token_ws);
$response = $commit['response'];
return [
$response,
'vci' => HelperTransbankResponseCode::VCI($response->vci),
'responseCode' => HelperTransbankResponseCode::ResponseCode($response->responseCode),
'paymentTypeCode' => HelperTransbankResponseCode::PaymentTypeCode($response->paymentTypeCode),
'status' => HelperTransbankResponseCode::Status($response->status),
];
} else {
//transacción anulada
return $request->all();
}
}
}
Please see the changelog for more information on what has changed recently.
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
MIT. Please see the license file for more information.