当前位置: 首页>>代码示例>>PHP>>正文


PHP Transaction::setId方法代码示例

本文整理汇总了PHP中Transaction::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::setId方法的具体用法?PHP Transaction::setId怎么用?PHP Transaction::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


在下文中一共展示了Transaction::setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fromJson

 public static function fromJson($json)
 {
     if (!isset($json->item) && !isset($json->checkout)) {
         throw new \Exception('both checkout and item are null');
     }
     if (isset($json->item) && isset($json->checkout)) {
         throw new \Exception('both checkout and item are non-null, only expected one of checkout or item');
     }
     $r = new Transaction();
     $r->setId($json->id);
     $r->setExternalId(isset($json->external_id) ? $json->external_id : null);
     $r->setCreated($json->created);
     $r->setState($json->state);
     $r->setRevisionNumber($json->revision_number);
     $r->setProject($json->project);
     $r->setItem(isset($json->item) ? Item::fromJson($json->item) : null);
     $r->setCheckout(isset($json->checkout) ? Checkout::fromJson($json->checkout) : null);
     $r->setCustomer(Customer::fromJson($json->customer));
     $r->setPrice(Price::fromJson($json->price));
     $r->setPaymentMethod($json->payment_method);
     $r->setTest(isset($json->test) ? $json->test : false);
     return $r;
 }
开发者ID:purchased-at,项目名称:sdk-php,代码行数:23,代码来源:Transaction.php

示例2: testRollback_NoTransactionCapability_ThrowsException

 public function testRollback_NoTransactionCapability_ThrowsException()
 {
     $this->client = $this->getMock('Everyman\\Neo4j\\Client', array('hasCapability'), array($this->transport));
     $this->client->expects($this->any())->method('hasCapability')->will($this->returnValue(false));
     $transaction = new Transaction($this->client);
     $transaction->setId(321);
     $this->transport->expects($this->never())->method('delete');
     $this->setExpectedException('\\Everyman\\Neo4j\\Exception');
     $this->client->rollbackTransaction($transaction);
 }
开发者ID:MobilityMaster,项目名称:neo4jphp,代码行数:10,代码来源:Client_TransactionTest.php

示例3: handleIpn

 /**
  * Verifica se uma notificação IPN é válida, fazendo a autenticação
  * da mensagem segundo o protocolo de segurança do serviço.
  *
  * @param array $message Um array contendo a notificação recebida.
  * @return boolean TRUE se a notificação for autência, ou FALSE se não for.
  *
  */
 function handleIpn(array $message)
 {
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $this->endpoint);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_POST, true);
     curl_setopt($curl, CURLOPT_SSLVERSION, 6);
     //curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
     //curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($message));
     $response = curl_exec($curl);
     $error = curl_error($curl);
     $errno = curl_errno($curl);
     curl_close($curl);
     if (!empty($error) || $errno > 0 || $response != 'VERIFIED') {
         return array('error' => 'Not verified', 'errors' => $error);
     }
     if ($_POST['receiver_email'] != $this->getReceiverEmail()) {
         return array('error' => 'Receiver mail is different', 'errors' => array('expected' => $this->receiverEmail, 'returned' => $_POST['receiver_email']));
     }
     $arr = array_merge(array('txn_id' => null, 'txn_type' => null, 'payment_status' => null, 'pending_reason' => null, 'reason_code' => null, 'custom' => null, 'invoice' => null, 'address_country' => null, 'address_city' => null, 'address_country_code' => null, 'address_name' => null, 'address_state' => null, 'address_status' => null, 'address_street' => null, 'address_zip' => null, 'contact_phone' => null, 'first_name' => null, 'last_name' => null, 'business_name' => null, 'payer_email' => null, 'payer_id' => null, 'mc_currency' => null, 'mc_gross' => null, 'mc_fee' => null, 'mc_handling' => null, 'mc_shipping' => null, 'tax' => null), $message);
     //$this->ipnLog("....");
     //$this->ipnLog(json_encode($arr));
     $notification = new Notification();
     $notification->setTxnId($arr['txn_id']);
     $notification->setTxnType($arr['txn_type']);
     $notification->setReceiverEmail($arr['receiver_email']);
     $notification->setPaymentStatus($arr['payment_status']);
     $notification->setPendingReason($arr['pending_reason']);
     $notification->setReasonCode($arr['reason_code']);
     $notification->setCustom($arr['custom']);
     $notification->setInvoice($arr['invoice']);
     $customer = new Customer();
     $customer->setAddressCountry($arr['address_country']);
     $customer->setAddressCity($arr['address_city']);
     $customer->setAddressCountryCode($arr['address_country_code']);
     $customer->setAddressName($arr['address_name']);
     $customer->setAddressState($arr['address_state']);
     $customer->setAddressStatus($arr['address_status']);
     $customer->setAddressStreet($arr['address_street']);
     $customer->setAddressZip($arr['address_zip']);
     $customer->setContactPhone($arr['contact_phone']);
     $customer->setFirstName($arr['first_name']);
     $customer->setLastName($arr['last_name']);
     $customer->setBusinessName($arr['business_name']);
     $customer->setEmail($arr['payer_email']);
     $customer->setPaypalId($arr['payer_id']);
     $transaction = new Transaction();
     $transaction->setId(null);
     $transaction->setTxnId($arr['txn_id']);
     $transaction->setTxnType($arr['txn_type']);
     $transaction->setPaymentStatus($arr['payment_status']);
     $transaction->setPendingReason($arr['pending_reason']);
     $transaction->setReasonCode($arr['reason_code']);
     $transaction->setCustom($arr['custom']);
     $transaction->setInvoice($arr['invoice']);
     $transaction->setPayerId($arr['payer_id']);
     $transaction->setCurrency($arr['mc_currency']);
     $transaction->setGross($arr['mc_gross']);
     $transaction->setFee($arr['mc_fee']);
     $transaction->setHandling($arr['mc_handling']);
     $transaction->setShipping($arr['mc_shipping']);
     $transaction->setTax($arr['tax']);
     return array('notification' => $notification, 'customer' => $customer, 'transaction' => $transaction);
 }
开发者ID:ricardo93borges,项目名称:easy-paypal,代码行数:74,代码来源:Ipn.php

示例4: retrieveByClient

  static public function retrieveByClient($status, $client_id = null)
  {
//echo $status;
    $types= array('all','sell','purchase','switch');
    $statuses= array('all','pending','completed','cancelled');    
    if(!in_array($status,$statuses))
    if(!in_array($status,$types))    
      die('Wrong status when getting tranaction collection!');
    $IsTypeOriented = in_array($status,$statuses) ? false: true;
    if(!$client_id)
      die('Should add case for all clients!');


    $transactions= array();
    if($IsTypeOriented)
      $addition = ($status!= 'all') ? " AND types = '$status'" : "";
    else
      $addition = ($status!= 'all') ? " AND status = '$status'" : "";
      
    $query = " SELECT t.id, t.created_at, t.comment_user, t.comment_admin, a.name aname, i.fund_name name,
    i.ISIN code, t.status, t.types, t.amount1  FROM transactions t, custody_ac a, fund i
    WHERE t.id_client = '$client_id' AND a.id = t.id_account AND i.id = t.id_isin1 $addition ";
    
//echo $query;

    $qres=mysql_query($query) or die(mysql_error());
    while($row=mysql_fetch_assoc($qres))
    {
      if(trim($row['id_isin2']))
      {
        $query = " SELECT name, code FROM isin WHERE id = '".trim($row['id_isin2'])."' LIMIT 1";
        //die($query);
        $qres1=mysql_query($query);
        $crow=mysql_fetch_assoc($qres1);
      }


      $transaction = new Transaction();
      $transaction->setId($row['id']);
      $transaction->setStatus($row['status']);
      $transaction->setType($row['types']);
      $transaction->setCommentUser($row['comment_user']);
      $transaction->setCommentAdmin($row['comment_admin']);
      $transaction->setSecurity1($row['name']);
      $transaction->setAmount1($row['amount1']);
      $transaction->setSecurity2($crow['name']?$crow['name']:0);
      $transaction->setAmount2($row['amount2']);
      $transaction->setIsin($row['code']);
      $transaction->setIsin2($crow['code']);
      $transaction->setAccount($row['aname']);
      $transaction->setDatetime($row['created_at']);
      $transactions[] = $transaction;

    }

    return $transactions;
  }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:57,代码来源:transactioncollection.class.php


注:本文中的Transaction::setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。