Esempio n. 1
0
 public RefundTransaction(ExpressCheckoutApi ec, string transactionid)
     : base(ec)
 {
     RequestNVP.Method = "RefundTransaction";
     TransactionID     = transactionid;
     RefundType        = "Full";
 }
 public DoExpressCheckoutPaymentOperation(ExpressCheckoutApi ec, string token, string payerid, double valor, PaymentAction action)
     : base(ec)
 {
     RequestNVP.Method        = "DoExpressCheckoutPayment";
     Token                    = token;
     PayerId                  = payerid;
     PaymentRequest(0).Amount = valor;
     PaymentRequest(0).Action = action;
 }
Esempio n. 3
0
        public Cart()
        {
            items = new List <Item>();
            ec    = PayPalApiFactory.instance.ExpressCheckout(
                "neto_1306507007_biz_api1.gmail.com",
                "1306507019",
                "Al8n1.tt9Sniswt8UZvcamFvsXYEAegNpyX63HRdtqJVff7rESMSQ3qN"
                );

            populate();
        }
        private dynamic ExecuteExpress(dynamic parameters)
        {
            _setConfigurations();

            var longAccessToken = this.Request.Query["longAccessToken"];

            //Create an instance of PrecheckoutDataRequest
            PrecheckoutDataRequest precheckoutDataRequest = new PrecheckoutDataRequest()
                                                            .WithPairingDataTypes(new PairingDataTypes()
                                                                                  .WithPairingDataType(new PairingDataType()
                                                                                                       .WithType("CARD"))

                                                                                  .WithPairingDataType(new PairingDataType()
                                                                                                       .WithType("ADDRESS"))

                                                                                  .WithPairingDataType(new PairingDataType()
                                                                                                       .WithType("PROFILE")));

            //Call the PrecheckoutDataApi with required params
            PrecheckoutDataResponse precheckoutDataResponse = PrecheckoutDataApi.Create(longAccessToken, precheckoutDataRequest);

            ExpressCheckoutRequest expressCheckoutRequest = new ExpressCheckoutRequest
            {
                PrecheckoutTransactionId = precheckoutDataResponse.PrecheckoutData.PrecheckoutTransactionId,  // from precheckout data
                MerchantCheckoutId       = Contants.checkoutId,
                OriginUrl                = Contants.callbackURL,
                CurrencyCode             = "USD",
                AdvancedCheckoutOverride = true, // set to true to disable 3-DS authentication
                OrderAmount              = 1299,
                DigitalGoods             = false,
                CardId            = precheckoutDataResponse.PrecheckoutData.Cards.Card[0].CardId,
                ShippingAddressId = precheckoutDataResponse.PrecheckoutData.ShippingAddresses.ShippingAddress[0].AddressId,
            };
            ExpressCheckoutResponse response = ExpressCheckoutApi.Create(longAccessToken, expressCheckoutRequest);

            Checkout checkout = response.Checkout;

            Card    card                             = checkout.Card;
            Address billingAddress                   = card.BillingAddress;
            Contact contact                          = checkout.Contact;
            AuthenticationOptions authOptions        = checkout.AuthenticationOptions;
            string          preCheckoutTransactionId = checkout.PreCheckoutTransactionId;
            ShippingAddress shippingAddress          = checkout.ShippingAddress;
            string          transactionId            = checkout.TransactionId;
            string          walletId                 = checkout.WalletID;

            /// AQUI DEVE SER CHAMADO O GATEWAY DE PAGAMENTO PARA EXECUTAR O
            /// PAGAMENTO COM OS DADOS RECUPERADOS ACIMA...

            /// UMA VEZ QUE O PAGAMENTO FOI EXECUTADO, CONTINUAR COM O PASSO ABAIXO

            //Create an instance of MerchantTransactions
            MerchantTransactions merchantTransactions = new MerchantTransactions()
                                                        .With_MerchantTransactions(new MerchantTransaction()
                                                                                   .WithTransactionId(transactionId)
                                                                                   .WithPurchaseDate("2017-05-27T12:38:40.479+05:30")
                                                                                   .WithExpressCheckoutIndicator(false)
                                                                                   .WithApprovalCode("sample")
                                                                                   .WithTransactionStatus("Success")
                                                                                   .WithOrderAmount((long)76239)
                                                                                   .WithCurrency("USD")
                                                                                   .WithConsumerKey(Contants.consumerKey));

            //Call the PostbackService with required params
            MerchantTransactions merchantTransactionsResponse = PostbackApi.Create(merchantTransactions);


            return("Express Checkout realizado com sucesso. TransactionId:" + transactionId);
        }
 public GetExpressCheckoutDetailsOperation(ExpressCheckoutApi ec, string token)
     : base(ec)
 {
     RequestNVP.Method = "GetExpressCheckoutDetails";
     Token             = token;
 }