Dokoncano placevanje preko paypala
This commit is contained in:
parent
4c69969d68
commit
2f0964e086
@ -272,7 +272,7 @@ class ApiNarocilaController{
|
||||
|
||||
if(isset($this->data['narocilo_id'])){
|
||||
$paypal = new UserNarocilaPaypal($this->data['narocilo_id']);
|
||||
$this->response = $paypal->paypalCaptureOrder();
|
||||
$this->response = $paypal->paypalCancelOrder();
|
||||
}
|
||||
else{
|
||||
$this->response['error'] = 'Napaka! Manjka ID narocila!';
|
||||
|
@ -820,7 +820,7 @@ class UserNarocila{
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Dokoncaj narocilo s placilom preko predracuna - TODO
|
||||
// Dokoncaj narocilo s placilom preko predracuna
|
||||
private function finishNarociloPaypal($narocilo_id, $narocilo_data){
|
||||
global $lang;
|
||||
|
||||
|
@ -102,9 +102,9 @@ class UserNarocilaPaypal{
|
||||
|
||||
// Vstavimo plačilo v bazo
|
||||
$sqlNarocilo = sisplet_query("INSERT INTO user_access_paypal_transaction
|
||||
(transaction_id, narocilo_id, price, currency_type, time)
|
||||
(transaction_id, narocilo_id, price, currency_type, time, status)
|
||||
VALUES
|
||||
('".$paypal_response['transaction_id']."', '".$this->narocilo['id']."', '".$cena_za_placilo."', 'EUR', NOW())
|
||||
('".$paypal_response['transaction_id']."', '".$this->narocilo['id']."', '".$cena_za_placilo."', 'EUR', NOW(), 'CREATED')
|
||||
");
|
||||
if (!$sqlNarocilo){
|
||||
$response['error'] = 'ERROR! '.mysqli_error($GLOBALS['connect_db']);
|
||||
@ -242,7 +242,21 @@ class UserNarocilaPaypal{
|
||||
}
|
||||
|
||||
|
||||
$response['status'] = $paypal_response->result->status;
|
||||
// Nastavimo narocilo na placano, aktiviramo paket in vrnemo racun
|
||||
$narocilo = new UserNarocila();
|
||||
$payment_response = $narocilo->payNarocilo($this->narocilo['id']);
|
||||
|
||||
if($payment_response['success'] == true){
|
||||
$response['racun'] = $payment_response['racun'];
|
||||
$response['success'] = true;
|
||||
}
|
||||
else{
|
||||
$response['error'] = $payment_response['error'];
|
||||
$response['success'] = false;
|
||||
}
|
||||
|
||||
$response['narocilo_id'] = $this->narocilo['id'];
|
||||
|
||||
|
||||
$response['success'] = true;
|
||||
|
||||
@ -257,7 +271,7 @@ class UserNarocilaPaypal{
|
||||
|
||||
// Posodobimo status narocila
|
||||
$sqlNarocilo = sisplet_query("UPDATE user_access_paypal_transaction
|
||||
SET status='CANCELED'
|
||||
SET status='CANCELLED'
|
||||
WHERE narocilo_id='".$this->narocilo['id']."'
|
||||
");
|
||||
if (!$sqlNarocilo){
|
||||
@ -267,6 +281,15 @@ class UserNarocilaPaypal{
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Nastavimo status narocila na storniran
|
||||
$sqlNarociloStatus = sisplet_query("UPDATE user_access_narocilo SET status='2' WHERE id='".$this->narocilo['id']."'");
|
||||
if (!$sqlNarociloStatus){
|
||||
$response['error'] = 'ERROR! '.mysqli_error($GLOBALS['connect_db']);
|
||||
$response['success'] = false;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
$response['success'] = true;
|
||||
|
||||
return $response;
|
||||
|
@ -9331,3 +9331,7 @@ ALTER TABLE srv_anketa ADD subsequent_answers ENUM('0', '1') NOT NULL DEFAULT '1
|
||||
INSERT INTO srv_help (help, what) VALUES ('Uporabnik ne more nikoli naknadno urejati svojih odgovorov (npr. s klikom nazaj)', 'srv_subsequent_answers');
|
||||
|
||||
UPDATE misc SET value='20.10.20' WHERE what="version";
|
||||
|
||||
ALTER TABLE user_access_paypal_transaction CHANGE transaction_id transaction_id VARCHAR(100) NOT NULL DEFAULT '';
|
||||
|
||||
UPDATE misc SET value='20.10.25' WHERE what="version";
|
||||
|
Loading…
x
Reference in New Issue
Block a user