コード例 #1
0
ファイル: Resolver.php プロジェクト: boekkooi/icepay
 public function resolve(array $data)
 {
     Assert::that($data, null, 'data')->choicesNotEmpty(['Status', 'Checksum']);
     // The data indicates a version check
     if ($data['Status'] === VersionCheck::STATE_VERSION_CHECK) {
         return VersionCheck::generateChecksum($this->merchantId, $this->secretCode) === $data['Checksum'];
     }
     $data = $this->prepareOrderData($data);
     $order = new Order($data['PaymentMethod'], $data['OrderID'], $data['Status'], $data['PaymentID'], $data['StatusCode'], $data['TransactionID'], $data['Reference'], $data['Amount'], $data['Currency'], $data['Duration'], $data['ConsumerName'], $data['ConsumerAccountNumber'], $data['ConsumerAddress'], $data['ConsumerHouseNumber'], $data['ConsumerCity'], $data['ConsumerCountry'], $data['ConsumerEmail'], $data['ConsumerPhoneNumber'], $data['ConsumerIPAddress']);
     Assert::that($data['Checksum'], null, 'data["Checksum"]')->eq(Order::generateChecksum($this->merchantId, $this->secretCode, $order), 'Invalid Checksum in data');
     return $order;
 }
コード例 #2
0
ファイル: Order.php プロジェクト: boekkooi/icepay
 /**
  * Generate a checksum for a order.
  *
  * @param string $merchantId
  * @param string $secretCode
  * @param Order $order
  * @return string
  */
 public static function generateChecksum($merchantId, $secretCode, Order $order)
 {
     return sha1(implode('|', [$secretCode, $merchantId, $order->getStatus(), $order->getStatusCode(), $order->getOrderID(), $order->getPaymentID(), $order->getReference(), $order->getTransactionID(), $order->getAmount(), $order->getCurrency(), $order->getDuration(), $order->getConsumerIPAddress()]));
 }