I have a dotnet assembly which includes classes RequestType, Response,
Transaction, and TransactionElement.
To use this I would normally create a new Transaction passing it a parameter
of RequestType and receive a Transaction object of the right type in return.
Paymentech.Transaction transaction = new
Paymentech.Transaction(Paymentech.RequestType.CC_AUTHORIZE);
I now find myself having to access this assembly in an environment that does
not allow me to pass the RequestType parameter when I create the object
(PHP). To work around this limitation, I would like to create another dotnet
assembly which will basically be way to call all the different types of
Transactions without passing parameters. In other words, I want to create a
separate class for each type of Transaction I need.
So I will end up with a CC_AuthorizeTransaction class, a
CC_CaptureTransaction class, an Ecommerce_RefundTransaction class, etc.
I envision all these classes sitting in my own dotnet assembly.
I think I need to have each of my classes inherit/extend from the
Paymentech.Transaction class only needing to change the constructor.
Here is where I'm lost (not having done this before). How do I do this? Do
I need to do something with all the other members/methods of
Paymentech.Transaction as well?
I apologize that this question is so basic.
Terry
PS - 21 May 2007 21:27 GMT
>I have a dotnet assembly which includes classes RequestType, Response,
>Transaction, and TransactionElement.
[quoted text clipped - 25 lines]
> Do I need to do something with all the other members/methods of
> Paymentech.Transaction as well?
public class CC_AuthorizeTransaction : Paymentech.Transaction
{
public CC_AuthorizeTransaction()
{
base.RequestType = Paymentech.RequestType.CC_AUTHORIZE;
}
}
> I apologize that this question is so basic.
>
> Terry
Terry Carnes - 21 May 2007 21:44 GMT
base.RequestType = Paymentech.RequestType.CC_AUTHORIZE;
Isn't working. I get the error that 'Paymentech.Transaction' does not
contain a definition for 'RequestType'.
I was expecting something like (in pseudocode):
return object = new
Paymentech.Transaction(Paymentech.RequestType.CC_AUTHORIZE);
The assembly doesn't allow the changing of a RequestType after
instantiation. It needs to know the requested type in its constructor so it
builds the right type of Transaction to begin with.
Terry
PS - 21 May 2007 22:35 GMT
> base.RequestType = Paymentech.RequestType.CC_AUTHORIZE;
>
[quoted text clipped - 9 lines]
> instantiation. It needs to know the requested type in its constructor so
> it builds the right type of Transaction to begin with.
I was just taking a guess at the internals of the class as an example. Jon's
calling of the base constructor is the only way to do it based on this
knowledge.
> Terry
Jon Skeet [C# MVP] - 21 May 2007 21:51 GMT
> > Here is where I'm lost (not having done this before). How do I do this?
> > Do I need to do something with all the other members/methods of
[quoted text clipped - 7 lines]
> }
> }
Or even (to keep in line with the previously posted code):
public class CC_AuthorizeTransaction : Paymentech.Transaction
{
public CC_AuthorizeTransaction()
: base (Paymentech.RequestType.CC_AUTHORIZE)
{
}
}

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Terry Carnes - 21 May 2007 21:59 GMT
Thanks, Jon! That worked!
> Or even (to keep in line with the previously posted code):
>
[quoted text clipped - 5 lines]
> }
> }