Repository: kiwicom/mobile
Pull request #1257 (2018-10-26 13:23:02)

gitlab-ci: Use correct commit sha variable


Patch:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4b5a8245..5efea392 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,6 +22,6 @@ release:
   only:
     - master
   script:
-   - curl -gX POST $DEPLOY_TRIGGER_URL$CIRCLE_SHA1
+   - curl -gX POST $DEPLOY_TRIGGER_URL$CI_COMMIT_SHA
 
 
diff --git a/app/hotels/src/singleHotel/PaymentScreen.js b/app/hotels/src/singleHotel/PaymentScreen.js
index 5184ab6b..e7d8ee1b 100644
--- a/app/hotels/src/singleHotel/PaymentScreen.js
+++ b/app/hotels/src/singleHotel/PaymentScreen.js
@@ -21,7 +21,7 @@ import { withHotelsContext } from '../HotelsContext';
 import type { PaymentScreenQueryResponse } from './__generated__/PaymentScreenQuery.graphql';
 
 export type PaymentParameters = {|
-  +hotelId: number,
+  +hotelId: string,
   +checkin: Date,
   +checkout: Date,
   +rooms: Array<{|
@@ -94,12 +94,13 @@ export class PaymentScreen extends React.Component<PaymentParameters> {
       <PublicApiRenderer
         render={this.renderInner}
         query={graphql`
-          query PaymentScreenQuery {
-            hotelPaymentUrls {
+          query PaymentScreenQuery($hotelId: ID) {
+            hotelPaymentUrls(hotelId: $hotelId) {
               bookingComPaymentUrl
             }
           }
         `}
+        variables={{ hotelId: this.props.hotelId }}
       />
     </React.Fragment>
   );
@@ -122,7 +123,6 @@ export function createURI(pp: PaymentParameters, url: string): string {
   }, {});
 
   return `${url}&${querystring.stringify({
-    hotel_id: pp.hotelId,
     checkin: checkinQuery,
     interval: intervalQuery,
     ...roomsQuery,
diff --git a/app/hotels/src/singleHotel/__generated__/PaymentScreenQuery.graphql.js b/app/hotels/src/singleHotel/__generated__/PaymentScreenQuery.graphql.js
index 81e5374c..ff7abdd4 100644
--- a/app/hotels/src/singleHotel/__generated__/PaymentScreenQuery.graphql.js
+++ b/app/hotels/src/singleHotel/__generated__/PaymentScreenQuery.graphql.js
@@ -1,6 +1,6 @@
 /**
  * @flow
- * @relayHash 5dafec1044a34b2ec2734a78ab2fa1cd
+ * @relayHash 89fa8d8d3392666c9ee8d579b653cc2e
  */
 
 /* eslint-disable */
@@ -9,7 +9,9 @@
 
 /*::
 import type { ConcreteRequest } from 'relay-runtime';
-export type PaymentScreenQueryVariables = {||};
+export type PaymentScreenQueryVariables = {|
+  hotelId?: ?string
+|};
 export type PaymentScreenQueryResponse = {|
   +hotelPaymentUrls: ?{|
     +bookingComPaymentUrl: ?string
@@ -23,8 +25,10 @@ export type PaymentScreenQuery = {|
 
 
 /*
-query PaymentScreenQuery {
-  hotelPaymentUrls {
+query PaymentScreenQuery(
+  $hotelId: ID
+) {
+  hotelPaymentUrls(hotelId: $hotelId) {
     bookingComPaymentUrl
   }
 }
@@ -32,12 +36,27 @@ query PaymentScreenQuery {
 
 const node/*: ConcreteRequest*/ = (function(){
 var v0 = [
+  {
+    "kind": "LocalArgument",
+    "name": "hotelId",
+    "type": "ID",
+    "defaultValue": null
+  }
+],
+v1 = [
   {
     "kind": "LinkedField",
     "alias": null,
     "name": "hotelPaymentUrls",
     "storageKey": null,
-    "args": null,
+    "args": [
+      {
+        "kind": "Variable",
+        "name": "hotelId",
+        "variableName": "hotelId",
+        "type": "ID"
+      }
+    ],
     "concreteType": "HotelPaymentUrls",
     "plural": false,
     "selections": [
@@ -56,24 +75,24 @@ return {
   "operationKind": "query",
   "name": "PaymentScreenQuery",
   "id": null,
-  "text": "query PaymentScreenQuery {\n  hotelPaymentUrls {\n    bookingComPaymentUrl\n  }\n}\n",
+  "text": "query PaymentScreenQuery(\n  $hotelId: ID\n) {\n  hotelPaymentUrls(hotelId: $hotelId) {\n    bookingComPaymentUrl\n  }\n}\n",
   "metadata": {},
   "fragment": {
     "kind": "Fragment",
     "name": "PaymentScreenQuery",
     "type": "RootQuery",
     "metadata": null,
-    "argumentDefinitions": [],
-    "selections": v0
+    "argumentDefinitions": v0,
+    "selections": v1
   },
   "operation": {
     "kind": "Operation",
     "name": "PaymentScreenQuery",
-    "argumentDefinitions": [],
-    "selections": v0
+    "argumentDefinitions": v0,
+    "selections": v1
   }
 };
 })();
 // prettier-ignore
-(node/*: any*/).hash = '894d7dd18175ff2fefc9f746ab946ac9';
+(node/*: any*/).hash = '8b5ada67d5d06bd38230dbd5d6c7cc4c';
 module.exports = node;
diff --git a/app/hotels/src/singleHotel/__generated__/SingleHotelContainerQuery.graphql.js b/app/hotels/src/singleHotel/__generated__/SingleHotelContainerQuery.graphql.js
index 93f08915..4c70be54 100644
--- a/app/hotels/src/singleHotel/__generated__/SingleHotelContainerQuery.graphql.js
+++ b/app/hotels/src/singleHotel/__generated__/SingleHotelContainerQuery.graphql.js
@@ -1,6 +1,6 @@
 /**
  * @flow
- * @relayHash e79c07c2fb3396aa014eba919bc64e67
+ * @relayHash 63da141a478319844d8c76cb3ac5928f
  */
 
 /* eslint-disable */
@@ -99,8 +99,8 @@ fragment Header_hotel on HotelInterface {
   }
 }
 
-fragment BookNow_hotel on Hotel {
-  originalId
+fragment BookNow_hotel on HotelInterface {
+  id
 }
 
 fragment HotelInformation_hotel on Hotel {
@@ -238,40 +238,33 @@ v2 = {
 v3 = {
   "kind": "ScalarField",
   "alias": null,
-  "name": "id",
+  "name": "highResUrl",
   "args": null,
   "storageKey": null
 },
 v4 = {
   "kind": "ScalarField",
   "alias": null,
-  "name": "lowResUrl",
+  "name": "id",
   "args": null,
   "storageKey": null
 },
 v5 = {
   "kind": "ScalarField",
   "alias": null,
-  "name": "highResUrl",
+  "name": "lowResUrl",
   "args": null,
   "storageKey": null
 },
 v6 = {
-  "kind": "ScalarField",
-  "alias": null,
-  "name": "originalId",
-  "args": null,
-  "storageKey": null
-},
-v7 = {
   "kind": "ScalarField",
   "alias": null,
   "name": "amount",
   "args": null,
   "storageKey": null
 },
-v8 = [
-  v7,
+v7 = [
+  v6,
   {
     "kind": "ScalarField",
     "alias": null,
@@ -285,7 +278,7 @@ return {
   "operationKind": "query",
   "name": "SingleHotelContainerQuery",
   "id": null,
-  "text": "query SingleHotelContainerQuery(\n  $search: AvailableHotelSearchInput!\n  $options: AvailableHotelOptionsInput\n) {\n  availableHotel(search: $search, options: $options) {\n    ... on HotelAvailabilityInterface {\n      ...HotelDetailScreen_availableHotel\n    }\n    id\n  }\n}\n\nfragment HotelDetailScreen_availableHotel on HotelAvailability {\n  hotel {\n    ...Header_hotel\n    ...BookNow_hotel\n    ...HotelInformation_hotel\n    id\n  }\n  availableRooms {\n    ...RoomList\n    originalId\n    incrementalPrice {\n      amount\n      currency\n    }\n    id\n  }\n}\n\nfragment Header_hotel on HotelInterface {\n  name\n  mainPhoto {\n    highResUrl\n    id\n  }\n  rating {\n    stars\n    categoryName\n  }\n  photos {\n    edges {\n      node {\n        id\n        lowResUrl\n        highResUrl\n      }\n    }\n  }\n}\n\nfragment BookNow_hotel on Hotel {\n  originalId\n}\n\nfragment HotelInformation_hotel on Hotel {\n  ...Location_hotel\n  ...Description_hotel\n  ...HotelReview\n}\n\nfragment RoomList on HotelRoomAvailability {\n  id\n  ...RoomRow_availableRoom\n}\n\nfragment RoomRow_availableRoom on HotelRoomAvailability {\n  originalId\n  ...RoomBadges_availableRoom\n  room {\n    description {\n      title\n    }\n    ...RoomRowTitle_room\n    photos {\n      edges {\n        node {\n          highResUrl\n          lowResUrl\n          id\n        }\n      }\n    }\n    maxPersons\n    ...BeddingInfo_room\n    id\n  }\n  minimalPrice {\n    amount\n    currency\n  }\n  incrementalPrice {\n    amount\n    currency\n  }\n}\n\nfragment RoomBadges_availableRoom on HotelRoomAvailability {\n  isBreakfastIncluded\n  isRefundable\n}\n\nfragment RoomRowTitle_room on HotelRoom {\n  description {\n    title\n  }\n}\n\nfragment BeddingInfo_room on HotelRoom {\n  maxPersons\n  bedding {\n    type\n    amount\n  }\n}\n\nfragment Location_hotel on Hotel {\n  address {\n    street\n    city\n  }\n  coordinates {\n    lat\n    lng\n  }\n}\n\nfragment Description_hotel on Hotel {\n  summary\n  facilities {\n    ...Facilities_facilities\n  }\n}\n\nfragment HotelReview on HotelInterface {\n  review {\n    score\n    count\n  }\n}\n\nfragment Facilities_facilities on HotelFacilityConnection {\n  edges {\n    node {\n      id\n      name\n    }\n  }\n}\n",
+  "text": "query SingleHotelContainerQuery(\n  $search: AvailableHotelSearchInput!\n  $options: AvailableHotelOptionsInput\n) {\n  availableHotel(search: $search, options: $options) {\n    ... on HotelAvailabilityInterface {\n      ...HotelDetailScreen_availableHotel\n    }\n    id\n  }\n}\n\nfragment HotelDetailScreen_availableHotel on HotelAvailability {\n  hotel {\n    ...Header_hotel\n    ...BookNow_hotel\n    ...HotelInformation_hotel\n    id\n  }\n  availableRooms {\n    ...RoomList\n    originalId\n    incrementalPrice {\n      amount\n      currency\n    }\n    id\n  }\n}\n\nfragment Header_hotel on HotelInterface {\n  name\n  mainPhoto {\n    highResUrl\n    id\n  }\n  rating {\n    stars\n    categoryName\n  }\n  photos {\n    edges {\n      node {\n        id\n        lowResUrl\n        highResUrl\n      }\n    }\n  }\n}\n\nfragment BookNow_hotel on HotelInterface {\n  id\n}\n\nfragment HotelInformation_hotel on Hotel {\n  ...Location_hotel\n  ...Description_hotel\n  ...HotelReview\n}\n\nfragment RoomList on HotelRoomAvailability {\n  id\n  ...RoomRow_availableRoom\n}\n\nfragment RoomRow_availableRoom on HotelRoomAvailability {\n  originalId\n  ...RoomBadges_availableRoom\n  room {\n    description {\n      title\n    }\n    ...RoomRowTitle_room\n    photos {\n      edges {\n        node {\n          highResUrl\n          lowResUrl\n          id\n        }\n      }\n    }\n    maxPersons\n    ...BeddingInfo_room\n    id\n  }\n  minimalPrice {\n    amount\n    currency\n  }\n  incrementalPrice {\n    amount\n    currency\n  }\n}\n\nfragment RoomBadges_availableRoom on HotelRoomAvailability {\n  isBreakfastIncluded\n  isRefundable\n}\n\nfragment RoomRowTitle_room on HotelRoom {\n  description {\n    title\n  }\n}\n\nfragment BeddingInfo_room on HotelRoom {\n  maxPersons\n  bedding {\n    type\n    amount\n  }\n}\n\nfragment Location_hotel on Hotel {\n  address {\n    street\n    city\n  }\n  coordinates {\n    lat\n    lng\n  }\n}\n\nfragment Description_hotel on Hotel {\n  summary\n  facilities {\n    ...Facilities_facilities\n  }\n}\n\nfragment HotelReview on HotelInterface {\n  review {\n    score\n    count\n  }\n}\n\nfragment Facilities_facilities on HotelFacilityConnection {\n  edges {\n    node {\n      id\n      name\n    }\n  }\n}\n",
   "metadata": {},
   "fragment": {
     "kind": "Fragment",
@@ -335,32 +328,20 @@ return {
             "concreteType": "Hotel",
             "plural": false,
             "selections": [
+              v2,
               {
                 "kind": "LinkedField",
                 "alias": null,
-                "name": "address",
+                "name": "mainPhoto",
                 "storageKey": null,
                 "args": null,
-                "concreteType": "Address",
+                "concreteType": "HotelPhoto",
                 "plural": false,
                 "selections": [
-                  {
-                    "kind": "ScalarField",
-                    "alias": null,
-                    "name": "street",
-                    "args": null,
-                    "storageKey": null
-                  },
-                  {
-                    "kind": "ScalarField",
-                    "alias": null,
-                    "name": "city",
-                    "args": null,
-                    "storageKey": null
-                  }
+                  v3,
+                  v4
                 ]
               },
-              v2,
               {
                 "kind": "LinkedField",
                 "alias": null,
@@ -413,27 +394,39 @@ return {
                         "concreteType": "HotelPhoto",
                         "plural": false,
                         "selections": [
-                          v3,
                           v4,
-                          v5
+                          v5,
+                          v3
                         ]
                       }
                     ]
                   }
                 ]
               },
-              v6,
+              v4,
               {
                 "kind": "LinkedField",
                 "alias": null,
-                "name": "mainPhoto",
+                "name": "address",
                 "storageKey": null,
                 "args": null,
-                "concreteType": "HotelPhoto",
+                "concreteType": "Address",
                 "plural": false,
                 "selections": [
-                  v5,
-                  v3
+                  {
+                    "kind": "ScalarField",
+                    "alias": null,
+                    "name": "street",
+                    "args": null,
+                    "storageKey": null
+                  },
+                  {
+                    "kind": "ScalarField",
+                    "alias": null,
+                    "name": "city",
+                    "args": null,
+                    "storageKey": null
+                  }
                 ]
               },
               {
@@ -495,7 +488,7 @@ return {
                         "concreteType": "HotelFacility",
                         "plural": false,
                         "selections": [
-                          v3,
+                          v4,
                           v2
                         ]
                       }
@@ -527,8 +520,7 @@ return {
                     "storageKey": null
                   }
                 ]
-              },
-              v3
+              }
             ]
           },
           {
@@ -540,8 +532,14 @@ return {
             "concreteType": "HotelRoomAvailability",
             "plural": true,
             "selections": [
-              v3,
-              v6,
+              v4,
+              {
+                "kind": "ScalarField",
+                "alias": null,
+                "name": "originalId",
+                "args": null,
+                "storageKey": null
+              },
               {
                 "kind": "ScalarField",
                 "alias": null,
@@ -610,9 +608,9 @@ return {
                             "concreteType": "HotelPhoto",
                             "plural": false,
                             "selections": [
+                              v3,
                               v5,
-                              v4,
-                              v3
+                              v4
                             ]
                           }
                         ]
@@ -642,10 +640,10 @@ return {
                         "args": null,
                         "storageKey": null
                       },
-                      v7
+                      v6
                     ]
                   },
-                  v3
+                  v4
                 ]
               },
               {
@@ -656,7 +654,7 @@ return {
                 "args": null,
                 "concreteType": "Price",
                 "plural": false,
-                "selections": v8
+                "selections": v7
               },
               {
                 "kind": "LinkedField",
@@ -666,11 +664,11 @@ return {
                 "args": null,
                 "concreteType": "Price",
                 "plural": true,
-                "selections": v8
+                "selections": v7
               }
             ]
           },
-          v3
+          v4
         ]
       }
     ]
diff --git a/app/hotels/src/singleHotel/bookNow/BookNow.js b/app/hotels/src/singleHotel/bookNow/BookNow.js
index acecc201..be939e95 100644
--- a/app/hotels/src/singleHotel/bookNow/BookNow.js
+++ b/app/hotels/src/singleHotel/bookNow/BookNow.js
@@ -25,10 +25,10 @@ type PropsWithContext = {
 
 export class BookNow extends React.Component<PropsWithContext> {
   handleGoToPayment = () => {
-    const hotelId = idx(this.props.hotel, _ => _.originalId);
+    const hotelId = idx(this.props.hotel, _ => _.id);
     if (hotelId) {
       this.props.navigation.navigate('Payment', {
-        hotelId: Number(hotelId),
+        hotelId,
         rooms: convertRooms(this.props.selected),
         language: DeviceInfo.getLanguage(),
       });
@@ -71,8 +71,8 @@ export const BookNowWithContext = (props: Props) => {
 export default createFragmentContainer(
   withNavigation(BookNowWithContext),
   graphql`
-    fragment BookNow_hotel on Hotel {
-      originalId
+    fragment BookNow_hotel on HotelInterface {
+      id
     }
   `,
 );
diff --git a/app/hotels/src/singleHotel/bookNow/__generated__/BookNow_hotel.graphql.js b/app/hotels/src/singleHotel/bookNow/__generated__/BookNow_hotel.graphql.js
index 62c2e19c..6777b701 100644
--- a/app/hotels/src/singleHotel/bookNow/__generated__/BookNow_hotel.graphql.js
+++ b/app/hotels/src/singleHotel/bookNow/__generated__/BookNow_hotel.graphql.js
@@ -11,7 +11,7 @@ import type { ConcreteFragment } from 'relay-runtime';
 import type { FragmentReference } from "relay-runtime";
 declare export opaque type BookNow_hotel$ref: FragmentReference;
 export type BookNow_hotel = {|
-  +originalId: ?string,
+  +id: string,
   +$refType: BookNow_hotel$ref,
 |};
 */
@@ -20,19 +20,19 @@ export type BookNow_hotel = {|
 const node/*: ConcreteFragment*/ = {
   "kind": "Fragment",
   "name": "BookNow_hotel",
-  "type": "Hotel",
+  "type": "HotelInterface",
   "metadata": null,
   "argumentDefinitions": [],
   "selections": [
     {
       "kind": "ScalarField",
       "alias": null,
-      "name": "originalId",
+      "name": "id",
       "args": null,
       "storageKey": null
     }
   ]
 };
 // prettier-ignore
-(node/*: any*/).hash = 'f2d9e56b4e4a68248cd824ec92c025e7';
+(node/*: any*/).hash = 'c589ef05add75fba8e3a90a800fa7e03';
 module.exports = node;
diff --git a/schema.graphql b/schema.graphql
index 77de566f..51c7f5ff 100644
--- a/schema.graphql
+++ b/schema.graphql
@@ -2429,7 +2429,7 @@ type RootQuery {
   ): HotelCityConnection
 
   """Url where user will be redirected for payment"""
-  hotelPaymentUrls: HotelPaymentUrls
+  hotelPaymentUrls(hotelId: ID): HotelPaymentUrls
 
   """Single location by ID."""
   location(


Test patch:
diff --git a/app/hotels/src/singleHotel/__tests__/PaymentScreen.test.js b/app/hotels/src/singleHotel/__tests__/PaymentScreen.test.js
index fcbaaf8e..425da2a6 100644
--- a/app/hotels/src/singleHotel/__tests__/PaymentScreen.test.js
+++ b/app/hotels/src/singleHotel/__tests__/PaymentScreen.test.js
@@ -14,7 +14,7 @@ it('creates correct URL', () => {
   expect(
     createURI(
       {
-        hotelId: 1,
+        hotelId: '1',
         checkin: new Date(ONE_DAY),
         checkout: new Date(3 * ONE_DAY), // 2 days later
         rooms: [
@@ -38,7 +38,7 @@ it('creates correct URL', () => {
   expect(
     createURI(
       {
-        hotelId: 2,
+        hotelId: '2',
         checkin: new Date(2 * ONE_DAY),
         checkout: new Date(16 * ONE_DAY), // 14 days later
         rooms: [
diff --git a/app/hotels/src/singleHotel/__tests__/__snapshots__/PaymentScreen.test.js.snap b/app/hotels/src/singleHotel/__tests__/__snapshots__/PaymentScreen.test.js.snap
index bac8a8b0..a3fcd3fa 100644
--- a/app/hotels/src/singleHotel/__tests__/__snapshots__/PaymentScreen.test.js.snap
+++ b/app/hotels/src/singleHotel/__tests__/__snapshots__/PaymentScreen.test.js.snap
@@ -1,5 +1,5 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`creates correct URL 1`] = `"http://test.url.lol&hotel_id=1&checkin=1970-01-02&interval=2&nr_rooms_7709411_91461863_1_1_0=1&nr_rooms_7709404_91461863_0_1_0=2&label=kiwi-ios-react-rn-test&lang=en&selected_currency=EUR"`;
+exports[`creates correct URL 1`] = `"http://test.url.lol&checkin=1970-01-02&interval=2&nr_rooms_7709411_91461863_1_1_0=1&nr_rooms_7709404_91461863_0_1_0=2&label=kiwi-ios-react-rn-test&lang=en&selected_currency=EUR"`;
 
-exports[`creates correct URL 2`] = `"http://test.url.lol&hotel_id=2&checkin=1970-01-03&interval=14&nr_rooms_7709411_91461863_1_1_0=5&label=kiwi-ios-react-rn-test&lang=cs&selected_currency=JPY"`;
+exports[`creates correct URL 2`] = `"http://test.url.lol&checkin=1970-01-03&interval=14&nr_rooms_7709411_91461863_1_1_0=5&label=kiwi-ios-react-rn-test&lang=cs&selected_currency=JPY"`;