Skip to content
This repository was archived by the owner on Jul 21, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions admin/admin2rest.php

This file was deleted.

2 changes: 1 addition & 1 deletion admin2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ <h1>To Do:</h1>
</div>
<div class="clear"></div>
</div>

</div>
<script src="views/src/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="views/src/js/joscha.js" type="text/javascript"></script>

Expand Down
2 changes: 1 addition & 1 deletion admin2/views/productquickedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
</div>
<div class="clear"></div>
</div>

</div>
<script src="views/src/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="views/src/js/joscha.js" type="text/javascript"></script>

Expand Down
2 changes: 1 addition & 1 deletion admin2/views/widgets/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function output()
{
ob_start();
?>
<image src="<?php echo $this->Source ?>" title="<?php echo (isset($this->Label)) ? $this->Label : "" ?>" />
<img src="<?php echo $this->Source ?>" title="<?php echo (isset($this->Label)) ? $this->Label : "" ?>" />
<?php
$output = ob_get_clean();
return $output;
Expand Down
2 changes: 1 addition & 1 deletion admin2/views/widgets/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function output()
<div class="select">

<Label for="<?php echo $this->Id ?>"><?php echo $this->Label ?></Label>
<select id="<?php echo $this->Id ?>" Type="checkbox" >
<select id="<?php echo $this->Id ?>">
<?php
foreach ($this->Options as $option => $value)
{
Expand Down
4 changes: 2 additions & 2 deletions api/library/Admin2/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ public function run(
$processedData = $this->_outputProcessor->process($this->_response);
$responseCode = $this->_response->getResponseCode();
if (!empty($responseCode)) {
header($responseCode);
header(' ', true, $responseCode);
}
} else {
header('HTTP/1.0 204 No Content', true);
header(' ', true, 204);
}

foreach ($this->_response->getResponseHeader() as $headerKey => $headerValue) {
Expand Down
124 changes: 124 additions & 0 deletions api/rest/controllers/PaymentsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?php
/**
* This file is part of Admin 2.0 project for OXID eShop CE/PE/EE.
*
* The Admin 2.0 sourcecode is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* @link http://admin20.de
* @copyright (C) 2012 :: Admin 2.0 Developers
*/

/**
* Controller handles payment actions
*/
class PaymentsController extends Admin2_Controller_Abstract
{
/**
* Get payment data
*
* Example call:
* http://yourDomain/api/rest/v1/Payments/oxidcashondel.html
*
* @return void
*/
public function get()
{
// OXIDs from demo payments for testing:
// oxidcashondel
$paymentModel = new Application_Model_Payment();
$entity = $this->_request->getEntity();
$paymentData = null;
if ($entity != null) {
$paymentData = $paymentModel->getPayment($entity);
}

if ($paymentData === null) {
$this->_response->setResponseCode(404);
$this->_response->setData(array('sMessage' => 'NOT FOUND'));
return;
}
$this->_response->setData(array('payment' => $paymentData));
}

/**
* Get list of payments
*
* @return void
*/
public function getList()
{
$paymentModel = new Application_Model_Payment();
$limit = $this->_request->getParam('limit', 50);
$offset = $this->_request->getParam('offset', 0);
$paymentData = $paymentModel->getPaymentList($limit, $offset);
$this->_response->setData(array('paymentList' => $paymentData));
}

/**
* Save list of payments
*
* @return void
*/
public function post()
{
$aPayments = (array) $this->_request->getParam('apayments');
$aResults = array();
foreach ($aPayments as $aPaymentData) {
$paymentModel = new Application_Model_Payment();
if (!$aPaymentData['oxpayments__oxid']) {
$aPaymentData['oxpayments__oxid'] = -1; // create a new entry in case no entity is provided
}
$paymentModel->savePayment($aPaymentData);
$aPaymentData['oxpayments__oxid'] = $paymentModel->getId();
$aResults[] = $aPaymentData;
}
$this->_response->setData(array('aPayments' => $aResults));
}

/**
* Create or update a payment
*
* @return void
*/
public function put()
{
$paymentModel = new Application_Model_Payment();
$aPaymentData = (array) $this->_request->getParams();
$oxid = $this->_request->getEntity();
if ($oxid) {
$aPaymentData['oxid'] = $oxid;
$ok = $paymentModel->savePayment($aPaymentData);
if ($ok) {
$this->_response->setData(array('sMessage' => 'OK'));
} else {
$this->_response->setResponseCode(400);
$this->_response->setData(array('sMessage' => 'NOT OK'));
}
} else {
$this->_response->setResponseCode(400);
$this->_response->setData(array('sMessage' => 'No entity given!'));
}
}

/**
* Delete a payment
*
* @return void
*/
public function delete()
{
$paymentModel = new Application_Model_Payment();
$entity = $this->_request->getEntity();
$paymentData = null;
if ($entity != null) {
$paymentData = $paymentModel->deletePayment($entity);
}
if ($paymentData === false) {
$this->_response->setResponseCode(404);
$this->_response->setData(array('sMessage' => 'NOT FOUND'));
return;
}
$this->_response->setData(array('sMessage' => 'OK'));
}
}
12 changes: 8 additions & 4 deletions api/rest/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,26 @@ function getShopBasePath()
/**
* Load OXID core classes.
*/
require 'modules/functions.php';
require 'core/oxfunctions.php';
if (file_exists(getShopBasePath() . "bootstrap.php")) {
require_once getShopBasePath() . "bootstrap.php";
} else {
require 'modules/functions.php';
require 'core/oxfunctions.php';
}

// Load and initialize our main autoloader.
require 'Admin2/Loader/Autoloader.php';
$loader = Admin2_Loader_Autoloader::getInstance();
$loader->registerNamespace('Admin2');

$hash = null;
$hashClass = null;
if (function_exists('hash')) {
$hashClass = new Admin2_Signature_Hash_Sha256();
} else if (function_exists('mhash')) {
$hashClass = new Admin2_Signature_Mhash_Sha256();
}

if ($hash === null) {
if ($hashClass === null) {
header('HTTP/1.0 500 Internal Server Error');
exit(255);
}
Expand Down
Loading