Skip to content

mpajak99/stripeAPI-invoicing-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StripeAPI Invoicing App

About 💡

This Spring Boot application uses Strpe API what gives the user capabilities of managing invoices in the Stripe payment system.

Postman testing ✅

  • CustomerController
    @GetMapping
    public ResponseEntity<List<Customer>> getAllCustomers() throws StripeException{
        if(customerService.getAllCustomers().isEmpty()) {
            return new ResponseEntity<>(HttpStatus.NO_CONTENT);
        }
        return new ResponseEntity<>(customerService.getAllCustomers(), HttpStatus.OK);
    }

    @PostMapping
    public ResponseEntity<Customer> addCustomer(@Valid @RequestBody CustomerData customerData) throws StripeException {
        Customer addedCustomer = customerService.addCustomer(customerData);

        return new ResponseEntity<>(addedCustomer, HttpStatus.CREATED);
    }

Adding customer: POST request at localhost:8080/customers Post request customer

Getting all customers: GET request at localhost:8080/customers Get request customer

  • InvoiceController
    @GetMapping (path = "/{id}")
    public ResponseEntity<Invoice> getInvoiceById (@PathVariable("id") String id) throws StripeException {
        try {
            invoiceService.getInvoiceById(id);
        } catch (Exception e) {
            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<>(invoiceService.getInvoiceById(id), HttpStatus.OK);
    }

    @PostMapping
    public ResponseEntity<Invoice> addInvoice (@Valid @RequestBody InvoiceData invoiceData) throws StripeException {
        Invoice addedInvoice = invoiceService.addInvoice(invoiceData);

        return new ResponseEntity<>(addedInvoice, HttpStatus.CREATED);
    }

Adding invoice: POST request at localhost:8080/invoices Post request invoice

Getting invoice by its id: GET request at localhost:8080/invoices Get request invoice

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages