rmc_website/dsidev/dsishop/NCL/ec/ec_point.html
2023-11-09 00:03:19 -05:00

410 lines
10 KiB
HTML
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../../common/css/default.css">
<style>
body
{
font-size: 10px;
}
#output
{
background-color: #CCFFCC;
}
#progress
{
background-image: url("progress_bar.gif");
background-repeat: no-repeat;
background-position: -216px 0px;
}
</style>
<script type="text/javascript" src="../common/js/default.js"></script>
<script type="text/javascript" src="ec.js"></script>
<script type="text/javascript" src="syncEc.js"></script>
<script>
<!--
/*---------- O[oタ ----------*/
var ec = new ECommerceInterface();
var gStartDate = 0;
/*---------- fobOoヘ ----------*/
function Print( mes )
{
output.innerHTML += mes + "<br>";
}
function PrintError( progress )
{
Print( "status : " + progress.status );
Print( "operation : " + progress.operation );
Print( "totalSize : " + progress.totalSize );
Print( "downloadedSize : " + progress.downloadedSize );
Print( "errCode : " + progress.errCode );
Print( "errInfo : " + progress.errInfo );
Print( "phase : " + progress.phase );
Print( "isCancelRequested : " + progress.isCancelRequested );
Print( "description : " + progress.description );
}
function ClearDebugMessages( first_mes )
{
output.innerHTML = first_mes + "<br>";
}
/*
ππIy[VπG[`FbN
*/
function CheckStartOperation( progress )
{
if ( progress == null )
{
Print("ASSERT progress == null : " + progress);
return ( false );
}
else if ( progress.status < 0 && progress.status != EC_ERROR_NOT_DONE )
{
Print("Error StartOperation!");
PrintError( progress );
return ( false );
}
else
{
return ( true );
}
}
/*
ec.getProgress() πG[`FbN
*/
function CheckProgress( progress )
{
if ( progress == null )
{
Print("ASSERT progress == null : " + progress);
return ( false );
}
else if ( progress.status < 0 )
{
Print("Error Progress!");
PrintError( progress );
return ( false );
}
else
{
return ( true );
}
}
/*
vOXo[LXV
*/
var PROGRESS_BAR_WIDTH = 216;
function UpdateProgressBar( downloaded, total )
{
var pos = -1 * PROGRESS_BAR_WIDTH;
if ( total != 0 )
pos = PROGRESS_BAR_WIDTH * downloaded / total - PROGRESS_BAR_WIDTH;
if ( pos > 0 )
pos = 0;
progress.style.backgroundPosition = pos + "px 0px";
}
/*---------- ----------*/
function InitEc()
{
var ecsUrl = "https://ecs.shop.wii.com/ecs/services/ECommerceSOAP";
var iasUrl = "https://ias.shop.wii.com/ias/services/IdentityAuthenticationSOAP";
var casUrl = "https://cas.shop.wii.com/cas/services/CatalogingSOAP";
var ccsUrl = "http://ccs.shop.wii.com/ccs/download";
var ucsUrl = "http://ccs.shop.wii.com/ccs/download";
ec.setWebSvcUrls (ecsUrl, iasUrl, casUrl);
ec.setContentUrls (ccsUrl, ucsUrl);
}
/*----------------------------------------
[ 軏{Iタ・]
ec.purchaseTitle πB
ec.getProgress ・EC_ERROR_NOT_DONE まタ闃ⅹ@оB
[ タ]
繼L本Iタ黷sB
CheckStartOperation
ec.purchaseTitle πBホG[`FbN
G[πIタOoヘ
SyncEc( "ec.getProgress()" )
ec.getProgress ナ EC_ERROR_NOT_DONE ま@v
CheckProgress
繼Lフ SyncEc πG[`FbN
G[πIタOoヘ
----------------------------------------*/
/*---------- e{^π ----------*/
/*
|Cgc
*/
function GetPoints()
{
var kong_ = new Kong();
kong_.ShowLoadingIcon();
ClearDebugMessages("GetPoint");
if ( ! CheckStartOperation( ec.refreshCachedBalance() ) )
{ kong_.HideLoadingIcon(); return(0); }
if ( ! CheckProgress( SyncEc( "ec.getProgress()" ) ) )
{ kong_.HideLoadingIcon(); return(0); }
var points = ec.getCachedBalance();
Print("Your Points : " + points + "pts");
kong_.HideLoadingIcon();
}
/*
|Cgw・
*/
function PurchasePoints( pointsToPurchase, itemId, amount, pyament )
{
var kong_ = new Kong();
kong_.ShowLoadingIcon();
var price = new ECPrice( amount, "POINTS"); //todo
var taxes = null;
var purchaseInfo = null;
var discount = null;
var progress = ec.purchasePoints( pointsToPurchase, itemId, price, pyament,
taxes, purchaseInfo, discount ); //optional
if ( ! CheckStartOperation( progress ) )
{ kong_.HideLoadingIcon(); return(0); }
if ( ! CheckProgress( SyncEc( "ec.getProgress()" ) ) )
{ kong_.HideLoadingIcon(); return(0); }
var points = ec.getCachedBalance();
Print("Your Points : " + points + "pts");
kong_.HideLoadingIcon();
}
/*
tH[辜NWbgJ[h﨣k取ト ECCreditCardPaymentタ@
*/
function GetCreditCardPaymentFromForm()
{
var cc = new ECCreditCardPayment();
/*
cc.kind = null; //EC_CreditCardKind_Visa; //todo VISA ナ
cc.month = parseInt( point.cc_month.value ); //@lH
cc.year = parseInt( point.cc_year.value ); //@lH
cc.number = point.cc_number.value;
cc.cvv2 = point.cc_cvv2.value;
cc.owner = point.cc_owner.value;
cc.billingCity = point.cc_billingCity.value;
cc.billingState = point.cc_billingState.value;
cc.billingPostal = point.cc_billingPostal.value;
*/
cc.kind = 'M';
cc.month = parseInt( point.cc_month.value ); //@lH
cc.year = parseInt( point.cc_year.value ); //@lH
cc.number = point.cc_number.value;
cc.cvv2 = point.cc_cvv2.value;
return ( cc );
}
/*
tH[躙ii|CgvyChJ[h﨣k取ト ECECardPayment タ@
*/
function GetECardInfoPaymentFromForm()
{
var eCard = new ECECardPayment();
eCard.number = point.eCard_number.value;
return( eCard );
}
/*
NWbgJ[hナWii|CgLw・
*/
function PurchasePointsByCreditCard()
{
ClearDebugMessages("PurchasePointsByCreditCard");
var payment = GetCreditCardPaymentFromForm();
var itemId = point.itemId.value;
var pointsToPurchase = point.pointsToPurchase.value;
var amount = point.amount.value;
PurchasePoints( pointsToPurchase, itemId, amount, payment );
}
/*
Wii|CgvyChJ[hナWii|CgLw・
*/
function PurchasePointsByECard()
{
ClearDebugMessages("PurchasePointsByECard");
var payment = GetECardInfoPaymentFromForm();
var itemId = point.itemId.value;
var pointsToPurchase = point.pointsToPurchase.value;
var amount = point.amount.value;
PurchasePoints( pointsToPurchase, itemId, amount, payment );
}
/*
_E[hLXV
*/
function DownloadStatusUpdate()
{
var progress = ec.getProgress();
if ( progress.status == EC_ERROR_NOT_DONE )
{
//_E[h
ClearDebugMessages("Downloading...");
var nowDate = new Date();
var time = nowDate.getTime() - gStartDate.getTime();
Print("Time : " + time + "[ms]");
if ( progress.totalSize != 0 )
Print( progress.downloadedSize + "/" + progress.totalSize + "[bytes]");
UpdateProgressBar( progress.downloadedSize, progress.totalSize );
setTimeout( "DownloadStatusUpdate()", 1 ); //todo interval
}
else if ( progress.status < 0 )
{
//_E[hs
ClearDebugMessages("Download Failed.");
PrintError( progress );
var kong_ = new Kong();
kong_.HideLoadingIcon();
}
else
{
//_E[h・
ClearDebugMessages("Download Succeed.");
var nowDate = new Date();
var time = nowDate.getTime() - gStartDate.getTime();
Print("Time : " + time + "[ms]");
Print( progress.totalSize + "[bytes]");
UpdateProgressBar( progress.downloadedSize, progress.totalSize );
var kong_ = new Kong();
kong_.HideLoadingIcon();
}
}
/*
tH[ノ option ^Oタ燉ef
*/
function SetFormValue()
{
var id = new Array();
id = app.idset.value.split(",");
app.titleId.value = id[0];
app.itemId.value = id[1];
app.amount.value = id[2];
}
-->
</script>
</head>
<body onload="InitEc();">
<form id="point">
<table border="1">
<!------------ WiiPoint ------------>
<tr>
<th colspan="2">WiiPoint</th>
</tr>
<tr>
<td>itemId</td>
<td><input type="text" maxlength="6" size="7" id="itemId" onMouseDown="ActiveKeyboard(0, 'itemId');" value="100041"></td>
</tr>
<tr>
<td>pointsToPurchase</td>
<td><input type="text" maxlength="5" size="6" id="pointsToPurchase" onMouseDown="ActiveKeyboard(0, 'pointsToPurchase');" value="2000"></td>
</tr>
<tr>
<td>amount</td>
<td><input type="text" maxlength="5" size="6" id="amount" onMouseDown="ActiveKeyboard(0, 'amount');" value="2000"></td>
</tr>
<!------------ CreditCard ------------>
<tr>
<th colspan="2">CreditCard</th>
</tr>
<tr>
<td>month / year</td>
<td>
<input type="text" maxlength="2" size="2" id="cc_month" onMouseDown="ActiveKeyboard( 0, 'month');" value="12">/
<input type="text" maxlength="4" size="4" id="cc_year" onMouseDown="ActiveKeyboard( 0, 'year');" value="2008">
</td>
</tr>
<tr>
<td>number</td>
<td><input type="text" maxlength="16" size="22" id="cc_number" onMouseDown="ActiveKeyboard( 0, 'number', 1);" value="5555555555555555"></td>
</tr>
<tr>
<td>cvv2</td>
<td><input type="text" maxlength="3" size="3" id="cc_cvv2" onMouseDown="ActiveKeyboard( 0, 'cvv2');" value="123"></td>
</tr>
<tr>
<td>owner</td>
<td><input type="text" maxlength="200" size="22" id="cc_owner" onMouseDown="ActiveKeyboard( 2, 'owner');" value="John Doe"></td>
</tr>
<tr>
<td>billingCity</td>
<td><input type="text" maxlength="200" size="22" id="cc_billingCity" onMouseDown="ActiveKeyboard( 2, 'billingCity');" value="Palo Alto"></td>
</tr>
<tr>
<td>billingState</td>
<td><input type="text" maxlength="200" size="22" id="cc_billingState" onMouseDown="ActiveKeyboard( 2, 'billingState');" value="CA"></td>
</tr>
<tr>
<td>billingPostal</td>
<td><input type="text" maxlength="200" size="22" id="cc_billingPostal" onMouseDown="ActiveKeyboard( 0, 'billingPostal');" value="94304"></td>
</tr>
<!------------ eCard ------------>
<tr>
<th colspan="2">eCard</th>
</tr>
<tr>
<td>number</td>
<td><input type="text" maxlength="16" size="26" id="eCard_number" onMouseDown="ActiveKeyboard( 0, 'number', 1);" value="1102854555564455"></td>
</tr>
</table>
</form>
<div>
<button onClick="GetPoints();">GetPoints</button>
<button onClick="PurchasePointsByCreditCard();">PurchasePointsByCreditCard</button>
<button onClick="PurchasePointsByECard();">PurchasePointsByECard</button>
</div>
<!--
タXy[Xネ a ^Oナ
<div>
<a href="javascript:void(0);" onClick="PurchaseTitleFromForm();">PurchaseTitle</a>
<a href="javascript:void(0);" onClick="DownloadFromForm();">Download</a>
</div>
-->
<!--
vOXo[
<div id="progress">
<img src="progress_bar_border.gif">
</div>
-->
<div id="output"></div>
</body>
</html>