示例#1
0
文件: PaySession.cs 项目: zhabis/nfx
        protected PaySession(PaySystem paySystem, ConnectionParameters cParams, IPaySessionContext context = null)
        {
            if (paySystem == null || cParams == null)
            {
                throw new PaymentException(StringConsts.ARGUMENT_ERROR + this.GetType().Name + ".ctor((paySystem|cParams)=null)");
            }

            PaySystem = paySystem;

            Context = context ?? PaySystemHost.GetDefaultTransactionContext();

            ConnectionParameters = cParams;

            lock (PaySystem.Sessions)
                PaySystem.Sessions.Add(this);
        }
示例#2
0
 public BraintreeSession(BraintreeSystem system, BraintreeConnectionParameters cParams, IPaySessionContext context = null)
     : base(system, cParams, context)
 {
 }
示例#3
0
 protected override PaySession DoStartSession(ConnectionParameters cParams, IPaySessionContext context = null)
 {
     return(new PayPalSession(this, (PayPalConnectionParameters)cParams, context));
 }
示例#4
0
 protected override PaySession DoStartSession(ConnectionParameters cParams, IPaySessionContext context = null)
 {
     return(new BraintreeSession(this, (BraintreeConnectionParameters)cParams, context));
 }
示例#5
0
 public bool Refund(decimal?amount = null, string description = null, object extraData = null, ConnectionParameters cParams = null, IPaySessionContext context = null)
 {
     using (var session = PaySystem.StartSession(cParams, context))
         return(session.Refund(this, amount, description, extraData));
 }
示例#6
0
 public bool Void(string description = null, object extraData = null, ConnectionParameters cParams = null, IPaySessionContext context = null)
 {
     using (var session = PaySystem.StartSession(cParams, context))
         return(session.Void(this, description, extraData));
 }
示例#7
0
 public bool Refresh(ConnectionParameters cParams = null, IPaySessionContext context = null)
 {
     using (var session = PaySystem.StartSession(cParams, context))
         return(session.Refresh(this));
 }
示例#8
0
 protected abstract PaySession DoStartSession(ConnectionParameters cParams, IPaySessionContext context = null);
示例#9
0
 /// <summary>
 /// Starts new pay session of system-specific type
 /// </summary>
 public PaySession StartSession(ConnectionParameters cParams = null, IPaySessionContext context = null)
 {
     return(DoStartSession(cParams ?? DefaultSessionConnectParams, context));
 }
示例#10
0
 public StripeSession(PaySystem paySystem, StripeConnectionParameters cParams, IPaySessionContext context = null)
     : base(paySystem, cParams, context)
 {
 }
示例#11
0
 public MockSession(PaySystem paySystem, MockConnectionParameters cParams, IPaySessionContext context = null)
     : base(paySystem, cParams, context)
 {
 }
示例#12
0
 public PayPalSession(PayPalSystem paySystem, PayPalConnectionParameters cParams, IPaySessionContext context = null)
     : base(paySystem, cParams, context)
 {
 }