diff --git a/.github/workflows/auto-merge-client-library-changes.yml b/.github/workflows/auto-merge-client-library-changes.yml new file mode 100644 index 0000000..004a0b8 --- /dev/null +++ b/.github/workflows/auto-merge-client-library-changes.yml @@ -0,0 +1,22 @@ +name: Auto-merge client-library changes + +on: pull_request_target + +permissions: + pull-requests: write + +jobs: + merge: + runs-on: ubuntu-latest + if: ${{ github.actor == 'gocardless-ci-robot[bot]' && github.event.pull_request.head.ref == 'template-changes' }} + steps: + - name: Approve PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Enable auto-merge + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GOCARDLESS_CI_ROBOT_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddce198..c770779 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - run: bundle install && bundle exec rspec all-tests-passed: - name: All tests passed + name: all-tests-passed runs-on: ubuntu-latest needs: [test] if: always() @@ -75,12 +75,35 @@ jobs: printf -- "---\n:rubygems_api_key: $RUBYGEM_PUBLISH_API_KEY\n" > $HOME/.gem/credentials gem build *.gemspec gem push *.gem + + + - name: Extract changelog notes for this version + id: notes + if: steps.version_check.outputs.already_published == 'false' + run: | + VERSION="${{ steps.version_check.outputs.version }}" + NOTES="" + if [ -f CHANGELOG.md ]; then + NOTES=$(awk -v ver="$VERSION" ' + $0 ~ "^## " ver {p=1; next} + p && /^## / {exit} + p {print} + ' CHANGELOG.md) + fi + { + echo "notes<> "$GITHUB_OUTPUT" + - name: Create GitHub Release if: steps.version_check.outputs.already_published == 'false' env: GH_TOKEN: ${{ github.token }} run: | - VERSION=${{ steps.version_check.outputs.version }} - gh release create "v$VERSION" \ - --title "v$VERSION" \ - --generate-notes + NOTES="${{ steps.notes.outputs.notes }}" + if [ -n "$(echo "$NOTES" | tr -d '[:space:]')" ]; then + gh release create v${{ steps.version_check.outputs.version }} --notes "$NOTES" + else + gh release create v${{ steps.version_check.outputs.version }} --generate-notes + fi diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5bef057 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ + +# Changelog + +## 4.4.1 + +Start of changelog tracking with Knope. See [GitHub releases](https://github.com/gocardless/gocardless-pro-ruby/releases) for the history of earlier versions. diff --git a/gocardless_pro.gemspec b/gocardless_pro.gemspec index 8c87590..1d6c888 100644 --- a/gocardless_pro.gemspec +++ b/gocardless_pro.gemspec @@ -21,8 +21,8 @@ Gem::Specification.new do |spec| spec.add_dependency 'faraday', ['>= 2', '< 3'] spec.add_dependency 'base64' - spec.add_development_dependency 'rspec', '~> 3.13.0' - spec.add_development_dependency 'webmock', '~> 3.24.0' - spec.add_development_dependency 'rubocop', '~> 1.85.0' - spec.add_development_dependency 'yard', '~> 0.9.37' + spec.add_development_dependency 'rspec', '~> 3.13.2' + spec.add_development_dependency 'webmock', '~> 3.26.2' + spec.add_development_dependency 'rubocop', '~> 1.89.0' + spec.add_development_dependency 'yard', '~> 0.9.45' end diff --git a/lib/gocardless_pro/resources/institution.rb b/lib/gocardless_pro/resources/institution.rb index 3d89ad3..4fab567 100644 --- a/lib/gocardless_pro/resources/institution.rb +++ b/lib/gocardless_pro/resources/institution.rb @@ -24,6 +24,7 @@ class Institution attr_reader :limits attr_reader :logo_url attr_reader :name + attr_reader :roles attr_reader :status # Initialize a institution resource instance @@ -38,6 +39,7 @@ def initialize(object, response = nil) @limits = object['limits'] @logo_url = object['logo_url'] @name = object['name'] + @roles = object['roles'] @status = object['status'] @response = response end diff --git a/lib/gocardless_pro/resources/outbound_payment.rb b/lib/gocardless_pro/resources/outbound_payment.rb index fe95aa6..2558c94 100644 --- a/lib/gocardless_pro/resources/outbound_payment.rb +++ b/lib/gocardless_pro/resources/outbound_payment.rb @@ -18,7 +18,7 @@ module Resources # the status of the outbound payment changes # (https://developer.gocardless.com/api-reference/#event-types-outbound-payment). # - # ####Rate limiting + # Rate limiting # # Two rate limits apply to the Outbound Payments APIs: # diff --git a/lib/gocardless_pro/resources/payer_authorisation.rb b/lib/gocardless_pro/resources/payer_authorisation.rb index e96ccd6..4e4a9d0 100644 --- a/lib/gocardless_pro/resources/payer_authorisation.rb +++ b/lib/gocardless_pro/resources/payer_authorisation.rb @@ -51,14 +51,14 @@ module Resources # https://api.gocardless.com/events?payer_authorisation={id}&action=completed # # - # Note that the `create` and `update` endpoints behave differently than - # other existing `create` and `update` endpoints. The Payer Authorisation is + # Note that the create and update endpoints behave differently than + # other existing create and update endpoints. The Payer Authorisation is # still saved if incomplete data is provided. - # We return the list of incomplete data in the `incomplete_fields` along - # with the resources in the body of the response. + # We return the list of incomplete data in the incomplete_fields along with + # the resources in the body of the response. # The bank account details(account_number, bank_code & branch_code) must be # sent together rather than splitting across different request for both - # `create` and `update` endpoints. + # create and update endpoints. # # # The API is designed to be flexible and allows you to collect information diff --git a/lib/gocardless_pro/resources/redirect_flow.rb b/lib/gocardless_pro/resources/redirect_flow.rb index b006810..f1de0cd 100644 --- a/lib/gocardless_pro/resources/redirect_flow.rb +++ b/lib/gocardless_pro/resources/redirect_flow.rb @@ -13,8 +13,8 @@ module Resources # Deprecated: Redirect Flows are legacy APIs and cannot be used by new # integrators. # The Billing Request flow - # (https://developer.gocardless.com/api-reference/#billing-requests) API - # should be used for your payment flows. + # (https://developer.gocardless.com/api-reference/#billing-requests-billing-requests) + # API should be used for your payment flows. # # Redirect flows enable you to use GoCardless' hosted payment pages # (https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up mandates diff --git a/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb b/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb index 7fc3ac3..2305847 100644 --- a/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +++ b/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb @@ -11,9 +11,9 @@ module Services # Service for making requests to the BankAccountHolderVerification endpoints class BankAccountHolderVerificationsService < BaseService # Verify the account holder of the bank account. A complete verification can be - # attached when creating an outbound payment. This endpoint allows partner - # merchants to create Confirmation of Payee checks on customer bank accounts - # before sending outbound payments. + # attached when creating an outbound payment. + # This endpoint allows partner merchants to create Confirmation of Payee checks + # on customer bank accounts before sending outbound payments. # Example URL: /bank_account_holder_verifications # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) diff --git a/lib/gocardless_pro/services/bank_details_lookups_service.rb b/lib/gocardless_pro/services/bank_details_lookups_service.rb index 4d7f272..2d6d29c 100644 --- a/lib/gocardless_pro/services/bank_details_lookups_service.rb +++ b/lib/gocardless_pro/services/bank_details_lookups_service.rb @@ -13,11 +13,15 @@ class BankDetailsLookupsService < BaseService # Performs a bank details lookup. As part of the lookup, a modulus check and # reachability check are performed. # - # For UK-based bank accounts, where an account holder name is provided (and an - # account number, a sort code or an iban - # are already present), we verify that the account holder name and bank account - # number match the details held by - # the relevant bank. + # For UK or Eurozone-based bank accounts, where an account holder name is + # provided + # (and an account number, a sort code or an IBAN are already present), we verify + # that + # the account holder name and bank account number match the details held by the + # relevant bank. + # If there is no match, the endpoint will return a 422 - validation error on + # account_holder_name: + # "Account holder name does not match bank account details provided". # # If your request returns an error # (https://developer.gocardless.com/api-reference/#api-usage-errors) or the diff --git a/lib/gocardless_pro/services/billing_requests_service.rb b/lib/gocardless_pro/services/billing_requests_service.rb index d68eab7..c6bf3e0 100644 --- a/lib/gocardless_pro/services/billing_requests_service.rb +++ b/lib/gocardless_pro/services/billing_requests_service.rb @@ -10,8 +10,8 @@ module GoCardlessPro module Services # Service for making requests to the BillingRequest endpoints class BillingRequestsService < BaseService - # Important: All properties associated with `subscription_request` and - # `instalment_schedule_request` are only supported for ACH and PAD schemes. + # Important: All properties associated with subscription_request and + # instalment_schedule_request are only supported for ACH and PAD schemes. # Example URL: /billing_requests # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -112,11 +112,15 @@ def collect_customer_details(identity, options = {}) # customer is requested to adjust the account number/routing number and # succeed in this check to continue with the flow. # - # BACS scheme Payer Name Verification + # BACS and SEPA schemes Payer Name Verification # (https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB) - # is enabled by default for UK based bank accounts, meaning we verify the - # account holder name and bank account - # number match the details held by the relevant bank. + # is enabled by default for UK and Eurozone based bank accounts, meaning we + # verify the account holder name and bank account number/IBAN match + # the details held by the relevant bank. If there is no match, the endpoint will + # return a 422 - validation error on account_holder_name: + # "Account holder name does not match bank account details provided". Testing + # instructions are here + # (https://developer.gocardless.com/developer-tools/scenario-simulators/#payer_name_verification) # Example URL: /billing_requests/:identity/actions/collect_bank_account # # @param identity # Unique identifier, beginning with "BRQ". diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 67d9813..f557d9e 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe GoCardlessPro::Client do - subject { -> { described_class.new(options) } } + subject(:client) { described_class.new(options) } let(:options) do { @@ -14,6 +14,8 @@ let(:environment) { :live } let(:token) { nil } - it { is_expected.to raise_error('No Access Token given to GoCardless Client') } + it 'raises an error' do + expect { client }.to raise_error('No Access Token given to GoCardless Client') + end end end diff --git a/spec/code_samples/customer_notifications_code_samples_spec.rb b/spec/code_samples/customer_notifications_code_samples_spec.rb index 4a8bf2d..f72753b 100644 --- a/spec/code_samples/customer_notifications_code_samples_spec.rb +++ b/spec/code_samples/customer_notifications_code_samples_spec.rb @@ -29,7 +29,7 @@ it 'executes without error' do @client = client - @client.customer_notifications.handle('PCN123') + @client.customer_notifications.handle('EV1D18JEXAMPLE') end end end diff --git a/spec/resources/institution_spec.rb b/spec/resources/institution_spec.rb index bb92606..29eb621 100644 --- a/spec/resources/institution_spec.rb +++ b/spec/resources/institution_spec.rb @@ -25,6 +25,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -55,6 +56,8 @@ expect(get_list_response.records.first.name).to eq('name-input') + expect(get_list_response.records.first.roles).to eq('roles-input') + expect(get_list_response.records.first.status).to eq('status-input') end @@ -80,6 +83,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -103,6 +107,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -140,6 +145,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -190,6 +196,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }, }.to_json, diff --git a/spec/services/institutions_service_spec.rb b/spec/services/institutions_service_spec.rb index a2ce684..191a682 100644 --- a/spec/services/institutions_service_spec.rb +++ b/spec/services/institutions_service_spec.rb @@ -24,6 +24,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -59,6 +60,8 @@ expect(get_list_response.records.first.name).to eq('name-input') + expect(get_list_response.records.first.roles).to eq('roles-input') + expect(get_list_response.records.first.status).to eq('status-input') end @@ -107,6 +110,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -130,6 +134,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -162,6 +167,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -185,6 +191,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -213,6 +220,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -239,6 +247,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -276,6 +285,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }], meta: { @@ -337,6 +347,7 @@ 'limits' => 'limits-input', 'logo_url' => 'logo_url-input', 'name' => 'name-input', + 'roles' => 'roles-input', 'status' => 'status-input', }, }.to_json,