Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Singapore Expansion

Description / Background

Singapore expansion

Glossary

Private (https://app.clickup.com/9003122396/docs/8ca1fpw-35796/8ca1fpw-41516)

Objectives

  • Singaporean citizen can book on hungryhub web and app
  • User can sign up using singaporean phone number
  • User can see singapore on dropdown city list
  • User can see singaporean restaurant when they pick singapore as the city
  • User can see singaporean restaurant when their phone number was singaporean
  • User can see the price on singapore dollar when their phone number was singaporean
  • User can book prepaid booking using "PayNow"
  • User can book prepaid booking
  • User can pay booking using omise payment
  • User can see the singaporean location tag
  • User can receive point by booking on singapore restaurant
  • User can redeemed the singapore point on singapore restaurant
  • User can't redeemed the singapore point on thailand restaurant
  • User can see the country flag on the point profile page

  • User can see the country flag on the promo code

  • User can see the country flag on the gift card

  • User can get point from referral code with this condition:
    1. The referral code currency will follow the sender phone number country currency
    2. If the sender phone number is not SG or TH, it will use THB currency as default
  • Admin can create singaporean restaurant
  • Admin can create package for singaporean restaurant
  • Admin can set the price to Singapore Dollar if the restaurant is Singaporean Restaurant
  • Admin can add singaporean location tags
  • Admin can create seven room and table check restaurant for the Singaporean restaurant
  • The package price currency will followed the restaurant based setting
  • Point setting will followed the restaurant country
  • All singapore package can't use we travel together

Scope

All

Booking Point Logic

CountryThailandSingapore
Total Spend100 Baht1 dollar
Get Point11
Point Value1 baht1 cent

The tier calculation will be done by counting for all booking from Singapore and Thailand restaurant, but the point will be separated, when booking from Singapore restaurant will receive Singapore point, and Thailand restaurant booking will receive Thailand point.

List of Hidden / Disabled Feature

  •   *   Create Saved CC
    

Location

All Platform

Sequence Diagram / Flow

ERD

-

Android Implementation

  • Modernizes and improves the user experience by making city and service type selection dynamic, enhances UI/UX for restaurant sections, standardizes currency/price display, and introduces multiple new visual elements. 
  • Refactors code for maintainability and scalability as more cities and service types are added to the platform.
  • Enables the CheckoutPayload model to store and handle a country code, likely to support features or requirements dependent on the user's country during checkout. The new field is integrated with JSON serialization, making it compatible with backend APIs expecting or sending a country code as part of the checkout payload.
  • Improving the PromptPay payment UI and logic, especially to properly support Singapore Dollar (SGD) transactions, ensures currency displays are correct, and fixes how activities are started from fragments for better stability.
  • Two new fields are added to the Attributes model:
    • chargePriceV2 (charge_price_v2)
    • totalPriceV2 (total_price_v2)
  • Getter and setter methods are provided for these new fields.
  • These fields use Float instead of int to support decimal values for prices.
  • When sending analytics/events, the new decimal fields (totalPriceV2) are included as amount_decimal and last_booking_value_decimal for more precise price tracking.
  • When displaying the amount to the user, the code now prefers using the new decimal field chargePriceV2 (and totalPriceV2) for calculations and display, improving currency accuracy.
  • Some unused imports are removed from PromptPayFragment.java, reducing clutter and potential confusion.

[

github.com

https://github.com/hungryhub-team/hh-android/pull/1576

](https://github.com/hungryhub-team/hh-android/pull/1576)

[

github.com

https://github.com/hungryhub-team/hh-android/pull/1884

](https://github.com/hungryhub-team/hh-android/pull/1884)

[

github.com

https://github.com/hungryhub-team/hh-android/pull/1889

](https://github.com/hungryhub-team/hh-android/pull/1889)

[

github.com

https://github.com/hungryhub-team/hh-android/pull/1956

](https://github.com/hungryhub-team/hh-android/pull/1956)

iOS Implementation

  • In String+SubScript.swift, the Singapore Dollar currency format is changed from """ for better clarity:
    • Before: $<amount>
    • After: S$<amount>
  • In Handler.swift, universal link handling is enhanced:
    • A new method, isValidScheme, checks if an incoming URL should be handled in-app.
    • If the scheme isn’t recognized, the link is opened in the browser and a status flag is set.
    • This makes link routing more robust and future-proof.
  • The app now sets the default phone code based on city:
    • If the user's city is Singapore, +65 is used; otherwise, +66 (Thailand).
  • The flag image is now set based on the phone calling code instead of the country code.
  • When a user selects a country, the correct calling code is applied and sent to the view model.
  • The RegisterViewModel’s outputs are updated:
    • Now emits the current phone code (onPhoneCode).
    • The terms of service screen receives the latest phone code, not just the UI value.
    • A new output, onHidePromotion, is added to hide promotions for Singapore users or non-Thai phone codes.
  • The TermOfService view and its ViewModel are updated to support:
    • Passing the phone code to the web view as part of the initial data setup.
    • Improved event handling for the web view bridge (e.g., onMountedonAcceptContinueonCloseView).
  • The protocol and its implementations now include a convenience method to call a handler without expecting a response callback.
  • New and updated unit tests:
    • Cover the new Registration and TermOfService behaviors.
    • Ensure correct handling of phone codes and web view bridge methods.
    • Verify that initial data for the terms screen includes the correct calling code.
  • The app’s version is updated from 7.6.4 to 7.6.5 in the Xcode project.

[

github.com

https://github.com/hungryhub-team/hh-ios-fix/pull/2057

](https://github.com/hungryhub-team/hh-ios-fix/pull/2057)

[

github.com

https://github.com/hungryhub-team/hh-ios-fix/pull/2164

](https://github.com/hungryhub-team/hh-ios-fix/pull/2164)

Backend Implementation

  • Changed the ordering of cuisines to use interpolation for locale (order("title_#{I18n.locale}")).
  • Updated the find_country_id_currency method to use params instead of restaurant_params.
  • Fixed a typo in a button label from "Adress" to "Address".
  • Added a list of countries and a selected country dropdown in the Signup.vue component.
  • Removed unnecessary index parameter in forEach loops.
  • Added a watcher for selectedCountry to update the phone input country code.
  • Added methods to find Singapore in city.rb and country.rb.
  • Moved the translates :name method in restaurant.rb for better organization.
  • Updated currency handling logic in restaurant.rb and dynamic_pricings_for_package.rb.
  • Added logic to set the city based on the country code in the restaurant creation process.
  • Added a country selection dropdown in the signup form.
  • Added translations for the new country field in both English and Thai.
  • Updated the set_time_zone method to use the uppercased currency code.
  • Removed old OMISE keys.
  • Added new OMISE keys for Thailand and Singapore.
  • Updated the version of the omise gem from 0.9.1 to 0.11.0.
  • Adjusted the position of the composite_primary_keys gem.
  • Added logic to handle payment_provider_override and set payment_provider to nil if not overridden.
  • Added ip_address to the reservation parameters.
  • Updated the selected_payment_provider structure to include options for Thailand and Singapore for both promptpay and cc .
  • Added a method to configure OMISE keys based on the country code.
  • Refactored image validation logic, ensuring proper validation and clearing of invalid images.
  • Included OmiseHelper and configured OMISE keys based on the restaurant's country code.
  • Added a new association for users in Singapore and adjusted the charges association.
  • Added support for the paynow source type and included it in validations.
  • Added a new case for 'charge.complete' alongside 'charge.create'.
  • Changed the default country code to use a constant (ApiV5::Constants::COUNTRY_CODE_TH) instead of a hardcoded string.
  • Modified the logic for default country code assignment based on feature flags and country codes.
  • Updated the charge handling logic to use constants for Omise charge statuses and validate them.
  • Added constants for country codes (COUNTRY_CODE_THCOUNTRY_CODE_SG).
  • Added constants for Omise charge statuses (OMISE_CHARGE_SUCCESSFULOMISE_CHARGE_PENDING) and a list of valid statuses.
  • New Attribute: calling_code
    • It defaults to '66'.
    • If the user_id is present, it returns the user's calling code or the default calling code ('66') if the user's calling code is not present.
    • If the guest phone number is blank, it returns the default calling code ('66').
    • Otherwise, it parses the guest phone number to determine and return the country code.
  • New Attribute: country_calling_code
    • It extracts the full phone number from object.user.phone_v2_full or from object.phone (removing the '+' prefix).
    • It parses the phone number to determine and return the country calling code.
    • In case of a Phonelib::ParseError, it returns an empty string.
  • A new file tiktokSingapore.js is created under the public directory. This file contains a script that initializes TikTok analytics for the production environment.
  • The script checks if the application mode is "production".
  • If in production mode, it initializes the TikTok analytics object ttq with various methods such as pagetrackidentify, etc.
  • It defines the load function to load the TikTok analytics script from https://analytics.tiktok.com/i18n/pixel/events.js.
  • The script then loads the TikTok analytics with a specific SDK ID CURVEQJC77U4QKJNHA20 and tracks the page view.
  • The new script tiktokSingapore.js is included in the ThirdPartyScript.astro file. It is added after the existing tiktok.js script and before the metaPixel.js script.
  • Added the method filter.by_currency_code(params[:currency]) to filter vouchers based on the provided currency code.
  • Added the method by_currency_code(currency_code) to set the currency code in the filter configuration if it's present.
  • Updated the build_collections method to include _by_currency_code.
  • Added the private method _by_currency_code to filter active collections based on the currency code.
  • Added the currency code handling when creating a referral voucher by passing currency_code to the VoucherForm::Referral initializer.
  • Added the currency_code attribute and included it in the initializer.
  • Set a default currency code to 'THB' if not provided.
  • Updated the build_voucher method to use currency_code for amount_currency and currency_code.
  • Added the valid_currency_for_country! method to validate that the voucher's currency code matches the restaurant's currency code.
  • Added a filter for country_id to allow filtering vouchers by country in the admin panel.
  • Added the fetch_currency_code method to return the voucher's currency code or default to 'THB' if not set.
  • Updated the override_vouchers! method to include the currency_code when creating referral vouchers.
  • Added a line for the validation error message when the voucher's currency code is not valid for the country.
  • Added a migration to update the default country ID for vouchers where it is not set.
  • Added a migration to add a default country ID to vouchers.
  • Added a migration to add a default currency code to vouchers.

[

github.com

https://github.com/hungryhub-team/hh-server/pull/5981#pullrequestreview-2377367138

](https://github.com/hungryhub-team/hh-server/pull/5981#pullrequestreview-2377367138)

[

github.com

https://github.com/hungryhub-team/hh-server/pull/5982

](https://github.com/hungryhub-team/hh-server/pull/5982)

[

github.com

https://github.com/hungryhub-team/hh-server/pull/6314/files

](https://github.com/hungryhub-team/hh-server/pull/6314/files)

[

github.com

https://github.com/hungryhub-team/hh-server/pull/6152/files

](https://github.com/hungryhub-team/hh-server/pull/6152/files)

[

github.com

https://github.com/hungryhub-team/hh-server/pull/6463

](https://github.com/hungryhub-team/hh-server/pull/6463)

[

github.com

https://github.com/hungryhub-team/hh-server/pull/6457

](https://github.com/hungryhub-team/hh-server/pull/6457)

Frontend Implementation

  • Added omise-js-typed to package.json.
  • Modified various methods to handle credit card tokens using Omise instead of GbPrimePay.
  • Updated logic in AddNewCreditCardMobile.vue and CheckOutPage.vue to support Omise tokens.
  • Refactored token request methods in CreditCard.ts and BookingPayment.ts to add support for Omise.
  • Added support for Omise tokens in booking creation flow (e.g., createBooking.tsgetBookingProcessData.ts).
  • Updated booking.ts store to include creditCardProvider and omiseToken.
  • Consolidated and refactored logic for handling different credit card providers.
  • Adjusted country code handling and added checks for Singapore restaurants.
  • Added setup data listener on the search suggest page.
  • Implemented Singapore payment using Omise.
  • Disabled increase button when enable big group is false.
  • Fixed menu quantity sometimes being null.
  • Removed all arbitrary classes.
  • Removed remaining arbitrary classes on some pages.
  • Added a hotfix for preorder in availability.
  • Removed unused parameters validGiftCardCode and validGiftCardCode2.
  • Updated a locator for better accuracy.
  • Added a new dependency omise-js-typed.
  • Added a new file to create Omise tokens for credit card processing.
  • Updated class properties for styling improvements.
  • Added keys to v-for loops for better performance.
  • Updated class properties for styling adjustments.
  • Made styling adjustments for better layout and readability.
  • Updated class properties for styling improvements.
  • Adjusted some logic in watchers.
  • A new parameter currency is added to the getVouchers function.
  • The function signature is updated to include the currency parameter.
  • The payload sent in the request now includes the currency parameter.
  • The error handling block catches any error and returns a response with isSuccess: false.
  • The condition to hide offers if the restaurant is in Singapore is removed.
  • The restaurantStore is imported and used.
  • A check is added to prevent point redemption if the restaurant is in Singapore.
  • The useBookingChargeStore is imported and used to get the chargeObject.
  • The currency is determined based on the chargeObject.
  • The currency parameter is included in the request payload when fetching vouchers.

[

github.com

https://github.com/hungryhub-team/hh-pegasus/pull/1119

](https://github.com/hungryhub-team/hh-pegasus/pull/1119)

[

github.com

https://github.com/hungryhub-team/hh-pegasus/pull/1496

](https://github.com/hungryhub-team/hh-pegasus/pull/1496)

[

github.com

https://github.com/hungryhub-team/hh-pegasus/pull/1435

](https://github.com/hungryhub-team/hh-pegasus/pull/1435)

[

github.com

https://github.com/hungryhub-team/hh-pegasus/pull/1315

](https://github.com/hungryhub-team/hh-pegasus/pull/1315)

[

github.com

https://github.com/hungryhub-team/hh-pegasus/pull/1596

](https://github.com/hungryhub-team/hh-pegasus/pull/1596)

PRD & Task

Private (https://app.clickup.com/9003122396/docs/8ca1fpw-7922/8ca1fpw-43316)

Private (https://app.clickup.com/t/86cx2hy2u) Private (https://app.clickup.com/t/86cwy4rw7) Private (https://app.clickup.com/t/86cwhf2t8) Private (https://app.clickup.com/t/86cwjaa6k) Private (https://app.clickup.com/t/86cwhf5mn) Private (https://app.clickup.com/t/86cwhf5z4)

Design

API Blueprint

MethodPathURLDescriptionPayload

New Query

DB Schema / Database Migration


Improvement:

Feature NameDateWhat ChangedDescription
Payment Option - Option to Pay Now
Offers (Point Redemption, Gift Card, Promo Code)
Create Saved CC
02/12/2024Hidden / Disabled Feature
update Singapore Expansion (1 month after launch)06/03/2025add promo code, gift card and point update