File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 112112 end
113113 end
114114
115+ context 'when currency is given' do
116+ before do
117+ stub_request ( :get , 'https://api.getlago.com/api/v1/payment_requests?currency=EUR' )
118+ . to_return ( body : payment_requests_response , status : 200 )
119+ end
120+
121+ it 'returns payment requests filtered by currency' do
122+ response = resource . get_all ( { currency : 'EUR' } )
123+
124+ expect ( response [ 'payment_requests' ] . first [ 'lago_id' ] ) . to eq ( payment_request_id )
125+ expect ( response [ 'meta' ] [ 'current_page' ] ) . to eq ( 1 )
126+ end
127+ end
128+
115129 context 'when there is an issue' do
116130 before do
117131 stub_request ( :get , 'https://api.getlago.com/api/v1/payment_requests' )
Original file line number Diff line number Diff line change 482482 end
483483 end
484484
485+ context 'when currency is given' do
486+ before do
487+ stub_request ( :get , 'https://api.getlago.com/api/v1/subscriptions?currency=EUR' )
488+ . to_return ( body : response , status : 200 )
489+ end
490+
491+ it 'returns subscriptions filtered by currency' do
492+ response = resource . get_all ( { currency : 'EUR' } )
493+
494+ expect ( response [ 'subscriptions' ] . first [ 'lago_id' ] ) . to eq ( factory_subscription . lago_id )
495+ expect ( response [ 'meta' ] [ 'current_page' ] ) . to eq ( 1 )
496+ end
497+ end
498+
485499 context 'when status is given' do
486500 before do
487501 stub_request ( :get , 'https://api.getlago.com/api/v1/subscriptions?external_customer_id=123&status%5B%5D=pending' )
Original file line number Diff line number Diff line change 727727 end
728728 end
729729
730+ context 'when currency is given' do
731+ before do
732+ stub_request ( :get , 'https://api.getlago.com/api/v1/wallets?currency=EUR' )
733+ . to_return ( body : response , status : 200 )
734+ end
735+
736+ it 'returns wallets filtered by currency' do
737+ response = resource . get_all ( { currency : 'EUR' } )
738+
739+ expect ( response [ 'wallets' ] . first [ 'lago_id' ] ) . to eq ( 'this-is-lago-id' )
740+ expect ( response [ 'meta' ] [ 'current_page' ] ) . to eq ( 1 )
741+ end
742+ end
743+
730744 context 'when there is an issue' do
731745 before do
732746 stub_request ( :get , 'https://api.getlago.com/api/v1/wallets' )
You can’t perform that action at this time.
0 commit comments