mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Confirmed paytrace working EXCEPT pay page
This commit is contained in:
parent
5729578926
commit
429570227d
@ -133,7 +133,7 @@ class PaymentEmailEngine extends BaseEmailEngine
|
|||||||
$data['$email'] = ['value' => isset($this->contact) ? $this->contact->email : 'no contact email on record', 'label' => ctrans('texts.email')];
|
$data['$email'] = ['value' => isset($this->contact) ? $this->contact->email : 'no contact email on record', 'label' => ctrans('texts.email')];
|
||||||
$data['$client_name'] = ['value' => $this->client->present()->name() ?: ' ', 'label' => ctrans('texts.client_name')];
|
$data['$client_name'] = ['value' => $this->client->present()->name() ?: ' ', 'label' => ctrans('texts.client_name')];
|
||||||
$data['$client.name'] = &$data['$client_name'];
|
$data['$client.name'] = &$data['$client_name'];
|
||||||
$data['$client'] = &$data['client_name'];
|
$data['$client'] = &$data['$client_name'];
|
||||||
$data['$client.address1'] = &$data['$address1'];
|
$data['$client.address1'] = &$data['$address1'];
|
||||||
$data['$client.address2'] = &$data['$address2'];
|
$data['$client.address2'] = &$data['$address2'];
|
||||||
$data['$client_address'] = ['value' => $this->client->present()->address() ?: ' ', 'label' => ctrans('texts.address')];
|
$data['$client_address'] = ['value' => $this->client->present()->address() ?: ' ', 'label' => ctrans('texts.address')];
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\PaymentDrivers;
|
namespace App\PaymentDrivers;
|
||||||
|
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Models\ClientGatewayToken;
|
use App\Models\ClientGatewayToken;
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
@ -86,17 +87,18 @@ class PaytracePaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function refund(Payment $payment, $amount, $return_client_response = false)
|
public function refund(Payment $payment, $amount, $return_client_response = false)
|
||||||
{
|
{
|
||||||
$cgt = ClientGatewayToken::where('company_gateway_id', $payment->company_gateway_id)
|
// $cgt = ClientGatewayToken::where('company_gateway_id', $payment->company_gateway_id)
|
||||||
->where('gateway_type_id', $payment->gateway_type_id)
|
// ->where('gateway_type_id', $payment->gateway_type_id)
|
||||||
->first();
|
// ->first();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'customer_id' => $cgt->token,
|
//'customer_id' => $cgt->token,
|
||||||
|
'transaction_id' => $payment->transaction_reference,
|
||||||
'integrator_id' => '959195xd1CuC'
|
'integrator_id' => '959195xd1CuC'
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->gatewayRequest('/v1/transactions/refund/to_customer', $data);
|
$response = $this->gatewayRequest('/v1/transactions/refund/for_transaction', $data);
|
||||||
|
|
||||||
if($response && $response->success)
|
if($response && $response->success)
|
||||||
{
|
{
|
||||||
@ -181,8 +183,10 @@ class PaytracePaymentDriver extends BaseDriver
|
|||||||
$url = 'https://api.paytrace.com/oauth/token';
|
$url = 'https://api.paytrace.com/oauth/token';
|
||||||
$data = [
|
$data = [
|
||||||
'grant_type' => 'password',
|
'grant_type' => 'password',
|
||||||
'username' => $this->company_gateway->getConfigField('username'),
|
'username' => config('ninja.testvars.paytrace.username'),
|
||||||
'password' => $this->company_gateway->getConfigField('password')
|
'password' => config('ninja.testvars.paytrace.password'),
|
||||||
|
//'username' => $this->company_gateway->getConfigField('username'),
|
||||||
|
//'password' => $this->company_gateway->getConfigField('password')
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = CurlUtils::post($url, $data, $headers = false);
|
$response = CurlUtils::post($url, $data, $headers = false);
|
||||||
|
@ -84,6 +84,10 @@ return [
|
|||||||
'test_email' => env('TEST_EMAIL', 'test@example.com'),
|
'test_email' => env('TEST_EMAIL', 'test@example.com'),
|
||||||
'wepay' => env('WEPAY_KEYS', ''),
|
'wepay' => env('WEPAY_KEYS', ''),
|
||||||
'braintree' => env('BRAINTREE_KEYS', ''),
|
'braintree' => env('BRAINTREE_KEYS', ''),
|
||||||
|
'paytrace' => [
|
||||||
|
'username' => env('PAYTRACE_U', ''),
|
||||||
|
'password' => env('PAYTRACE_P','')
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'contact' => [
|
'contact' => [
|
||||||
'email' => env('MAIL_FROM_ADDRESS'),
|
'email' => env('MAIL_FROM_ADDRESS'),
|
||||||
|
@ -146,22 +146,14 @@ PTPayment.setup({
|
|||||||
PTPayment.getControl("securityCode").label.text("{!! ctrans('texts.cvv')!!}");
|
PTPayment.getControl("securityCode").label.text("{!! ctrans('texts.cvv')!!}");
|
||||||
PTPayment.getControl("creditCard").label.text("{!! ctrans('texts.card_number')!!}");
|
PTPayment.getControl("creditCard").label.text("{!! ctrans('texts.card_number')!!}");
|
||||||
PTPayment.getControl("expiration").label.text("{!! ctrans('texts.expires')!!}");
|
PTPayment.getControl("expiration").label.text("{!! ctrans('texts.expires')!!}");
|
||||||
//PTPayment.style({'cc': {'label_color': 'red'}});
|
|
||||||
//PTPayment.style({'code': {'label_color': 'red'}});
|
|
||||||
//PTPayment.style({'exp': {'label_color': 'red'}});
|
|
||||||
//PTPayment.style({'exp':{'type':'dropdown'}});
|
|
||||||
|
|
||||||
//PTPayment.theme('horizontal');
|
|
||||||
// this can be any event we chose. We will use the submit event and stop any default event handling and prevent event handling bubbling.
|
|
||||||
document.getElementById("server_response").addEventListener("submit",function(e){
|
document.getElementById("server_response").addEventListener("submit",function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
// To trigger the validation of sensitive data payment fields within the iframe before calling the tokenization process:
|
|
||||||
PTPayment.validate(function(validationErrors) {
|
PTPayment.validate(function(validationErrors) {
|
||||||
|
|
||||||
if (validationErrors.length >= 1 && token_payment == false) {
|
if (validationErrors.length >= 1 && !token_payment) {
|
||||||
|
|
||||||
let errors = document.getElementById('errors');
|
let errors = document.getElementById('errors');
|
||||||
|
|
||||||
errors.textContent = '';
|
errors.textContent = '';
|
||||||
@ -170,6 +162,11 @@ PTPayment.setup({
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// no error so tokenize
|
// no error so tokenize
|
||||||
|
if(token_payment){
|
||||||
|
|
||||||
|
tokenPayment();
|
||||||
|
}
|
||||||
|
|
||||||
instance.process()
|
instance.process()
|
||||||
.then( (r) => {
|
.then( (r) => {
|
||||||
submitPayment(r);
|
submitPayment(r);
|
||||||
@ -200,5 +197,11 @@ function submitPayment(r){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function tokenPayment(){
|
||||||
|
|
||||||
|
document.getElementById("server_response").submit();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user