diff --git a/lib/mollie/organization.rb b/lib/mollie/organization.rb index 369716b..84ade57 100644 --- a/lib/mollie/organization.rb +++ b/lib/mollie/organization.rb @@ -19,5 +19,9 @@ def self.current(options = {}) def address=(address) @address = OpenStruct.new(address) if address.is_a?(Hash) end + + def dashboard_url + Util.extract_url(links, 'dashboard') + end end end diff --git a/test/fixtures/shipments/get.json b/test/fixtures/shipments/get.json index 0a82834..b3a9bd4 100644 --- a/test/fixtures/shipments/get.json +++ b/test/fixtures/shipments/get.json @@ -86,7 +86,7 @@ ], "_links": { "self": { - "href": "https://api.mollie.com/v2/shipments/shp_bjylrn", + "href": "https://api.mollie.com/v2/order/ord_kEn1PlbGa/shipments/shp_3wmsgCJN4U", "type": "application/hal+json" }, "order": { diff --git a/test/mollie/organization_test.rb b/test/mollie/organization_test.rb index de30ef1..2c4b69f 100644 --- a/test/mollie/organization_test.rb +++ b/test/mollie/organization_test.rb @@ -21,7 +21,11 @@ def test_setting_attributes 'self' => { 'href' => 'https://api.mollie.com/v2/organizations/org_12345678', 'type' => 'application/hal+json' - }, + }, + 'dashboard' => { + 'href' => 'https://mollie.com/dashboard/org_12345678', + 'type' => 'text/html' + }, 'documentation' => { 'href' => 'https://docs.mollie.com/reference/v2/organizations-api/get-organization', 'type' => 'text/html' @@ -43,6 +47,7 @@ def test_setting_attributes assert_equal 'NL815839091B01', organization.vat_number assert_equal 'dutch', organization.vat_regulation assert_equal 'https://api.mollie.com/v2/organizations/org_12345678', organization.links['self']['href'] + assert_equal 'https://mollie.com/dashboard/org_12345678', organization.dashboard_url end def test_current_organization diff --git a/test/mollie/settlement_test.rb b/test/mollie/settlement_test.rb index e8e4ad6..b0d3302 100644 --- a/test/mollie/settlement_test.rb +++ b/test/mollie/settlement_test.rb @@ -90,7 +90,8 @@ def test_setting_attributes currency: 'EUR' } } - ] + ], + invoice_id: 'inv_FrvewDA3Pr' } } }, @@ -149,6 +150,8 @@ def test_setting_attributes assert_equal '0.5000', settlement.periods[:'2015'][:'11'].costs[1].amount_net.value assert_equal '0.1050', settlement.periods[:'2015'][:'11'].costs[1].amount_vat.value assert_equal '0.6050', settlement.periods[:'2015'][:'11'].costs[1].amount_gross.value + + assert_equal 'inv_FrvewDA3Pr', settlement.periods[:'2015'][:'11'].invoice_id end def test_status_open