コード例 #1
0
 public function addUserGroup()
 {
     $usergroup = new user();
     $post = json_decode(Flight::request()->getBody());
     DuoWorldCommon::mapToObject($post, $usergroup);
     $client = ObjectStoreClient::WithNamespace(DuoWorldCommon::GetHost(), "UserGroup", "123");
     $usergroup->active = true;
     $respond = $client->store()->byKeyField("groupId")->andStore($usergroup);
     echo json_encode($respond);
 }
コード例 #2
0
ファイル: product.php プロジェクト: pamidu/LedgerService
 public function getProducts()
 {
     # code...
     $pid = new getproduct();
     $post = json_decode(Flight::request()->getBody());
     DuoWorldCommon::mapToObject($post, $pid);
     $client = ObjectStoreClient::WithNamespace(DuoWorldCommon::GetHost(), "Products", "123");
     $respond = $client->get()->byKey($post->productId);
     echo json_encode($respond);
 }
コード例 #3
0
ファイル: leger.php プロジェクト: pamidu/LedgerService
 public function Payment()
 {
     $makepay = new MakePayment();
     $post = json_decode(Flight::request()->getBody());
     DuoWorldCommon::mapToObject($post, $makepay);
     if ($makepay->referrence != '') {
         if (is_array($makepay->referrence)) {
             // multiple payments
             //[{"id":"55e6e5e031700","amount":500},{"id":"55e6e5e031700","amount":30}]
             foreach ($makepay->referrence as $refid) {
                 $refTransac = $this->getbyInvoiceNumber($refid->id);
                 $newRecord = new ledgerFeilds();
                 $newRecord->InvoiceNumber = $makepay->InvoiceNumber;
                 $newRecord->Date = $makepay->Date;
                 $newRecord->TransactionType = $makepay->TransactionType;
                 $newRecord->Description = $makepay->Description;
                 $newRecord->OtherData = $makepay->OtherData;
                 $newRecord->Amount = $refid->amount;
                 $newRecord->Balance = $makepay->Balance;
                 $newRecord->TennentId = $makepay->TennentId;
                 echo json_encode($this->addRecord($newRecord));
                 $refTransac->Balance = $refTransac->Balance - $refid->amount;
                 echo json_encode($this->addRecord($refTransac));
             }
         } else {
             //single payment
             $refTransac = $this->getbyInvoiceNumber($makepay->referrence);
             //$makepay->InvoiceNumber=$this->getInvoiceNumber();
             echo json_encode($this->addRecord($makepay));
             echo json_encode($refTransac->Balance);
             $refTransac->Balance = $refTransac->Balance - $makepay->Amount;
             echo json_encode($refTransac->Balance);
             echo json_encode($this->addRecord($refTransac));
         }
     } else {
         //payment without refference (Advanced Payment)
         echo json_encode("Advanced Payment Not Allowed");
     }
 }