Skip to content

Commit

Permalink
Fix typo in field mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschmeling committed Dec 9, 2024
1 parent b5da4a8 commit abcddc4
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php declare(strict_types = 1);
<?php declare(strict_types=1);

namespace RemoteDataBlocks\Integrations\SalesforceB2C\Queries;

use RemoteDataBlocks\Config\QueryContext\HttpQueryContext;
use RemoteDataBlocks\Integrations\SalesforceB2C\Auth\SalesforceB2CAuth;

class SalesforceB2CGetProductQuery extends HttpQueryContext {
public function get_input_schema(): array {
class SalesforceB2CGetProductQuery extends HttpQueryContext
{
public function get_input_schema(): array
{
return [
'product_id' => [
'name' => 'Product ID',
Expand All @@ -21,7 +23,8 @@ public function get_input_schema(): array {
];
}

public function get_output_schema(): array {
public function get_output_schema(): array
{
return [
'is_collection' => false,
'mappings' => [
Expand All @@ -31,7 +34,7 @@ public function get_output_schema(): array {
'type' => 'id',
],
'name' => [
'name' => 'Namef',
'name' => 'Name',
'path' => '$.name',
'type' => 'string',
],
Expand Down Expand Up @@ -59,7 +62,8 @@ public function get_output_schema(): array {
];
}

public function get_request_headers( array $input_variables ): array {
public function get_request_headers(array $input_variables): array
{
$data_source_config = $this->get_data_source()->to_array();
$data_source_endpoint = $this->get_data_source()->get_endpoint();

Expand All @@ -74,22 +78,24 @@ public function get_request_headers( array $input_variables ): array {
'Content-Type' => 'application/json',
];

if ( is_wp_error( $access_token ) ) {
if (is_wp_error($access_token)) {
return $headers;
}

$headers['Authorization'] = sprintf( 'Bearer %s', $access_token );
$headers['Authorization'] = sprintf('Bearer %s', $access_token);
return $headers;
}

public function get_endpoint( array $input_variables ): string {
public function get_endpoint(array $input_variables): string
{
$data_source_endpoint = $this->get_data_source()->get_endpoint();
$data_source_config = $this->get_data_source()->to_array();

return sprintf( '%s/product/shopper-products/v1/organizations/%s/products/%s?siteId=RefArchGlobal', $data_source_endpoint, $data_source_config['organization_id'], $input_variables['product_id'] );
return sprintf('%s/product/shopper-products/v1/organizations/%s/products/%s?siteId=RefArchGlobal', $data_source_endpoint, $data_source_config['organization_id'], $input_variables['product_id']);
}

public function get_query_name(): string {
public function get_query_name(): string
{
return $this->config['query_name'] ?? 'Get item';
}
}

0 comments on commit abcddc4

Please sign in to comment.