detsta processing -> move to cart if not successfull, transfer/paymentLater changes
This commit is contained in:
@@ -52,8 +52,6 @@ class DetStaDBSave extends Object
|
||||
|
||||
/**
|
||||
*
|
||||
* @param common\models\Ugiro;
|
||||
* @param common\models\giro\GiroDETSTA $giroDETSTA
|
||||
* */
|
||||
protected function saveMessageDetsta( ) {
|
||||
$this->message = new MessageDetsta();
|
||||
|
||||
@@ -3,20 +3,15 @@ namespace common\components;
|
||||
|
||||
|
||||
use yii\base\Object;
|
||||
use common\models\TicketInstallmentRequest;
|
||||
use common\components\giro\GiroDETSTATetel;
|
||||
use common\models\Ugiro;
|
||||
use common\components\giro\GiroDETSTA;
|
||||
use common\components\giro\GiroDETSTAFej;
|
||||
use common\components\giro\GiroDETSTALab;
|
||||
use common\components\DetStaDBSave;
|
||||
|
||||
|
||||
/**
|
||||
* This is the model class for table "ticket".
|
||||
*
|
||||
* @property common\components\giro\GiroDETSTA $detstatUzenet
|
||||
* @property common\models\UGiro $koteg
|
||||
* @property \common\components\giro\GiroDETSTA $detstatUzenet
|
||||
* @property \common\models\UGiro $koteg
|
||||
*
|
||||
* */
|
||||
class DetStatProcessor extends Object{
|
||||
@@ -120,14 +115,19 @@ class DetStatProcessor extends Object{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function readKoteg(){
|
||||
$this->koteg = Ugiro::findOne($this->idKoteg );
|
||||
if ( !isset($this->koteg) ){
|
||||
$this->errors [] = "Kötege nem található! (".$this->detstatUzenet->fej." )";
|
||||
/** @var DetStatProcessor $this */
|
||||
$this->errors [] = "Köteg nem található! (".$this->detstatUzenet->fej ." )";
|
||||
}
|
||||
}
|
||||
|
||||
public function readKotegMegbizasok(){
|
||||
$this->megbizasok = $this->koteg->requests;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace common\components;
|
||||
|
||||
use common\models\Transfer;
|
||||
use yii\base\Object;
|
||||
use common\models\TicketInstallmentRequest;
|
||||
use common\components\giro\GiroDETSTATetel;
|
||||
@@ -11,10 +12,10 @@ use common\models\Contract;
|
||||
/**
|
||||
* This is the model class for table "ticket".
|
||||
*
|
||||
* @property common\components\giro\GiroDETSTATetel $tetel
|
||||
* @property common\models\TicketInstallmentRequest $megbizas
|
||||
* @property common\models\Ticket $ticket
|
||||
* @property common\models\Contract $contract
|
||||
* @property \common\components\giro\GiroDETSTATetel $tetel
|
||||
* @property \common\models\TicketInstallmentRequest $megbizas
|
||||
* @property \common\models\Ticket $ticket
|
||||
* @property \common\models\Contract $contract
|
||||
*
|
||||
*
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ class DetStatTetelProcessor extends Object {
|
||||
* */
|
||||
protected $comment;
|
||||
/**
|
||||
* A bérlet objectkum, amit elmentettünk
|
||||
* A bérlet objektum, amit elmentettünk
|
||||
* */
|
||||
protected $ticket;
|
||||
/**
|
||||
@@ -58,13 +59,13 @@ class DetStatTetelProcessor extends Object {
|
||||
|
||||
\Yii::info('Megbízás feldolgozása: megbízás azonosító=' .$this->megbizas->id_ticket_installment_request);
|
||||
|
||||
if ($this->isAlreadeyAccepted ()) {
|
||||
if ($this->isAlreadyAccepted ()) {
|
||||
\Yii::info('A megbízás feldolgozásának megszakítása. A megbízás már elfogadott: megbízás azonosító=' .$this->megbizas->id_ticket_installment_request);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !isset($this->tetel)){
|
||||
\Yii::info('A megbízás feldolgozásának megszakítása. Nincs valaszsor a detsta üzenetben');
|
||||
\Yii::info('A megbízás feldolgozásának megszakítása. Nincs válasz sor a detsta üzenetben');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,6 +76,8 @@ class DetStatTetelProcessor extends Object {
|
||||
|
||||
if ( $this->status == TicketInstallmentRequest::$STATUS_ACCEPTED ){
|
||||
$this->buyNewTicket();
|
||||
}else if ( $this->status == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL ){
|
||||
$this->putTicketToCustomerCart();
|
||||
}else{
|
||||
$this->doRejectRequest();
|
||||
}
|
||||
@@ -85,23 +88,26 @@ class DetStatTetelProcessor extends Object {
|
||||
protected function rememberEredetiMegbizasStatus(){
|
||||
$this->eredetiMegbizasStatus = $this->megbizas->status;
|
||||
}
|
||||
|
||||
protected function isEredetiMegbizasStatusFinished(){
|
||||
return $this->eredetiMegbizasStatus == TicketInstallmentRequest::$STATUS_ACCEPTED ||
|
||||
$this->eredetiMegbizasStatus == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL ||
|
||||
$this->eredetiMegbizasStatus == TicketInstallmentRequest::$STATUS_REJECTED;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isEredetiMegbizasStatusFinished(){
|
||||
return TicketInstallmentRequest::$STATUS_ACCEPTED == $this->eredetiMegbizasStatus ||
|
||||
TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL == $this->eredetiMegbizasStatus ||
|
||||
TicketInstallmentRequest::$STATUS_REJECTED == $this->eredetiMegbizasStatus;
|
||||
}
|
||||
|
||||
protected function buyNewTicket(){
|
||||
\Yii::info('Új bérlet vásárlás folyamant indítása' );
|
||||
|
||||
\Yii::info('Új bérlet vásárlás folyamat indítása' );
|
||||
|
||||
$megbizas = $this->megbizas;
|
||||
$customer = $this->contract->customer;
|
||||
$card = $customer->card;
|
||||
$account = Account::findOne(1);
|
||||
$ticketType = $this->contract->ticketType;
|
||||
$discount = $this->contract->discount;
|
||||
|
||||
|
||||
$ticketSale = new TicketSale(
|
||||
[
|
||||
'ticketType'=> $ticketType,
|
||||
@@ -111,20 +117,53 @@ class DetStatTetelProcessor extends Object {
|
||||
'discount'=> $discount,
|
||||
'contract'=> $this->contract,
|
||||
'ticketInstallmentRequest' => $megbizas
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$ticketSale->doSale();
|
||||
\Yii::info('Bérlet és tranzakció elmentve' );
|
||||
|
||||
|
||||
$this->transfer = $ticketSale->transfer;
|
||||
$this->ticket = $ticketSale->ticket;
|
||||
|
||||
|
||||
$this->updateContractOnSuccess();
|
||||
$this->updateMegbizasOnSuccess();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function putTicketToCustomerCart(){
|
||||
\Yii::info('Új bérlet vásárló kosarába helyezés folyamat indítása' );
|
||||
|
||||
$megbizas = $this->megbizas;
|
||||
$customer = $this->contract->customer;
|
||||
$card = $customer->card;
|
||||
$account = Account::findOne(1);
|
||||
$ticketType = $this->contract->ticketType;
|
||||
$discount = $this->contract->discount;
|
||||
|
||||
$ticketSale = new TicketSale(
|
||||
[
|
||||
'ticketType'=> $ticketType,
|
||||
'customer'=> $customer,
|
||||
'account'=> $account,
|
||||
'card'=> $card,
|
||||
'discount'=> $discount,
|
||||
'contract'=> $this->contract,
|
||||
'ticketInstallmentRequest' => $megbizas,
|
||||
'transferStatus' => Transfer::STATUS_NOT_PAID
|
||||
]
|
||||
);
|
||||
|
||||
$ticketSale->doSale();
|
||||
\Yii::info('Bérlet és tranzakció elmentve' );
|
||||
|
||||
$this->transfer = $ticketSale->transfer;
|
||||
$this->ticket = $ticketSale->ticket;
|
||||
|
||||
$this->updateContractOnSuccess();
|
||||
$this->updateMegbizasOnSuccess();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A szerződés betöltése
|
||||
* */
|
||||
@@ -139,7 +178,7 @@ class DetStatTetelProcessor extends Object {
|
||||
* */
|
||||
protected function updateMegbizasOnSuccess(){
|
||||
|
||||
\Yii::info('Megbízás frissítése - megbizás elfogadva ' );
|
||||
\Yii::info('Megbízás frissítése - megbízás elfogadva ' );
|
||||
|
||||
$this->megbizas->status = $this->status;
|
||||
$this->megbizas->id_transfer = $this->transfer->id_transfer;
|
||||
@@ -161,7 +200,7 @@ class DetStatTetelProcessor extends Object {
|
||||
* */
|
||||
protected function updateMegbizasOnFail(){
|
||||
|
||||
\Yii::info('Megbázás frissítése - megbízás visszautasítva ' );
|
||||
\Yii::info('Megbízás frissítése - megbízás visszautasítva ' );
|
||||
|
||||
$this->megbizas->status = $this->status;
|
||||
$this->megbizas->detsta_answer = $this->kod;
|
||||
@@ -269,12 +308,12 @@ class DetStatTetelProcessor extends Object {
|
||||
if ($this->kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT) {
|
||||
$this->status = TicketInstallmentRequest::$STATUS_ACCEPTED;
|
||||
} else {
|
||||
$this->status = TicketInstallmentRequest::$STATUS_REJECTED;
|
||||
$this->status = TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL;
|
||||
}
|
||||
\Yii::info('Visszajelző kód kiolvasva: kod=' .$this->kod);
|
||||
\Yii::info('Visszajelző kód kiolvasva: statusz=' .$this->status. " (" . TicketInstallmentRequest::toStatusName($this->status) .")");
|
||||
}
|
||||
protected function isAlreadeyAccepted() {
|
||||
protected function isAlreadyAccepted() {
|
||||
return $this->megbizas->isStatusAccepted ();
|
||||
}
|
||||
public function hasError() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -75,10 +75,11 @@ class TransferPayout extends \yii\base\Object{
|
||||
public function isTransferCountMatchWithRequestesTransferCount(){
|
||||
return count($this->transfers) == count($this->idTransfers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param common\models\Transfer $transfer the transfer to payout
|
||||
* */
|
||||
* @param \common\models\Transfer $transfer the transfer to payout
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function payoutTransfer($transfer){
|
||||
|
||||
$transfer->paid_by = $this->idUser;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace common\components\giro;
|
||||
|
||||
use common\components\giro\GiroBase;
|
||||
use \common\components\giro\GiroBase;
|
||||
|
||||
class GiroBankszamla extends GiroBase{
|
||||
|
||||
|
||||
@@ -5,18 +5,43 @@ namespace common\components\giro;
|
||||
use backend\models\GiroKotegForm;
|
||||
class GiroBase {
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
* @param $hossz
|
||||
* @param string $pad_string
|
||||
* @return string
|
||||
*/
|
||||
public function mezoKitolt($input, $hossz, $pad_string = "") {
|
||||
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
* @param $hossz
|
||||
* @param string $pad_string
|
||||
* @return string
|
||||
*/
|
||||
public function szamKitolt($input, $hossz, $pad_string = "0") {
|
||||
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
* @param $hossz
|
||||
* @param string $pad_string
|
||||
* @return string
|
||||
*/
|
||||
public function szamKitoltJobb($input, $hossz, $pad_string = "0") {
|
||||
return str_pad($input, $hossz, $pad_string, STR_PAD_RIGHT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
* @param $hossz
|
||||
* @param string $pad_string
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function szovegKitolt($input, $hossz, $pad_string = " ") {
|
||||
$data = $input;
|
||||
$data = GiroKotegForm::transliterate($data);
|
||||
@@ -28,15 +53,32 @@ class GiroBase {
|
||||
// echo strlen($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function szovegOlvas($row,$start,$length, $padchar = " "){
|
||||
|
||||
/**
|
||||
* @param $row
|
||||
* @param $start
|
||||
* @param $length
|
||||
* @param string $padchar
|
||||
* @return string
|
||||
*/
|
||||
public static function szovegOlvas($row, $start, $length, $padchar = " "){
|
||||
return rtrim(substr($row, $start,$length),$padchar);
|
||||
}
|
||||
|
||||
public static function szamOlvas($row,$start,$length, $padchar = "0"){
|
||||
|
||||
/**
|
||||
* @param $row
|
||||
* @param $start
|
||||
* @param $length
|
||||
* @param string $padchar
|
||||
* @return string
|
||||
*/
|
||||
public static function szamOlvas($row, $start, $length, $padchar = "0"){
|
||||
return ltrim(substr($row, $start,$length),$padchar);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function rekordVege(){
|
||||
return "\r\n";
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
namespace common\components\giro;
|
||||
|
||||
use common\components\giro\GiroBase;
|
||||
|
||||
/**
|
||||
*@property common\components\giro\GiroBeszedFej $fej
|
||||
*@property common\components\giro\GiroBeszedLab $lab
|
||||
*@property common\components\giro\GiroBeszedTetel[] $tetelek
|
||||
*@property \common\components\giro\GiroBeszedFej $fej
|
||||
*@property \common\components\giro\GiroBeszedLab $lab
|
||||
*@property \common\components\giro\GiroBeszedTetel[] $tetelek
|
||||
*
|
||||
*/
|
||||
class GiroBeszed extends GiroBase {
|
||||
@@ -18,9 +17,16 @@ class GiroBeszed extends GiroBase {
|
||||
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
|
||||
public static function createFileContent($number,$datum /**összeállítás dátum*/, $requests, $terhelesiDatum = null) {
|
||||
|
||||
|
||||
/**
|
||||
* @param $number
|
||||
* @param $datum
|
||||
* @param $requests
|
||||
* @param null $terhelesiDatum
|
||||
* @return string
|
||||
*/
|
||||
public static function createFileContent($number, $datum /**összeállítás dátum*/, $requests, $terhelesiDatum = null) {
|
||||
if ( !isset($terhelesiDatum)){
|
||||
$terhelesiDatum = date('Ymd' ,strtotime("+5 day"));
|
||||
}
|
||||
@@ -30,7 +36,12 @@ class GiroBeszed extends GiroBase {
|
||||
$s .= self::createLab($requests);
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $number
|
||||
* @param $daturm
|
||||
* @return string
|
||||
*/
|
||||
public static function createFej($number, $daturm) {
|
||||
$fej = new GiroBeszedFej ();
|
||||
$fej->duplumKod = \Yii::$app->params['ugiro_duplom_kod'];
|
||||
@@ -44,8 +55,13 @@ class GiroBeszed extends GiroBase {
|
||||
|
||||
return $fej->toString ();
|
||||
}
|
||||
|
||||
public static function createTetelek($requests,$terhelesiDatum){
|
||||
|
||||
/**
|
||||
* @param $requests
|
||||
* @param $terhelesiDatum
|
||||
* @return string
|
||||
*/
|
||||
public static function createTetelek($requests, $terhelesiDatum){
|
||||
$s = "";
|
||||
$i = 0;
|
||||
foreach ($requests as $request){
|
||||
@@ -54,10 +70,12 @@ class GiroBeszed extends GiroBase {
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param common\models\TicketInstallmentRequest $request
|
||||
* */
|
||||
* @param \common\models\TicketInstallmentRequest $request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function createTetel($request,$sorszam,$terhelesiDatum) {
|
||||
$tetel = new GiroBeszedTetel ();
|
||||
$customer = $request->customer;
|
||||
@@ -74,7 +92,11 @@ class GiroBeszed extends GiroBase {
|
||||
|
||||
return $tetel->toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $requests
|
||||
* @return string
|
||||
*/
|
||||
public static function createLab($requests) {
|
||||
$lab = new GiroBeszedLab ();
|
||||
|
||||
@@ -88,8 +110,11 @@ class GiroBeszed extends GiroBase {
|
||||
|
||||
return $lab->toString ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString( ) {
|
||||
$s = "";
|
||||
$s .= $this->fej->toString();
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
namespace common\components\giro;
|
||||
|
||||
use common\components\giro\GiroBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @property common\components\giro\GiroDETSTAFej $fej
|
||||
* @property common\components\giro\GiroDETSTALab $lab
|
||||
* @property common\components\giro\GiroDETSTATetel $tetelek
|
||||
* @property \common\components\giro\GiroDETSTAFej $fej
|
||||
* @property \common\components\giro\GiroDETSTALab $lab
|
||||
* @property \common\components\giro\GiroDETSTATetel $tetelek
|
||||
*
|
||||
*/
|
||||
class GiroDETSTA extends GiroBase {
|
||||
@@ -48,11 +47,11 @@ class GiroDETSTA extends GiroBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param common\components\giro\GiroBeszed $beszed
|
||||
* @param \common\components\giro\GiroBeszed $beszed
|
||||
* */
|
||||
public static function createBeszedAnswer($beszed){
|
||||
// /**@var common\components\giro\GiroBeszed $beszed*/
|
||||
$beszed = new GiroBeszed();
|
||||
//$beszed = new GiroBeszed();
|
||||
$detsta = new GiroDETSTA();
|
||||
$detsta->fej = new GiroDETSTAFej();
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ namespace common\components\giro;
|
||||
|
||||
|
||||
/**
|
||||
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
|
||||
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
|
||||
* @property \common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
|
||||
* @property \common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
|
||||
* */
|
||||
class GiroDETSTAFej extends GiroBase{
|
||||
|
||||
@@ -34,7 +34,11 @@ class GiroDETSTAFej extends GiroBase{
|
||||
. $this->rekordVege()
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $row
|
||||
* @return GiroDETSTAFej
|
||||
*/
|
||||
public static function parse($row){
|
||||
$fej = new GiroDETSTAFej();
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace common\components\giro;
|
||||
|
||||
/**
|
||||
*
|
||||
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
|
||||
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
|
||||
* @property \common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
|
||||
* @property \common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
|
||||
*
|
||||
*/
|
||||
class GiroDETSTATetel extends GiroBase {
|
||||
@@ -23,7 +23,7 @@ class GiroDETSTATetel extends GiroBase {
|
||||
'99' => "egyéb hiba"
|
||||
];
|
||||
|
||||
public $recordTipus = "01";
|
||||
public $recordTipus = "02";
|
||||
public $tetelSorszam = "0";
|
||||
public $osszeg = "0";
|
||||
public $eredetiTetelElszamolasiDatuma = "";
|
||||
|
||||
Reference in New Issue
Block a user