Skip to content
Snippets Groups Projects
Commit da8f3971 authored by Andy Summers's avatar Andy Summers
Browse files

Use CBS Pricing API v2

parent 2f9d27d8
No related branches found
No related tags found
1 merge request!56Use CBS Pricing API v2
......@@ -4,7 +4,7 @@ namespace edu\wisc\services\cbs\price;
use edu\wisc\services\cbs\api\SoapService;
use edu\wisc\services\cbs\common\MoneyConversion;
use edu\wisc\services\cbs\common\WssSoapHeaderBuilder;
use edu\wisc\services\cbs\price\generated\DOIT_SOA_PRICING_Service;
use edu\wisc\services\cbs\price\generated\DOIT_SOA_PRICING_V2_Service;
use edu\wisc\services\cbs\price\generated\InputParameters;
use Money\Money;
......@@ -26,9 +26,9 @@ class SoapPriceService implements PriceService, SoapService
$this->soapClient = $priceSoapClient;
return;
}
$this->soapClient = new DOIT_SOA_PRICING_Service(
$this->soapClient = new DOIT_SOA_PRICING_V2_Service(
[],
__DIR__ . '/../../../../../resources/doit_soa_pricing.xml'
__DIR__ . '/../../../../../resources/doit_soa_pricing_v2.xml'
);
$this->soapClient->__setSoapHeaders(WssSoapHeaderBuilder::buildUsernameToken($username, $password));
}
......@@ -39,7 +39,13 @@ class SoapPriceService implements PriceService, SoapService
public function updateProductPrice($sku, Money $price)
{
$outputParameters = $this->soapClient->ITEM_PRICING(
new InputParameters($sku, MoneyConversion::convertMoneyToFloat($price), '', '')
new InputParameters(
$sku,
MoneyConversion::convertMoneyToFloat($price),
'',
'',
'TBD'
)
);
return new PriceServiceResponse(
strcasecmp($outputParameters->getP_STATUS(), 'SUCCESS') === 0,
......
......@@ -2,7 +2,7 @@
namespace edu\wisc\services\cbs\price\generated;
class DOIT_SOA_PRICING_Service extends \SoapClient
class DOIT_SOA_PRICING_V2_Service extends \SoapClient
{
/**
......@@ -29,7 +29,7 @@ class DOIT_SOA_PRICING_Service extends \SoapClient
'features' => 1,
), $options);
if (!$wsdl) {
$wsdl = 'src/main/resources/doit_soa_pricing.xml';
$wsdl = 'src/main/resources/doit_soa_pricing_v2.xml';
}
parent::__construct($wsdl, $options);
}
......
......@@ -25,18 +25,25 @@ class InputParameters
*/
protected $P_REFERENCE = null;
/**
* @var string $P_TEST_MODE
*/
protected $P_TEST_MODE = null;
/**
* @param string $P_ITEM_NUMBER
* @param float $P_GLOBAL_PRICE
* @param string $P_WEBSITE_PRICING
* @param string $P_REFERENCE
* @param string $P_TEST_MODE
*/
public function __construct($P_ITEM_NUMBER, $P_GLOBAL_PRICE, $P_WEBSITE_PRICING, $P_REFERENCE)
public function __construct($P_ITEM_NUMBER, $P_GLOBAL_PRICE, $P_WEBSITE_PRICING, $P_REFERENCE, $P_TEST_MODE)
{
$this->P_ITEM_NUMBER = $P_ITEM_NUMBER;
$this->P_GLOBAL_PRICE = $P_GLOBAL_PRICE;
$this->P_WEBSITE_PRICING = $P_WEBSITE_PRICING;
$this->P_REFERENCE = $P_REFERENCE;
$this->P_TEST_MODE = $P_TEST_MODE;
}
/**
......@@ -111,4 +118,22 @@ class InputParameters
return $this;
}
/**
* @return string
*/
public function getP_TEST_MODE()
{
return $this->P_TEST_MODE;
}
/**
* @param string $P_TEST_MODE
* @return \edu\wisc\services\cbs\price\generated\InputParameters
*/
public function setP_TEST_MODE($P_TEST_MODE)
{
$this->P_TEST_MODE = $P_TEST_MODE;
return $this;
}
}
<?php
function autoload_70173490c18532fc3ab042b291218500($class)
function autoload_0206368e05ead65395e6a2c400991a7e($class)
{
$classes = array(
'edu\wisc\services\cbs\price\generated\DOIT_SOA_PRICING_Service' => __DIR__ .'/DOIT_SOA_PRICING_Service.php',
'edu\wisc\services\cbs\price\generated\DOIT_SOA_PRICING_V2_Service' => __DIR__ .'/DOIT_SOA_PRICING_V2_Service.php',
'edu\wisc\services\cbs\price\generated\InputParameters' => __DIR__ .'/InputParameters.php',
'edu\wisc\services\cbs\price\generated\OutputParameters' => __DIR__ .'/OutputParameters.php',
'edu\wisc\services\cbs\price\generated\SOAHeader' => __DIR__ .'/SOAHeader.php'
......@@ -14,7 +14,7 @@
};
}
spl_autoload_register('autoload_70173490c18532fc3ab042b291218500');
spl_autoload_register('autoload_0206368e05ead65395e6a2c400991a7e');
// Do nothing. The rest is just leftovers from the code generation.
{
......
<?xml version = '1.0' encoding = 'UTF-8'?><definitions name="DOIT_SOA_PRICING_V2" targetNamespace="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_pricing_v2/" xmlns:tns="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_pricing_v2/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns1="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_pricing_v2/item_pricing/"> <types> <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_pricing_v2/item_pricing/"> <include schemaLocation="http://pegasus.doit.wisc.edu:8018/webservices/SOAProvider/plsql/doit_soa_pricing_v2/APPS_DOIT_SOA_PRICING_V2_ITEM_PRICING.xsd"/> </schema> <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/doit_soa_pricing_v2/"> <element name="SOAHeader"> <complexType> <sequence> <element name="Responsibility" minOccurs="0" type="string"/> <element name="RespApplication" minOccurs="0" type="string"/> <element name="SecurityGroup" minOccurs="0" type="string"/> <element name="NLSLanguage" minOccurs="0" type="string"/> <element name="Org_Id" minOccurs="0" type="string"/> </sequence> </complexType> </element> </schema> </types> <message name="ITEM_PRICING_Input_Msg"> <part name="header" element="tns:SOAHeader"/> <part name="body" element="tns1:InputParameters"/> </message> <message name="ITEM_PRICING_Output_Msg"> <part name="body" element="tns1:OutputParameters"/> </message> <portType name="DOIT_SOA_PRICING_V2_PortType"> <operation name="ITEM_PRICING"> <input message="tns:ITEM_PRICING_Input_Msg"/> <output message="tns:ITEM_PRICING_Output_Msg"/> </operation> </portType> <binding name="DOIT_SOA_PRICING_V2_Binding" type="tns:DOIT_SOA_PRICING_V2_PortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="ITEM_PRICING"> <soap:operation soapAction="http://pegasus.doit.wisc.edu:8018/webservices/SOAProvider/plsql/doit_soa_pricing_v2/"/> <input> <soap:header message="tns:ITEM_PRICING_Input_Msg" part="header" use="literal"/> <soap:body parts="body" use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="DOIT_SOA_PRICING_V2_Service"> <port name="DOIT_SOA_PRICING_V2_Port" binding="tns:DOIT_SOA_PRICING_V2_Binding"> <soap:address location="http://pegasus.doit.wisc.edu:8018/webservices/SOAProvider/plsql/doit_soa_pricing_v2/"/> </port> </service></definitions>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment