예제 #1
0
 public function importIPN($get)
 {
     if (strpos($get['text'], ' received from ') !== FALSE) {
         $temp = array("SUPER_TYPE" => Transaction::MONEY_IN, "TYPE" => Transaction::MPESA_PAYBILL_PAYMENT_RECIEVED, "RECEIPT" => $get['mpesa_code'], "TIME" => Scrubber::dateInput($get['tstamp']), "PHONE" => '0' . substr($get['mpesa_msisdn'], -9), "NAME" => $get['mpesa_sender'], "ACCOUNT" => $get['mpesa_acc'], "STATUS" => Transaction::STATUS_COMPLETED, "AMOUNT" => Scrubber::numberInput($get['mpesa_amt']), "BALANCE" => 0, "NOTE" => $get['text'], "COST" => 0);
         if ($temp['AMOUNT'] > 0 and $temp['RECEIPT'] != "") {
             $tuple = Transaction::updateData($temp, $this);
             if ($tuple[1]) {
                 // Callback if needed
                 $this->handleCallback($tuple[0]);
             }
             return $tuple[0];
         }
         return null;
     } elseif (strpos($get['text'], ' transferred from Utility Account to Working Account.') !== FALSE) {
         $temp = array("SUPER_TYPE" => Transaction::MONEY_IN, "TYPE" => Transaction::MPESA_PAYBILL_TRANSFER_FROM_UTILITY, "RECEIPT" => $get['mpesa_code'], "TIME" => Scrubber::dateInput($get['tstamp']), "PHONE" => '', "NAME" => '', "ACCOUNT" => '', "STATUS" => Transaction::STATUS_COMPLETED, "AMOUNT" => Scrubber::numberInput($get['mpesa_amt']), "BALANCE" => 0, "NOTE" => $get['text'], "COST" => 0);
         if ($temp['AMOUNT'] > 0 and $temp['RECEIPT'] != "") {
             $tuple = Transaction::updateData($temp, $this);
             if ($tuple[1]) {
                 // Callback if needed
                 $this->handleCallback($tuple[0]);
             }
             return $tuple[0];
         }
         return null;
     } else {
         // Unknown transaction.
         $temp = array("SUPER_TYPE" => Transaction::MONEY_NEUTRAL, "TYPE" => Transaction::MPESA_PAYBILL_UNKOWN, "RECEIPT" => $get['mpesa_code'], "TIME" => Scrubber::dateInput($get['tstamp']), "PHONE" => '', "NAME" => '', "ACCOUNT" => '', "STATUS" => Transaction::STATUS_COMPLETED, "AMOUNT" => 0, "BALANCE" => 0, "NOTE" => serialize($get), "COST" => 0);
         if ($temp['AMOUNT'] > 0 and $temp['RECEIPT'] != "") {
             $tuple = Transaction::updateData($temp, $this);
             if ($tuple[1]) {
                 // Callback if needed
                 $this->handleCallback($tuple[0]);
             }
             return $tuple[0];
         }
         return null;
     }
 }
예제 #2
0
 public function importIPN($get)
 {
     $temp = array("SUPER_TYPE" => Transaction::MONEY_IN, "TYPE" => Transaction::MPESA_PAYBILL_PAYMENT_RECIEVED, "RECEIPT" => $get['mpesa_code'], "TIME" => Scrubber::dateInput($get['tstamp']), "PHONE" => '0' . substr($get['mpesa_msisdn'], -9), "NAME" => $get['mpesa_sender'], "ACCOUNT" => $get['mpesa_acc'], "STATUS" => Transaction::STATUS_COMPLETED, "AMOUNT" => Scrubber::numberInput($get['mpesa_amt']), "BALANCE" => 0, "NOTE" => $get['text'], "COST" => 0);
     if ($temp['AMOUNT'] > 0 and $temp['RECEIPT'] != "") {
         $transaction = Transaction::updateData($temp, $this);
         // Callback if needed
         $this->handleCallback($transaction);
         return $transaction;
     }
     return null;
 }