mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 01:34: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['$client_name'] = ['value' => $this->client->present()->name() ?: ' ', 'label' => ctrans('texts.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.address2'] = &$data['$address2'];
|
||||
$data['$client_address'] = ['value' => $this->client->present()->address() ?: ' ', 'label' => ctrans('texts.address')];
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\PaymentDrivers;
|
||||
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
@ -86,17 +87,18 @@ class PaytracePaymentDriver extends BaseDriver
|
||||
|
||||
public function refund(Payment $payment, $amount, $return_client_response = false)
|
||||
{
|
||||
$cgt = ClientGatewayToken::where('company_gateway_id', $payment->company_gateway_id)
|
||||
->where('gateway_type_id', $payment->gateway_type_id)
|
||||
->first();
|
||||
// $cgt = ClientGatewayToken::where('company_gateway_id', $payment->company_gateway_id)
|
||||
// ->where('gateway_type_id', $payment->gateway_type_id)
|
||||
// ->first();
|
||||
|
||||
$data = [
|
||||
'amount' => $amount,
|
||||
'customer_id' => $cgt->token,
|
||||
//'customer_id' => $cgt->token,
|
||||
'transaction_id' => $payment->transaction_reference,
|
||||
'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)
|
||||
{
|
||||
@ -181,8 +183,10 @@ class PaytracePaymentDriver extends BaseDriver
|
||||
$url = 'https://api.paytrace.com/oauth/token';
|
||||
$data = [
|
||||
'grant_type' => 'password',
|
||||
'username' => $this->company_gateway->getConfigField('username'),
|
||||
'password' => $this->company_gateway->getConfigField('password')
|
||||
'username' => config('ninja.testvars.paytrace.username'),
|
||||
'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);
|
||||
|
@ -84,6 +84,10 @@ return [
|
||||
'test_email' => env('TEST_EMAIL', 'test@example.com'),
|
||||
'wepay' => env('WEPAY_KEYS', ''),
|
||||
'braintree' => env('BRAINTREE_KEYS', ''),
|
||||
'paytrace' => [
|
||||
'username' => env('PAYTRACE_U', ''),
|
||||
'password' => env('PAYTRACE_P','')
|
||||
],
|
||||
],
|
||||
'contact' => [
|
||||
'email' => env('MAIL_FROM_ADDRESS'),
|
||||
|
@ -146,22 +146,14 @@ PTPayment.setup({
|
||||
PTPayment.getControl("securityCode").label.text("{!! ctrans('texts.cvv')!!}");
|
||||
PTPayment.getControl("creditCard").label.text("{!! ctrans('texts.card_number')!!}");
|
||||
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){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// To trigger the validation of sensitive data payment fields within the iframe before calling the tokenization process:
|
||||
PTPayment.validate(function(validationErrors) {
|
||||
|
||||
if (validationErrors.length >= 1 && token_payment == false) {
|
||||
|
||||
if (validationErrors.length >= 1 && !token_payment) {
|
||||
let errors = document.getElementById('errors');
|
||||
|
||||
errors.textContent = '';
|
||||
@ -170,6 +162,11 @@ PTPayment.setup({
|
||||
|
||||
} else {
|
||||
// no error so tokenize
|
||||
if(token_payment){
|
||||
|
||||
tokenPayment();
|
||||
}
|
||||
|
||||
instance.process()
|
||||
.then( (r) => {
|
||||
submitPayment(r);
|
||||
@ -200,5 +197,11 @@ function submitPayment(r){
|
||||
|
||||
}
|
||||
|
||||
|
||||
function tokenPayment(){
|
||||
|
||||
document.getElementById("server_response").submit();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
Loading…
x
Reference in New Issue
Block a user