github.com/mundipagg/boleto-api@v0.0.0-20230620145841-3f9ec742599f/bb/stub_builder.go (about)

     1  package bb
     2  
     3  import (
     4  	"github.com/mundipagg/boleto-api/models"
     5  	"github.com/mundipagg/boleto-api/test"
     6  )
     7  
     8  type stubBoletoRequestBB struct {
     9  	test.StubBoletoRequest
    10  }
    11  
    12  func newStubBoletoRequestBB() *stubBoletoRequestBB {
    13  	base := test.NewStubBoletoRequest(models.BancoDoBrasil)
    14  
    15  	s := &stubBoletoRequestBB{
    16  		StubBoletoRequest: *base,
    17  	}
    18  
    19  	s.Agreement = models.Agreement{}
    20  	s.Title = models.Title{}
    21  	s.Recipient = models.Recipient{}
    22  	s.Buyer = models.Buyer{}
    23  	s.Buyer.Address = models.Address{}
    24  
    25  	return s
    26  }
    27  
    28  func (s *stubBoletoRequestBB) WithAgreement(agreement models.Agreement) *stubBoletoRequestBB {
    29  	s.Agreement = agreement
    30  	return s
    31  }
    32  
    33  func (s *stubBoletoRequestBB) WithTitle(title models.Title) *stubBoletoRequestBB {
    34  	s.Title = title
    35  	return s
    36  }
    37  
    38  func (s *stubBoletoRequestBB) WithRecipient(recipient models.Recipient) *stubBoletoRequestBB {
    39  	s.Recipient = recipient
    40  	return s
    41  }
    42  
    43  func (s *stubBoletoRequestBB) WithBuyer(buyer models.Buyer) *stubBoletoRequestBB {
    44  	s.Buyer = buyer
    45  	return s
    46  }
    47  
    48  func (s *stubBoletoRequestBB) WithBuyerAddress(address models.Address) *stubBoletoRequestBB {
    49  	s.Buyer.Address = address
    50  	return s
    51  }