예제 #1
0
        public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string CertificateFile_Sig, string APISignature_Sig, string CertificateFile_Cer, string PrivateKeyPassword_Cer, string stage, string subject, bool is3token, bool isunipay)
        {
            if (is3token == true)
            {
                IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
                profile.APIUsername  = apiUsername;
                profile.APIPassword  = apiPassword;
                profile.Environment  = stage;
                profile.Subject      = subject;
                profile.APISignature = signature;
                return(profile);
            }
            //else if (Global.isunipay == true)
            else if (isunipay == true)
            {
                IAPIProfile profile = ProfileFactory.createUniPayAPIProfile();
                profile.getFirstPartyEmail = subject;
                profile.Environment        = stage;
                return(profile);
            }
            else
            {
                IAPIProfile profile = ProfileFactory.createSSLAPIProfile();
                profile.APIUsername        = apiUsername;
                profile.APIPassword        = apiPassword;
                profile.Environment        = stage;
                profile.CertificateFile    = CertificateFile_Cer;
                profile.PrivateKeyPassword = PrivateKeyPassword_Cer;
                profile.Subject            = subject;

                return(profile);
            }
        }
예제 #2
0
    public string DoCaptureCode(string authorization_id, string amount)
    {
        CallerServices caller = new CallerServices();

        IAPIProfile profile = ProfileFactory.createSSLAPIProfile();

        profile.APIUsername     = "******";
        profile.APIPassword     = "******";
        profile.CertificateFile = @"~\MyTestCertificate.txt";
        profile.Environment     = "sandbox";
        caller.APIProfile       = profile;

        DoCaptureRequestType pp_request = new DoCaptureRequestType();

        pp_request.Version = "51.0";

        pp_request.AuthorizationID   = authorization_id;
        pp_request.Amount            = new BasicAmountType();
        pp_request.Amount.Value      = amount;
        pp_request.Amount.currencyID = CurrencyCodeType.GBP;
        pp_request.CompleteType      = CompleteCodeType.Complete;

        DoCaptureResponseType pp_response = new DoCaptureResponseType();

        pp_response = (DoCaptureResponseType)caller.Call("DoCapture", pp_request);
        return(pp_response.Ack.ToString());
    }