Exemplo n.º 1
0
        public static int GetGCPaymentMethodId(GoogleCheckout gatewayInstance)
        {
            PaymentMethodCollection gcPayMethods =
                PaymentMethodDataSource.LoadForPaymentGateway(gatewayInstance.PaymentGatewayId);

            if (gcPayMethods == null || gcPayMethods.Count == 0)
            {
                PaymentMethod gcPayMethod = new PaymentMethod();
                gcPayMethod.Name              = "GoogleCheckout";
                gcPayMethod.PaymentGatewayId  = gatewayInstance.PaymentGatewayId;
                gcPayMethod.PaymentInstrument = PaymentInstrument.GoogleCheckout;
                gcPayMethod.Save();
                return(gcPayMethod.PaymentMethodId);
            }
            else
            {
                return(gcPayMethods[0].PaymentMethodId);
            }
        }