ASP Option Explicit - problem with PayPal Express Checkout

I ran into a big problem integrating PayPal Express Checkout into classic ASP.

The code provided by PayPal in the PayPal Integration Wizard works fine when launched without Option Explicit.

When I put my coding pages and call the provided functions, I have big problems: I have all existing pages using Option Explicit.

This leads to the fact that I have to manually declare all the variables in the PayPal functions.

Examples of PayPal functions consist of many array / list / object / index parameters for setting name / value pairs needed to call the PayPal site. It’s not easy for me to change it to all the correct declarations, since I am not an expert in ASP, and the deadline for the project is limited.

Can someone give me some advice?

+3
source share
1 answer

It seems that you can mix " Option Explicit" - the code with the code is not " Option Explicit" using the instructions Execute.

Here is a little test I just did with VBScript (which also applies to classic ASP):

''#vb1.vbs (i.e. "your code")
Option Explicit

Dim fso, vb2, txt
Set fso = CreateObject("Scripting.FileSystemObject")
Set vb2 = fso.OpenTextFile("vb2.vbs", 1)
txt = vb2.ReadAll

MsgBox txt    ''# Message 1
Execute txt

MsgBox foo    ''# Message 2

and

''# vb2.vbs (i.e. "their code")
j = 100

Function foo
  k = 100
  foo = j + k
End Function

Results in:

Message 1: (equal to the contents of vb2.vbs)
Message 2: 200

I have no idea that this is the best way to do this, but at the moment I am not thinking of a better way. Give it a try.

" ".

+3

Source: https://habr.com/ru/post/1713054/


All Articles