Exemple #1
0
 /**
  * @deprecated
  * @param array $data
  * @return OpenPayU_Result
  */
 public static function create($data)
 {
     $pathUrl = OpenPayU_Configuration::getServiceUrl() . 'token' . OpenPayU_Configuration::getDataFormat(true);
     $xml = OpenPayU_Util::buildXmlFromArray($data, 'TokenCreateRequest');
     $result = self::verifyResponse(OpenPayU_Http::post($pathUrl, $xml), 'TokenCreateResponse');
     return $result;
 }
Exemple #2
0
 /**
  * Creates new Order
  * - Sends to PayU OrderCreateRequest
  *
  * @access public
  * @param array $order A array containing full Order
  * @return object $result Response array with OrderCreateResponse
  * @throws OpenPayU_Exception
  */
 public static function create($order)
 {
     $pathUrl = OpenPayU_Configuration::getServiceUrl() . self::ORDER_SERVICE;
     $data = OpenPayU_Util::buildJsonFromArray($order);
     if (empty($data)) {
         throw new OpenPayU_Exception('Empty message OrderCreateRequest');
     }
     $result = self::verifyResponse(OpenPayU_Http::post($pathUrl, $data), 'OrderCreateResponse');
     return $result;
 }
Exemple #3
0
 /**
  * Function make refund for order
  * @param $orderId
  * @param $description
  * @param int $amount Amount of refund in pennies
  * @return null|OpenPayU_Result
  * @throws OpenPayU_Exception
  */
 public static function create($orderId, $description, $amount = null)
 {
     if (empty($orderId)) {
         throw new OpenPayU_Exception('Invalid orderId value for refund');
     }
     if (empty($description)) {
         throw new OpenPayU_Exception('Invalid description of refund');
     }
     $refund = array('orderId' => $orderId, 'refund' => array('description' => $description));
     if (!empty($amount)) {
         $refund['refund']['amount'] = (int) $amount;
     }
     $pathUrl = OpenPayU_Configuration::getServiceUrl() . 'orders/' . $refund['orderId'] . '/refund';
     $data = OpenPayU_Util::buildJsonFromArray($refund);
     if (empty($data)) {
         throw new OpenPayU_Exception('Empty message RefundCreateResponse');
     }
     $result = self::verifyResponse(OpenPayU_Http::post($pathUrl, $data), 'RefundCreateResponse');
     return $result;
 }