|
384 | 384 | expect(response_hash).to be_a_kind_of Hash |
385 | 385 | end |
386 | 386 |
|
| 387 | + it 'makes a get_tax_form_summary GET call' do |
| 388 | + response_body = json_from_file('mocks/responses/BalancePlatform/get_tax_form_summary.json') |
| 389 | + account_holder_id = 'AH3227C223222C5GKR23686TF' |
| 390 | + |
| 391 | + url = @shared_values[:client].service_url( |
| 392 | + @shared_values[:service], |
| 393 | + "accountHolders/#{account_holder_id}/taxFormSummary", |
| 394 | + @shared_values[:client].balance_platform.version |
| 395 | + ) |
| 396 | + WebMock.stub_request(:get, url) |
| 397 | + .with(headers: { 'x-api-key' => @shared_values[:client].api_key }) |
| 398 | + .to_return(body: response_body) |
| 399 | + |
| 400 | + result = @shared_values[:client].balance_platform.account_holders_api |
| 401 | + .get_tax_form_summary(account_holder_id) |
| 402 | + response_hash = result.response |
| 403 | + |
| 404 | + expect(result.status).to eq(200) |
| 405 | + expect(response_hash).to eq(JSON.parse(response_body)) |
| 406 | + expect(response_hash).to be_a Adyen::HashWithAccessors |
| 407 | + expect(response_hash).to be_a_kind_of Hash |
| 408 | + end |
| 409 | + |
| 410 | + ## directDebitMandates |
| 411 | + it 'makes a get_list_of_mandates GET call' do |
| 412 | + response_body = json_from_file('mocks/responses/BalancePlatform/get_list_of_mandates.json') |
| 413 | + |
| 414 | + url = @shared_values[:client].service_url( |
| 415 | + @shared_values[:service], |
| 416 | + 'mandates', |
| 417 | + @shared_values[:client].balance_platform.version |
| 418 | + ) |
| 419 | + WebMock.stub_request(:get, url) |
| 420 | + .with(headers: { 'x-api-key' => @shared_values[:client].api_key }) |
| 421 | + .to_return(body: response_body) |
| 422 | + |
| 423 | + result = @shared_values[:client].balance_platform.direct_debit_mandates_api.get_list_of_mandates |
| 424 | + response_hash = result.response |
| 425 | + |
| 426 | + expect(result.status).to eq(200) |
| 427 | + expect(response_hash).to eq(JSON.parse(response_body)) |
| 428 | + expect(response_hash).to be_a Adyen::HashWithAccessors |
| 429 | + expect(response_hash).to be_a_kind_of Hash |
| 430 | + end |
| 431 | + |
| 432 | + it 'makes a get_mandate_by_id GET call' do |
| 433 | + response_body = json_from_file('mocks/responses/BalancePlatform/get_mandate_by_id.json') |
| 434 | + mandate_id = 'MNDT7QXPLKT9R333640TX334709E' |
| 435 | + |
| 436 | + url = @shared_values[:client].service_url( |
| 437 | + @shared_values[:service], |
| 438 | + "mandates/#{mandate_id}", |
| 439 | + @shared_values[:client].balance_platform.version |
| 440 | + ) |
| 441 | + WebMock.stub_request(:get, url) |
| 442 | + .with(headers: { 'x-api-key' => @shared_values[:client].api_key }) |
| 443 | + .to_return(body: response_body) |
| 444 | + |
| 445 | + result = @shared_values[:client].balance_platform.direct_debit_mandates_api.get_mandate_by_id(mandate_id) |
| 446 | + response_hash = result.response |
| 447 | + |
| 448 | + expect(result.status).to eq(200) |
| 449 | + expect(response_hash).to eq(JSON.parse(response_body)) |
| 450 | + expect(response_hash).to be_a Adyen::HashWithAccessors |
| 451 | + expect(response_hash).to be_a_kind_of Hash |
| 452 | + end |
| 453 | + |
| 454 | + it 'makes a cancel_mandate POST call' do |
| 455 | + mandate_id = 'MNDT7QXPLKT9R333640TX334709E' |
| 456 | + |
| 457 | + url = @shared_values[:client].service_url( |
| 458 | + @shared_values[:service], |
| 459 | + "mandates/#{mandate_id}/cancel", |
| 460 | + @shared_values[:client].balance_platform.version |
| 461 | + ) |
| 462 | + WebMock.stub_request(:post, url) |
| 463 | + .with(headers: { 'x-api-key' => @shared_values[:client].api_key }) |
| 464 | + .to_return(status: 202, body: '') |
| 465 | + |
| 466 | + result = @shared_values[:client].balance_platform.direct_debit_mandates_api.cancel_mandate(mandate_id) |
| 467 | + |
| 468 | + expect(result.status).to eq(202) |
| 469 | + end |
| 470 | + |
| 471 | + it 'makes an update_mandate PATCH call' do |
| 472 | + request_body = JSON.parse(json_from_file('mocks/requests/BalancePlatform/update_mandate.json')) |
| 473 | + response_body = json_from_file('mocks/responses/BalancePlatform/get_mandate_by_id.json') |
| 474 | + mandate_id = 'MNDT7QXPLKT9R333640TX334709E' |
| 475 | + |
| 476 | + url = @shared_values[:client].service_url( |
| 477 | + @shared_values[:service], |
| 478 | + "mandates/#{mandate_id}", |
| 479 | + @shared_values[:client].balance_platform.version |
| 480 | + ) |
| 481 | + WebMock.stub_request(:patch, url) |
| 482 | + .with( |
| 483 | + body: request_body, |
| 484 | + headers: { 'x-api-key' => @shared_values[:client].api_key } |
| 485 | + ) |
| 486 | + .to_return(body: response_body) |
| 487 | + |
| 488 | + result = @shared_values[:client].balance_platform.direct_debit_mandates_api |
| 489 | + .update_mandate(request_body, mandate_id) |
| 490 | + response_hash = result.response |
| 491 | + |
| 492 | + expect(result.status).to eq(200) |
| 493 | + expect(response_hash).to eq(JSON.parse(response_body)) |
| 494 | + expect(response_hash).to be_a Adyen::HashWithAccessors |
| 495 | + expect(response_hash).to be_a_kind_of Hash |
| 496 | + end |
| 497 | + |
387 | 498 | ## authorisedCardUsers |
388 | 499 | it 'makes a get_all_authorised_card_users GET call' do |
389 | 500 | response_body = json_from_file('mocks/responses/BalancePlatform/get_all_authorised_card_users.json') |
|
0 commit comments