Coder Social home page Coder Social logo

spring-io-lab-3's Introduction

Prezentacja: https://docs.google.com/presentation/d/1lY6ucGmfQnB_TTFckNz4DV0iC91eragbazOG_hrpwZI/edit?usp=sharing

System Requirements:

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started-system-requirements

Kolejność konfiguracji:

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config

Prezentacja Sam'a Newman'a: https://vimeo.com/105751281

CreditCard: String number

Customer: String firstName String lastName Set creditCards

Wyszukanie klienta po numerze karty: GET /byCreditCard/{number}

Asercje z JSON-path:

<dependency>
    <groupId>com.jayway.jsonpath</groupId>
    <artifactId>json-path</artifactId>
    <scope>test</scope>
</dependency>

Teach a dog to REST: https://vimeo.com/17785736

CRUD do Customer'a. Walidacja firstName i lastName po blackliście z properies'ów (@ExceptionHandler).

@Bean
public EnvironmentRepository environmentRepository() {
	return new NativeEnvironmentRepository(environment);
}
@Component
class DbPopulator implements CommandLineRunner {

    @Autowired CustomerRepository repository

    @Override
    void run(String... args) throws Exception {
        if (repository.findAll().isEmpty()) {
            repository.save([
                new Customer(
                    firstName: 'John',
                    lastName: 'Smith',
                    creditCard: '9876543212345678'),
                new Customer(
                    firstName: 'Jane',
                    lastName: 'Smith',
                    creditCard: '9876678998766789')])
        }
    }
}
class PaybackPolicy {
	BigDecimal percentage
    BigDecimal minAmount
    BigDecimal maxPayback
}
class Merchant {
	String name
	PaybackPolicy paybackPolicy
}
@Configuration
class RepositoryRestMvcConfigurer extends SpringBootRepositoryRestMvcConfiguration {

    @Override
    protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
        super.configureRepositoryRestConfiguration(config)
        config.exposeIdsFor(Merchant)
    }
}

Stworzyć endpoint REST'owy, który przyjmuje na wejściu obiekt Purchase, znajduje przy pomocy feign-client'ów dane customer'a na podstawie jego numeru karty kredytowej oraz dane merchant'a na podstawie jego id, a nstępnie wylicza kwotę payback'u przez mnożenie kwoty transakcji i procentu payback'u i zapisuje wynik w encji Payback w swojej bazie danych. Drugi endpoint do listowania zapisanych obiektów Payback.

class Purchase {
    BigDecimal amount
    String creditCardNumber
    Long merchantId
}

class Payback {
	String id
	Long customerId
	BigDecimal amount
	Purchase purchase
}

https://github.com/spring-cloud-samples/authserver

http://localhost:8080/uaa/oauth/authorize?response_type=code&client_id=acme&redirect_uri=http://example.com

POST http://localhost:8080/uaa/oauth/token
Authorization: Basic YWNtZTphY21lc2VjcmV0

grant_type=authorization_code&code=DKe5p2&redirect_uri=http%3A%2F%2Fexample.com
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGp/Q5lh0P8nPL21oMMrt2RrkT9AW5jgYwLfSUnJVc9G6uR3cXRRDCjHqWU5WYwivcF180A6CWp/ireQFFBNowgc5XaA0kPpzEtgsA5YsNX7iSnUibB004iBTfU9hZ2Rbsc8cWqynT0RyN4TP1RYVSeVKvMQk4GT1r7JCEC+TNu1ELmbNwMQyzKjsfBXyIOCFU/E94ktvsTZUHF4Oq44DBylCDsS1k7/sfZC2G5EU7Oz0mhG8+Uz6MSEQHtoIi6mc8u64Rwi3Z3tscuWG2ShtsUFuNSAFNkY7LkLn+/hxLCu2bNISMaESa8dG22CIMuIeRLVcAmEWEWH5EEforTg+QIDAQAB
-----END PUBLIC KEY-----

spring-io-lab-3's People

Contributors

kaczynskid avatar

Watchers

 avatar  avatar

Forkers

jjakub83 luiz158

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.