Exemplo n.º 1
0
        public async void Example()
        {
#pragma warning disable 0168
            using (Client client = GetClient())
            {
                AmountOfMoney amountOfMoney = new AmountOfMoney();
                amountOfMoney.Amount       = 1L;
                amountOfMoney.CurrencyCode = "EUR";

                BankAccountIban bankAccountIban = new BankAccountIban();
                bankAccountIban.Iban = "NL53INGB0000000036";

                BankRefundMethodSpecificInput bankRefundMethodSpecificInput = new BankRefundMethodSpecificInput();
                bankRefundMethodSpecificInput.BankAccountIban = bankAccountIban;

                PersonalName name = new PersonalName();
                name.Surname = "Coyote";

                AddressPersonal address = new AddressPersonal();
                address.CountryCode = "US";
                address.Name        = name;

                ContactDetailsBase contactDetails = new ContactDetailsBase();
                contactDetails.EmailAddress     = "*****@*****.**";
                contactDetails.EmailMessageType = "html";

                RefundCustomer customer = new RefundCustomer();
                customer.Address        = address;
                customer.ContactDetails = contactDetails;

                RefundReferences refundReferences = new RefundReferences();
                refundReferences.MerchantReference = "AcmeOrder0001";

                RefundRequest body = new RefundRequest();
                body.AmountOfMoney = amountOfMoney;
                body.BankRefundMethodSpecificInput = bankRefundMethodSpecificInput;
                body.Customer         = customer;
                body.RefundDate       = "20140306";
                body.RefundReferences = refundReferences;

                try
                {
                    RefundResponse response = await client.Merchant("merchantId").Payments().Refund("paymentId", body);
                }
                catch (DeclinedRefundException e)
                {
                    HandleDeclinedRefund(e.RefundResult);
                }
                catch (ApiException e)
                {
                    HandleApiErrors(e.Errors);
                }
            }
#pragma warning restore 0168
        }
        public async void Example()
        {
#pragma warning disable 0168
            using (Client client = GetClient())
            {
                BankAccountIban bankAccountIban = new BankAccountIban();
                bankAccountIban.Iban = "DE46720200700359736690";

                MandateContactDetails contactDetails = new MandateContactDetails();
                contactDetails.EmailAddress = "*****@*****.**";

                MandateAddress mandateAddress = new MandateAddress();
                mandateAddress.City        = "Monumentenvallei";
                mandateAddress.CountryCode = "NL";
                mandateAddress.Street      = "Woestijnweg";
                mandateAddress.Zip         = "1337XD";

                MandatePersonalName name = new MandatePersonalName();
                name.FirstName = "Wile";
                name.Surname   = "Coyote";

                MandatePersonalInformation personalInformation = new MandatePersonalInformation();
                personalInformation.Name  = name;
                personalInformation.Title = "Miss";

                MandateCustomer customer = new MandateCustomer();
                customer.BankAccountIban     = bankAccountIban;
                customer.CompanyName         = "Acme labs";
                customer.ContactDetails      = contactDetails;
                customer.MandateAddress      = mandateAddress;
                customer.PersonalInformation = personalInformation;

                CreateMandateRequest body = new CreateMandateRequest();
                body.Customer          = customer;
                body.CustomerReference = "idonthaveareference";
                body.Language          = "nl";
                body.RecurrenceType    = "UNIQUE";
                body.SignatureType     = "UNSIGNED";

                CreateMandateResponse response = await client.Merchant("merchantId").Mandates().Create(body);
            }
#pragma warning restore 0168
        }
        public async void Example()
        {
#pragma warning disable 0168
            using (Client client = GetClient())
            {
                AmountOfMoney amountOfMoney = new AmountOfMoney();
                amountOfMoney.Amount       = 2345L;
                amountOfMoney.CurrencyCode = "EUR";

                BankAccountIban bankAccountIban = new BankAccountIban();
                bankAccountIban.AccountHolderName = "Wile E. Coyote";
                bankAccountIban.Iban = "IT60X0542811101000000123456";

                Address address = new Address();
                address.City        = "Burbank";
                address.CountryCode = "US";
                address.HouseNumber = "411";
                address.State       = "California";
                address.Street      = "N Hollywood Way";
                address.Zip         = "91505";

                CompanyInformation companyInformation = new CompanyInformation();
                companyInformation.Name = "Acme Labs";

                ContactDetailsBase contactDetails = new ContactDetailsBase();
                contactDetails.EmailAddress = "*****@*****.**";

                PersonalName name = new PersonalName();
                name.FirstName     = "Wile";
                name.Surname       = "Coyote";
                name.SurnamePrefix = "E.";
                name.Title         = "Mr.";

                PayoutCustomer customer = new PayoutCustomer();
                customer.Address            = address;
                customer.CompanyInformation = companyInformation;
                customer.ContactDetails     = contactDetails;
                customer.Name = name;

                BankTransferPayoutMethodSpecificInput bankTransferPayoutMethodSpecificInput = new BankTransferPayoutMethodSpecificInput();
                bankTransferPayoutMethodSpecificInput.BankAccountIban = bankAccountIban;
                bankTransferPayoutMethodSpecificInput.Customer        = customer;
                bankTransferPayoutMethodSpecificInput.PayoutDate      = "20150102";
                bankTransferPayoutMethodSpecificInput.PayoutText      = "Payout Acme";
                bankTransferPayoutMethodSpecificInput.SwiftCode       = "swift";

                PayoutReferences references = new PayoutReferences();
                references.MerchantReference = "AcmeOrder001";

                CreatePayoutRequest body = new CreatePayoutRequest();
                body.AmountOfMoney = amountOfMoney;
                body.BankTransferPayoutMethodSpecificInput = bankTransferPayoutMethodSpecificInput;
                body.References = references;

                try
                {
                    PayoutResponse response = await client.Merchant("merchantId").Payouts().Create(body);
                }
                catch (DeclinedPayoutException e)
                {
                    HandleDeclinedPayout(e.PayoutResult);
                }
                catch (ApiException e)
                {
                    HandleApiErrors(e.Errors);
                }
            }
#pragma warning restore 0168
        }