Skip to content

Commit ea3781d

Browse files
committed
Merge pull request AuthorizeNet#109 from zalak1612/master
Using cygwin library instead of devkit/bin and commented some WSDL lines
2 parents f236a0f + ed0b6b0 commit ea3781d

File tree

3 files changed

+56
-49
lines changed

3 files changed

+56
-49
lines changed

scripts/generateRequestFactorySpecified.cmd

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
@rem Creating RequestFactoryWithSpecified file which handles the elements having minoccurs=0 in XSD
22
@rem It generates specified property for such element and sets them true if the required condition is met
33
@ECHO OFF
4-
SET DEVKIT=C:\DevKit\bin
4+
CALL "%~dp0\validateCygwinBinaries.cmd"
5+
IF "1"=="%ERRORLEVEL%" (
6+
@ECHO Invalid or incomplete Cygwin installation. Install cygwin and its components viz.
7+
@ECHO grep sed perl cut touch wget sort
8+
EXIT /b 1
9+
)
10+
SET CYGWIN_EXE=%CYGWIN_HOME%\bin
511
SET OUTDIR=%Temp%
612
SET SRCDIR=Authorize.NET\Api\Contracts\V1
713
SET OUTFILE=%SRCDIR%\RequestFactoryWithSpecified.generated.org
814
SET INFILE=%SRCDIR%\AnetApiSchema.generated.cs
915
SET BACKUPFILE=%OUTDIR%\RequestFactoryWithSpecified_Backup.generated.org
1016
SET SPECIFIEDFILE=%OUTDIR%\splst.txt
1117

12-
IF NOT EXIST "%DEVKIT%" (
13-
@ECHO "%DEVKIT%" DOES NOT EXIST
18+
IF NOT EXIST "%CYGWIN_EXE%" (
19+
@ECHO "%CYGWIN_EXE%" DOES NOT EXIST
1420
EXIT /B 1
1521
)
1622
IF NOT EXIST "%SRCDIR%" (
@@ -19,7 +25,7 @@ IF NOT EXIST "%SRCDIR%" (
1925
)
2026

2127
IF EXIST "%OUTFILE%" (
22-
"%DEVKIT%\rm.exe" %OUTFILE%
28+
"%CYGWIN_EXE%\rm.exe" %OUTFILE%
2329
)
2430

2531
@ECHO ### Generating request factory specified
@@ -46,100 +52,100 @@ IF EXIST "%OUTFILE%" (
4652
@ECHO public static class RequestFactoryWithSpecified >> %OUTFILE%
4753
@ECHO {>> %OUTFILE%
4854

49-
"%DEVKIT%\grep.exe" -i "class\|specified\|typeof\|type\|public" %INFILE% | "%DEVKIT%\grep.exe" -i -v "string\|event" >> %OUTFILE%
55+
"%CYGWIN_EXE%\grep.exe" -i "class\|specified\|typeof\|type\|public" %INFILE% | "%CYGWIN_EXE%\grep.exe" -i -v "string\|event" >> %OUTFILE%
5056

5157
rem creating a back up file
52-
"%DEVKIT%\cp.exe" -f %OUTFILE% %BACKUPFILE%
58+
"%CYGWIN_EXE%\cp.exe" -f %OUTFILE% %BACKUPFILE%
5359

5460
@rem replacing public partial class with public static void
55-
"%DEVKIT%\perl.exe" -p -i -e 's/public partial class/ }\n }\n public static void/g' %OUTFILE%
61+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/public partial class/ }\n }\n public static void/g' %OUTFILE%
5662

5763
@ECHO ### Deleting unwanted lines from file - may take sometime
5864
@rem remove everything after colon public partial class merchantAuthenticationType : object, System.ComponentModel.INotifyPropertyChanged {
59-
"%DEVKIT%\perl.exe" -p -i -e 's/:.*/\n {\n if(null != argument) \n {\n/g if /: object/' %OUTFILE%
65+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/:.*/\n {\n if(null != argument) \n {\n/g if /: object/' %OUTFILE%
6066

6167
@rem remove everything after colon public partial class authenticateTestRequest : ANetApiRequest
62-
"%DEVKIT%\perl.exe" -p -i -e 's/:.*/\n {\n if(null != argument) \n {\n/g if /: ANetApi/' %OUTFILE%
68+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/:.*/\n {\n if(null != argument) \n {\n/g if /: ANetApi/' %OUTFILE%
6369

6470
@ rem remove "public enum bankAccountTypeEnum"
65-
"%DEVKIT%\perl.exe" -p -i -e 's/public enum.*//g' %OUTFILE%
71+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/public enum.*//g' %OUTFILE%
6672

6773
@ rem remove ["System.Xml.Serialization.XmlTypeAttribute(Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd")]"
68-
"%DEVKIT%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlTypeAttribute.*$//g' %OUTFILE%
74+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlTypeAttribute.*$//g' %OUTFILE%
6975

7076
@ rem remove "[System.Xml.Serialization.XmlIncludeAttribute(typeof(creditCardType))]"
71-
"%DEVKIT%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlIncludeAttribute.*$//g' %OUTFILE%
77+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlIncludeAttribute.*$//g' %OUTFILE%
7278

7379
@rem remove before 'typeof' word "[System.Xml.Serialization.XmlElementAttribute("bankAccount", typeof(bankAccountType))]"
74-
"%DEVKIT%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlElementAttribute.*typeof\(/ /g' %OUTFILE%
80+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlElementAttribute.*typeof\(/ /g' %OUTFILE%
7581

7682
@rem remove replacing the last three characters ))] in above expression with "(argument)"
77-
"%DEVKIT%\perl.exe" -p -i -e 's/\)\)\]/ABCargumentXXX;/g' %OUTFILE%
83+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/\)\)\]/ABCargumentXXX;/g' %OUTFILE%
7884

7985
@ rem remove "[System.Xml.Serialization.XmlElementAttribute(DataType="date")]"
80-
"%DEVKIT%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlElementAttribute.*$//g' %OUTFILE%
86+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlElementAttribute.*$//g' %OUTFILE%
8187

8288
@ rem remove "[System.Xml.Serialization.XmlAttributeAttribute(DataType"
83-
"%DEVKIT%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlAttributeAttribute.*$//g' %OUTFILE%
89+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^\[System.Xml.Serialization.XmlAttributeAttribute.*$//g' %OUTFILE%
8490

8591
@rem remove the line containing enum at the end of the word accountTypeEnum
86-
"%DEVKIT%\perl.exe" -p -i -e 's/([A-Za-z0-9]*.Enum.*)$//g if !/public static/' %OUTFILE%
92+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/([A-Za-z0-9]*.Enum.*)$//g if !/public static/' %OUTFILE%
8793

8894
@rem remove the line containing enum at the end of the word ItemChoiceType
89-
"%DEVKIT%\perl.exe" -p -i -e 's/(ItemChoiceType.*)$//g' %OUTFILE%
95+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/(ItemChoiceType.*)$//g' %OUTFILE%
9096
@rem replace the curly braces "public partial class emailSettingsType : ArrayOfSetting {" with "public partial class emailSettingsType : ArrayOfSetting ABCargumentXXX"
91-
"%DEVKIT%\perl.exe" -p -i -e 's/{/ABCargumentXXX;/g if /:/' %OUTFILE%
97+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/{/ABCargumentXXX;/g if /:/' %OUTFILE%
9298

9399
@rem replacing { in "public static void ABCargumentXX {" if (null != argument)
94-
"%DEVKIT%\perl.exe" -p -i -e 's/:/\n {\n if(null != argument) \n {\n /g' %OUTFILE%
100+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/:/\n {\n if(null != argument) \n {\n /g' %OUTFILE%
95101

96102

97103
@rem removing public object from "public object Item;"
98-
"%DEVKIT%\perl.exe" -p -i -e 's/^ *public object.*//g' %OUTFILE%
104+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ *public object.*//g' %OUTFILE%
99105

100106
@rem removing all datatypes
101-
"%DEVKIT%\perl.exe" -p -i -e 's/^ *public bool//g' %OUTFILE%
102-
"%DEVKIT%\perl.exe" -p -i -e 's/^ *public int.*;//g' %OUTFILE%
103-
"%DEVKIT%\perl.exe" -p -i -e 's/^ *public decimal.*;//g' %OUTFILE%
104-
"%DEVKIT%\perl.exe" -p -i -e 's/^ *public short.*;//g' %OUTFILE%
105-
"%DEVKIT%\perl.exe" -p -i -e 's/^ *public System.DateTime.*;//g' %OUTFILE%
107+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ *public bool//g' %OUTFILE%
108+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ *public int.*;//g' %OUTFILE%
109+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ *public decimal.*;//g' %OUTFILE%
110+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ *public short.*;//g' %OUTFILE%
111+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ *public System.DateTime.*;//g' %OUTFILE%
106112

107113
@rem removing public keyword anywhere in file except the lines containing "public static ..."
108-
"%DEVKIT%\perl.exe" -p -i -e 's/^ *public //g if ! /public static /' %OUTFILE%
114+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ *public //g if ! /public static /' %OUTFILE%
109115

110116
@rem trying to tokenize "public messagesTypeMessage[] message;"
111-
"%DEVKIT%\perl.exe" -pi -w -e 's/^ *([A-Za-z0-9]*)\[\] *([A-Za-z0-9]*);/ if(null != argument.$2){ foreach( var value in argument.$2) { $1(value);} } /g' "%OUTFILE%"
117+
"%CYGWIN_EXE%\perl.exe" -pi -w -e 's/^ *([A-Za-z0-9]*)\[\] *([A-Za-z0-9]*);/ if(null != argument.$2){ foreach( var value in argument.$2) { $1(value);} } /g' "%OUTFILE%"
112118

113119
@rem grep all the lines having specified word
114-
"%DEVKIT%\grep.exe" -i "Specified" %OUTFILE% | "%DEVKIT%\grep.exe" -v "class" | "%DEVKIT%\sort.exe" -u > %SPECIFIEDFILE%
120+
"%CYGWIN_EXE%\grep.exe" -i "Specified" %OUTFILE% | "%CYGWIN_EXE%\grep.exe" -v "class" | "%CYGWIN_EXE%\sort.exe" -u > %SPECIFIEDFILE%
115121
@rem removing specified word
116-
"%DEVKIT%\perl.exe" -p -i -e 's/Specified;*//g' %SPECIFIEDFILE%
122+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/Specified;*//g' %SPECIFIEDFILE%
117123

118124
@ECHO ### Processing function name - Creating functions
119125
@rem replacing "public static void ARBGetSubscriptionListRequest" with "XYZ ARBGetSubscriptionListRequest ABC ARBGetSubscriptionListRequest argument XXX"
120-
"%DEVKIT%\perl.exe" -pi -w -e 's/^ *public *static *void *([A-Za-z0-9]*)/XYZ $1ABC$1 argumentXXX/g' %OUTFILE%
126+
"%CYGWIN_EXE%\perl.exe" -pi -w -e 's/^ *public *static *void *([A-Za-z0-9]*)/XYZ $1ABC$1 argumentXXX/g' %OUTFILE%
121127

122128
@ECHO ### Processing Specified List - Adding if block also may take time
123129
FOR /f %%i IN ( %SPECIFIEDFILE%) DO (
124130
@rem @ECHO %%i
125-
"%DEVKIT%\perl.exe" -p -i -e 's/ ^ *%%i;//g if ! /specified/' %OUTFILE%
126-
"%DEVKIT%\perl.exe" -p -i -e 's/^ %%iSpecified;/ ifABCargument.%%iXXX { argument.%%iSpecified123=true;}/g if /%%iSpecified/' %OUTFILE%
131+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/ ^ *%%i;//g if ! /specified/' %OUTFILE%
132+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^ %%iSpecified;/ ifABCargument.%%iXXX { argument.%%iSpecified123=true;}/g if /%%iSpecified/' %OUTFILE%
127133
)
128134

129135
@rem replace xyz in "XYZ paymentMaskedType ABCpaymentMaskedType argumentXXX" with public static void
130-
"%DEVKIT%\perl.exe" -p -i -e 's/XYZ/ public static void/g' %OUTFILE%
136+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/XYZ/ public static void/g' %OUTFILE%
131137
@rem replace ABC with (
132-
"%DEVKIT%\perl.exe" -p -i -e 's/ABC/(/g' %OUTFILE%
138+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/ABC/(/g' %OUTFILE%
133139
@rem replace XXX with )
134-
"%DEVKIT%\perl.exe" -p -i -e 's/XXX/)/g' %OUTFILE%
140+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/XXX/)/g' %OUTFILE%
135141
@rem remove 123 from "argument.taxExemptSpecified123=true; "
136-
"%DEVKIT%\perl.exe" -p -i -e 's/123//g if /Specified/' %OUTFILE%
142+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/123//g if /Specified/' %OUTFILE%
137143

138144
@rem replacing the string of type "customerPaymentProfileType paymentProfile;" to "customerPaymentProfileType(argument.paymentProfile);"
139-
"%DEVKIT%\perl.exe" -pi -w -e 's/^([A-Za-z0-9]*) ([A-Za-z0-9]*);/ $1(argument.$2);/g' "%OUTFILE%"
145+
"%CYGWIN_EXE%\perl.exe" -pi -w -e 's/^([A-Za-z0-9]*) ([A-Za-z0-9]*);/ $1(argument.$2);/g' "%OUTFILE%"
140146

141147
@rem removing string like this "validationModeEnum"
142-
"%DEVKIT%\perl.exe" -p -i -e 's/^[a-zA-Z]*$//g' %OUTFILE%
148+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/^[a-zA-Z]*$//g' %OUTFILE%
143149

144150

145151
@ECHO }>> %OUTFILE%
@@ -202,11 +208,11 @@ FOR /f %%i IN ( %SPECIFIEDFILE%) DO (
202208
@ECHO */ >> %OUTFILE%
203209

204210
@rem command to remove blank lines in file
205-
"%DEVKIT%\perl.exe" -i -n -e "print if /\S/" %OUTFILE%
211+
"%CYGWIN_EXE%\perl.exe" -i -n -e "print if /\S/" %OUTFILE%
206212
@rem command to replace WWWW to specified
207-
"%DEVKIT%\perl.exe" -p -i -e 's/WWWW/specified/g' %OUTFILE%
213+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/WWWW/specified/g' %OUTFILE%
208214
@rem command to replace HTHT### to using System;
209-
"%DEVKIT%\perl.exe" -p -i -e 's/HTHT###/using System;/g' %OUTFILE%
215+
"%CYGWIN_EXE%\perl.exe" -p -i -e 's/HTHT###/using System;/g' %OUTFILE%
210216

211217
@rem deleting the .bak file created by perl command
212218
del /S /Q *.bak > NUL

scripts/getXsdWsdl.cmd

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ IF NOT "%ERRORLEVEL%"=="0" (
5555
DEL /Q "ANetApiWS.asmx@wsdl"
5656
)
5757
@ECHO Unable to fetch "%WSDL%" via bitsadmin, trying wget
58-
"%CYGWIN_EXE%\wget.exe" %WSDL%
58+
@rem "%CYGWIN_EXE%\wget.exe" %WSDL%
5959
REM IF "%ERRORLEVEL%"=="1" (
6060
REM @ECHO Unable to fetch "%WSDL%" via wget
6161
REM EXIT /b 1
@@ -64,18 +64,19 @@ REM )
6464
COPY "ANetApiWS.asmx@wsdl" "%LOCALWSDL%"
6565
DEL /Q "ANetApiWS.asmx@wsdl"
6666
) ELSE (
67-
@ECHO Unable to fetch "%WSDL%" via wget
67+
@rem @ECHO Unable to fetch "%WSDL%" via wget
68+
@ECHO Escape fetching %WSDL%
6869
@REM EXIT /b 1
6970
)
7071
)
7172
IF NOT EXIST "%LOCALXSD%" (
7273
@ECHO Unable to find "%LOCALXSD%"
7374
EXIT /b 1
7475
)
75-
IF NOT EXIST "%LOCALWSDL%" (
76-
@ECHO Unable to find "%LOCALWSDL%"
77-
@REM EXIT /b 1
78-
)
76+
@rem IF NOT EXIST "%LOCALWSDL%" (
77+
@rem @ECHO Unable to find "%LOCALWSDL%"
78+
@rem @REM EXIT /b 1
79+
@rem )
7980
@ECHO %0 Exit Code:'%ERRORLEVEL%'
8081
ENDLOCAL
8182

scripts/masterUpdate.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SET CYGWIN_EXE=%CYGWIN_HOME%\bin
1212
@ECHO This script will update all the generated code
1313
@ECHO.
1414

15-
FOR %%x IN ( generateObjectsFromXsd.cmd generateControllersFromTemplate.cmd generateTestControllersFromTemplate.cmd generateTestForEnums.cmd ) DO (
15+
FOR %%x IN ( generateObjectsFromXsd.cmd generateControllersFromTemplate.cmd generateTestControllersFromTemplate.cmd generateTestForEnums.cmd generateRequestFactorySpecified.cmd) DO (
1616
@ECHO Executing script "%%x"
1717
CALL "%~dp0%%x"
1818
IF "1"=="%ERRORLEVEL%" (

0 commit comments

Comments
 (0)