public function testWorkflow() { // generate file with own public key for the sake of decrypting in ReceiverTest $zip = __DIR__ . "/data/testMocked_self.zip"; $fdot = new FatcaDataOecdTest(); $fdot->setUp(); $fdot->conMan->config["FatcaIrsPublic"] = $fdot->conMan->config["FatcaKeyPublic"]; if (false) { // generate zip file and save $ts1 = strtotime("2010-10-05 04:03:02"); $ts2 = strftime("%Y-%m-%dT%H:%M:%S", $ts1); $fdot->oecd->MessageSpec->Timestamp = $ts2; // set sender GIIN as in config $fdot->oecd->MessageSpec->SendingCompanyIN = $fdot->conMan->config["ffaid"]; $fdo = new FatcaDataOecd($fdot->oecd); $tmtr = Transmitter::shortcut($fdo, "html", "", $fdot->conMan->config); copy($tmtr->tf4, $zip); } $rx = Receiver::shortcut($fdot->conMan->config, $zip); $this->assertEquals("CBC", $rx->rm->am->algoS); $this->assertEquals(256, strlen($rx->rm->aesEncrypted)); $this->assertEquals("amfWen1oChoLGXU8Qk+Ad80b9a7Dn53B1lFqVxELoKOd7vuTZYvtLlkjqmpgzyrc/cpuqdTDxAtpWIyMjXc1D07wK7CMpzhM0MemG+74D1M1zL5MhWME8mz0s+ninYjaeahhohV6iQVlnZ61axs8RPHtow0duP1QyRJiZSPE1qe4p9m2eoCqvsU4VczxSOiXgqppiYbW1SW0I0lj69UWEjlnCRr8FT83DRVExoAx39mPvIf5M7R+SEOjxv2+AhyaMOZmNDU4lRzUxGmM7KviGwXy8k2ZW1p6jjPid0ga109LvSvBAHPzPhLgyAUBmJCQtSOzvC+zMBnSCfG8DtjZ1A==", base64_encode($rx->rm->aesEncrypted)); $this->assertEquals(48, strlen($rx->rm->am->getAesIv())); $this->assertEquals("tnFoqXIhAQ3V8+NomTb593QC1hN8IbAVCm7VQ3f5sH24fGO9oDRz7jG9lfZRhvTX", base64_encode($rx->rm->am->getAesIv())); // echo "From: ".$rx->rm->from."\n"; // echo "To: ".$rx->rm->to."\n"; // //echo "Payload encrypted: ".$rx->dataEncrypted."\n"; // //echo "Payload decrypted: ".$rx->dataCompressed."\n"; // echo "Payload uncompressed: ".$rx->dataXmlSigned."\n"; $this->assertTrue(!!$rx->dataXmlSigned); }
public function __construct($responseData) { $this->orderItems = OrderItem::parseOrderItems($responseData); $this->receivers = Receiver::parseReceivers($responseData); if (isset($responseData["token"])) { $this->token = $responseData["token"]; } if (isset($responseData["status"])) { $this->status = $responseData["status"]; } if (isset($responseData["invoiceStatus"])) { $this->invoiceStatus = $responseData["invoiceStatus"]; } if (isset($responseData["guaranteeStatus"])) { $this->guaranteeStatus = $responseData["guaranteeStatus"]; } if (isset($responseData["guaranteeDeadlineTimestamp"])) { $this->guaranteeDeadlineTimestamp = $responseData["guaranteeDeadlineTimestamp"]; } if (isset($responseData["shippingAddress.name"])) { $this->shippingAddressName = $responseData["shippingAddress.name"]; } if (isset($responseData["shippingAddress.streetAddress"])) { $this->shippingAddressStreetAddress = $responseData["shippingAddress.streetAddress"]; } if (isset($responseData["shippingAddress.postalCode"])) { $this->shippingAddressPostalCode = $responseData["shippingAddress.postalCode"]; } if (isset($responseData["shippingAddress.city"])) { $this->shippingAddressCity = $responseData["shippingAddress.city"]; } if (isset($responseData["shippingAddress.country"])) { $this->shippingAddressCountry = $responseData["shippingAddress.country"]; } if (isset($responseData["receiverFee"])) { $this->receiverFee = $responseData["receiverFee"]; } if (isset($responseData["type"])) { $this->type = $responseData["type"]; } if (isset($responseData["currencyCode"])) { $this->currencyCode = $responseData["currencyCode"]; } if (isset($responseData["custom"])) { $this->custom = $responseData["custom"]; } if (isset($responseData["trackingId"])) { $this->trackingId = $responseData["trackingId"]; } if (isset($responseData["correlationId"])) { $this->correlationId = $responseData["correlationId"]; } if (isset($responseData["purchaseId"])) { $this->purchaseId = $responseData["purchaseId"]; } if (isset($responseData["senderEmail"])) { $this->senderEmail = $responseData["senderEmail"]; } }
function parsePayload($data) { $data = explode("\n", $data); $headers = array(); foreach ($data as $header) { $index = strpos($header, ":"); if ($index > 5) { // sanity check $headers[substr($header, 0, $index)] = trim(substr($header, $index + 1)); } } require_once 'Wildfire/Channel/Memory.php'; $memoryChannel = new Wildfire_Channel_Memory(); $receiver = new Receiver(); $receiver->setChannel($memoryChannel); // listen to messages intended for the 'page' context $receiver->addId('http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/page/0'); // listen to messages intended for the 'request' context $receiver->addId('http://registry.pinf.org/cadorn.org/insight/@meta/receiver/console/request/0'); $memoryChannel->parseReceived($headers); }
public function __construct($responseData) { $this->orderItems = OrderItem::parseOrderItems($responseData); $this->receivers = Receiver::parseReceivers($responseData); $this->token = $responseData["token"]; $this->status = $responseData["status"]; if (isset($responseData["invoiceStatus"])) { $this->invoiceStatus = $responseData["invoiceStatus"]; } if (isset($responseData["guaranteeStatus"])) { $this->guaranteeStatus = $responseData["guaranteeStatus"]; } if (isset($responseData["guaranteeDeadlineTimestamp"])) { $this->guaranteeDeadlineTimestamp = $responseData["guaranteeDeadlineTimestamp"]; } $this->type = $responseData["type"]; $this->currencyCode = $responseData["currencyCode"]; $this->custom = $responseData["custom"]; $this->trackingId = $responseData["trackingId"]; $this->correlationId = $responseData["correlationId"]; $this->purchaseId = $responseData["purchaseId"]; $this->senderEmail = $responseData["senderEmail"]; }
} ?> </div> </div> </th> </tr> </thead> <!-- email list --> <tbody> <?php foreach ($inbox_message_ids as $msg) { $message = Message::find_by_id($msg->message_id); $result = Receiver::is_msg_read($_SESSION['user_id'], $message->id); $class = 'read'; if ($result->is_read == 'true') { $class = 'read'; } else { $class = 'unread'; } ?> <!-- Single message --> <tr class="<?php echo $class; ?> "> <td> <div class="checkbox checkbox-replace"> <input type="checkbox" name="checkboxes[]" value="<?php
<link rel="stylesheet" href="../assets/css/font-icons/entypo/css/entypo.css"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic"> <link rel="stylesheet" href="../assets/css/bootstrap.css"> <link rel="stylesheet" href="../assets/css/neon-core.css"> <link rel="stylesheet" href="../assets/css/neon-theme.css"> <link rel="stylesheet" href="../assets/css/neon-forms.css"> <link rel="stylesheet" href="../assets/css/custom.css"> <?php //Get user details... $user = User::find_by_id($_SESSION['user_id']); //Get user's inbox... $sql = "select * from receivers where user_id=" . $_SESSION['user_id'] . " order by message_id desc"; $inbox_message_ids = Receiver::find_by_sql($sql); ?> <script src="../assets/js/jquery-1.11.0.min.js"></script> <!--[if lt IE 9]><script src="../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head> <body class="page-body" data-url="http://neon.dev">
<img src="../assets/images/profile_pic/<?php echo $sender->profile_pic; ?> " class="img-circle" width="30" /> <span><?php echo $sender->get_full_name(); ?> </span> (<?php echo $sender->email; ?> ) to <span>me</span> <?php } else { $receiver_ids = array(); $receiver_ids = Receiver::find_by_message_id($message->id); echo "From <span>me</span> to <br />"; foreach ($receiver_ids as $receiver_id) { $receiver = User::find_by_id($receiver_id->user_id); ?> <span> <?php echo $receiver->first_name; ?> </span> (<?php echo $receiver->email; ?> ) <br /> <?php }
/** * Undo the command and make receiver to disable displaying messages date. */ public function undo() { // sometimes, there is no receiver and this is the command which // does all the work $this->output->disableDate(); }
public function init($map = null, $prefix = '') { if ($map != null) { if (PPUtils::array_match_key($map, $prefix . "receiver.")) { $newPrefix = $prefix . "receiver."; $this->receiver = new Receiver(); $this->receiver->init($map, $newPrefix); } $mapKeyName = $prefix . 'refundStatus'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->refundStatus = $map[$mapKeyName]; } $mapKeyName = $prefix . 'refundNetAmount'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->refundNetAmount = $map[$mapKeyName]; } $mapKeyName = $prefix . 'refundFeeAmount'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->refundFeeAmount = $map[$mapKeyName]; } $mapKeyName = $prefix . 'refundGrossAmount'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->refundGrossAmount = $map[$mapKeyName]; } $mapKeyName = $prefix . 'totalOfAllRefunds'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->totalOfAllRefunds = $map[$mapKeyName]; } $mapKeyName = $prefix . 'refundHasBecomeFull'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->refundHasBecomeFull = $map[$mapKeyName]; } $mapKeyName = $prefix . 'encryptedRefundTransactionId'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->encryptedRefundTransactionId = $map[$mapKeyName]; } $mapKeyName = $prefix . 'refundTransactionStatus'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->refundTransactionStatus = $map[$mapKeyName]; } if (PPUtils::array_match_key($map, $prefix . "errorList.")) { $newPrefix = $prefix . "errorList."; $this->errorList = new ErrorList(); $this->errorList->init($map, $newPrefix); } } }
public function getOutput() { $output = array(); $output["returnUrl"] = $this->returnUrl; $output["cancelUrl"] = $this->cancelUrl; $output["ipnNotificationUrl"] = $this->ipnUrl; $output["memo"] = $this->memo; if (isset($this->localeCode)) { $output["localeCode"] = LocaleCode::ConstantToString($this->localeCode); } if (isset($this->currencyCode)) { $output["currencyCode"] = CurrencyCode::ConstantToString($this->currencyCode); } $this->sender->addSenderToOutput($output); Receiver::addReceiversToOutput($this->receivers, $output); OrderItem::addOrderItemsToOutput($this->orderItems, $output); if (isset($this->fundingConstraints)) { FundingConstraint::addConstraintsToOutput($this->fundingConstraints, $output); if (in_array(FundingConstraint::INVOICE, $this->fundingConstraints) and isset($this->invoiceFee)) { $output["invoiceFee"] = $this->invoiceFee; } } if (isset($this->custom)) { $output["custom"] = $this->custom; } if (isset($this->trackingId)) { $output["trackingId"] = $this->trackingId; } if (isset($this->feesPayer)) { $output["feesPayer"] = FeesPayer::ConstantToString($this->feesPayer); } if (isset($this->guaranteeOffered)) { $output["guaranteeOffered"] = GuaranteeOffered::ConstantToString($this->guaranteeOffered); } return $output; }
/** * @expectedException NfeFocus\Exception\FieldRequiredException */ public function testEmptyEmail() { $email = ''; $receiver = new Receiver(); $receiver->setEmail($email); }
/** * Wraps the ActiveRecord Receiver object into the ReceiverWrapper. */ public function setReceiver(Receiver $receiver) { $this->pk = $receiver->getPrimaryKey(); $this->class = get_class($receiver); }
function sanitizeTransaction($response) { $receiver = new Receiver(); $receiver->setId($response['RECEIVERID']); $receiver->setEmail($response['RECEIVEREMAIL']); $receiver->setBusiness($response['RECEIVERBUSINESS']); $customer = new Customer(); $customer->setFirstName($response['FIRSTNAME']); $customer->setLastName($response['LASTNAME']); $customer->setEmail($response['EMAIL']); $customer->setPaypalId($response['PAYERID']); $customer->setStatus($response['PAYERSTATUS']); $customer->setAddressCountryCode($response['COUNTRYCODE']); $customer->setAddressCountry($response['SHIPTOCOUNTRYNAME']); $customer->setAddressStreet($response['SHIPTOSTREET']); $customer->setAddressCity($response['SHIPTOCITY']); $customer->setAddressState($response['SHIPTOSTATE']); $customer->setAddressZip($response['SHIPTOZIP']); $customer->setAddressStatus($response['ADDRESSSTATUS']); $transaction = new Transaction(); $transaction->setSubject($response['SUBJECT']); $transaction->setTxnId($response['TRANSACTIONID']); $transaction->setTxnType($response['PAYMENTTYPE']); $transaction->setPaymentDate($response['ORDERTIME']); $transaction->setGross($response['AMT']); $transaction->setFee($response['FEEAMT']); $transaction->setCurrencyCode($response['CURRENCYCODE']); $transaction->setPaymentStatus($response['PAYMENTSTATUS']); $transaction->setPendingReason($response['PENDINGREASON']); $transaction->setReasonCode($response['REASONCODE']); $transaction->setReasonCode($response['REASONCODE']); $transaction->setReceiver($receiver); $transaction->setCustomer($customer); return $transaction; }
{ $notification =& $this->_dispatcher->post($this, 'onFoo', 'Some Info...'); echo "notification::foo is {$notification->foo}\n"; } } /** * example observer */ class Receiver { public $foo; function notify(&$notification) { echo "Received notification\n"; echo "Receiver::foo is {$this->foo}\n"; $notification->foo = 'bar'; } } $dispatcher = Event_Dispatcher::getInstance(); $sender = new Sender($dispatcher); $receiver = new Receiver(); $receiver->foo = 42; $lambda = function (&$notification) use($receiver) { echo "Function callback called!\n"; $receiver->notify(&$notification); }; // make sure you are using an ampersand here! $dispatcher->addObserver($lambda); $receiver->foo = 'bar'; echo "Sender->foo()\n"; $sender->foo();
} //Remove it from 'trash'... $message_to_remove->delete(); } //foreach... } else { if ($action == 'send') { $message = new Message(); $message->sender_id = $_SESSION['user_id']; $message->subject = $_REQUEST['subject']; $message->body = $_REQUEST['body']; $message->is_deleted = 'false'; $message->date_time = date('Y-m-d H:i:s'); $message->create(); $receiver_emails = explode(",", $_REQUEST['to']); foreach ($receiver_emails as $receiver_email) { $rcvr = User::find_by_email(trim($receiver_email)); $last_message = Message::find_last_email($receiver_email); $receiver = new Receiver(); $receiver->user_id = $rcvr->id; $receiver->message_id = $last_message->id; $receiver->is_read = 'false'; $receiver->create(); } } } } } //Action done, redirect bo back page... $page_to_return = $_SERVER['HTTP_REFERER']; redirect_to($page_to_return);
/** * execute and output "Hello World" */ public function execute() { // sometimes, there is no receiver and this is the command which // does all the work $this->output->write('Hello World'); }
private function buildReceiver( Receiver $receiver , AbstractPayPalMessageFactory $factory ) { $receiverAmount = $receiver->getAmount(); $receiverEmail = $receiver->getEmail(); $receiverInvoiceId = $receiver->getInvoiceId(); $receiverPaymentType = $receiver->getPaymentType(); $receiverPaymentSubType = $receiver->getPaymentSubType(); $receiverPhone = $receiver->getPhone(); $receiverPrimary = $receiver->isPrimary(); if ( $receiverEmail == null && $receiverPhone == null ) { throw new RuntimeException( 'You are *required* to specify the Receiver\'s email or the phone number.' ); } else { $receiverElement = $factory->createMessageElement(); $receiverElement->addChild( $factory->createMessageField( 'amount' , $factory->createMessagePrimitive( $receiverAmount ) ) ); if ( $receiverEmail != null ) { $receiverElement->addChild( $factory->createMessageField( 'email' , $factory->createMessagePrimitive( $receiverEmail ) ) ); } if ( $receiverInvoiceId != null ) { $receiverElement->addChild( $factory->createMessageField( 'invoiceId' , $factory->createMessagePrimitive( $receiverInvoiceId ) ) ); } if ( $receiverPaymentType != null ) { $receiverElement->addChild( $factory->createMessageField( 'paymentType' , $factory->createMessagePrimitive( $receiverPaymentType ) ) ); } if ( $receiverPaymentSubType != null ) { $receiverElement->addChild( $factory->createMessageField( 'paymentSubType' , $factory->createMessagePrimitive( $receiverPaymentSubType ) ) ); } if ( $receiverPhone != null ) { $receiverElement->addChild( $factory->createMessageField( 'phone' , $this->buildPhoneNumber( $receiverPhone , $factory ) ) ); } if ( $receiverPrimary != null ) { $receiverElement->addChild( $factory->createMessageField( 'primary' , $factory->createMessagePrimitive( $receiverPrimary ) ) ); } return $receiverElement; } }