{"id":20672091,"url":"https://github.com/workarea-commerce/workarea-gift-cards","last_synced_at":"2026-04-24T09:34:23.347Z","repository":{"id":55992737,"uuid":"203650666","full_name":"workarea-commerce/workarea-gift-cards","owner":"workarea-commerce","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-02T14:33:12.000Z","size":165,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-02T17:52:18.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workarea-commerce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-08-21T19:24:33.000Z","updated_at":"2024-12-17T02:40:19.000Z","dependencies_parsed_at":"2022-08-15T11:00:39.721Z","dependency_job_id":null,"html_url":"https://github.com/workarea-commerce/workarea-gift-cards","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/workarea-commerce/workarea-gift-cards","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-gift-cards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-gift-cards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-gift-cards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-gift-cards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workarea-commerce","download_url":"https://codeload.github.com/workarea-commerce/workarea-gift-cards/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-gift-cards/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32216952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T08:24:32.376Z","status":"ssl_error","status_checked_at":"2026-04-24T08:24:26.731Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T20:31:53.256Z","updated_at":"2026-04-24T09:34:18.339Z","avatar_url":"https://github.com/workarea-commerce.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Workarea Gift Cards\n================================================================================\n\nA Workarea Commerce plugin that enables customers to purchase physical and digital gift cards and redeem them for other merchandise within the catalog.\n\nOverview\n--------------------------------------------------------------------------------\n\n* Create gift card products, both digital and physical\n* Allow gift card customization with recipient name, email, and personal message\n* Automatically deliver digital gift card information to recipient upon purchase\n* Use any number of gift cards as payment in checkout (with configurable limit)\n* Check the balance of a digital gift card\n* Manage digital gift cards from the admin\n* View gift card redemptions from the admin\n* Admin API management of gift cards\n* Storefront API support for using gift cards in checkout\n* Gateway support for easily using a third-party gift card service (see below)\n\nGetting Started\n--------------------------------------------------------------------------------\n\nAdd the gem to your application's Gemfile:\n\n```ruby\n# ...\ngem 'workarea-gift_cards'\n# ...\n```\n\nUpdate your application's bundle.\n\n```bash\ncd path/to/application\nbundle\n```\n\nUsing a custom gift card gateway\n--------------------------------------------------------------------------------\n\nThe `workarea-gift_cards` plugin comes fully functional with management of gift cards, tracking of redemptions and balances within the Workarea admin. However, using a third-party gift card service is not uncommon. Taking that into consideration, the plugin allows for the use of a custom gateway for looking up\nbalances, validating gift card info, and processing gift card payments. This allows a retailer to utilize the plugin for the gift card product behaviors, but continue using a third-party service for generating gift card codes and tracking the use of purchased gift cards.\n\n## Setup a custom gateway\n\nThe plugin adds a configuration value of `Workarea.config.gateways.gift_card`. By default, this is set to `Workarea::GiftCards::Gateway`, which utilizes the existing `Workarea::Payment::GiftCard` collection. This configuration value can be changed to a custom class of your choice that responds to the same methods.\n\n```ruby\nclass ThirdPartyGiftCardGateway\n  # setup any relevant configuration required for connecting to a\n  # third-party service\n  #\n  def initialize; end\n\n  # Optional. Define this method to tell the system you are using the\n  # Workarea::Payment::GiftCard collection. This will turn on a number of\n  # behaviors only relevant when using the collection. If the gateway does not\n  # respond to this method, it will assume false.\n  #\n  def uses_system_cards?\n    true\n  end\n\n  # These are the transactional methods expected from the gateway. They each\n  # take two arguments:\n  #   amount - is the value (in cents) that transaction is looking to apply.\n  #   tender - will be a Workarea::Payment::Tender::GiftCard which you can use\n  #            to find the relevant card number or other info stored on the\n  #            tender associated to this transaction.\n  #\n  # The system expects these method to return an object that responds to\n  # two methods:\n  #   success? - a boolean that determines if the transaction was successful\n  #   message - information around the transaction result\n  #\n  def authorize(amount, tender); end\n  def cancel(amount, tender); end\n  def capture(amount, tender); end\n  def purchase(amount, tender); end\n  def refund(amount, tender); end\n\n  # This passes in one or more tokens/numbers as strings and returns a Money\n  # object that represents the total balance of all valid card numbers.\n  #\n  def balance(token); end\n\n  # This method is used when a customer looks up their balance from the\n  # storefront. This will often require them to provide some unique info\n  # to protect against malicious attempts at discovering gift card numbers.\n  # The request parameters are passed directly into the method to allow\n  # flexibility in the information you request from the user to show them\n  # the balance. By default, the system expects this method to return an\n  # object that responds to #balance, #token, and #to. This is entirely\n  # dependent on the resulting view rendered, which can be customized.\n  #\n  def lookup(params); end\nend\n```\n\nAfter building a custom class, set the config value to the custom class.\n\n```ruby\nWorkarea.configure do |config|\n  config.gateways.gift_card = 'ThirdPartyGiftCardGateway'\nend\n```\n\nNote that it is set to a string of the class constant, and not an instance of the class. The system constantizes and initializes a new instance whenever it uses the gateway to ensure autoloading works correctly and so a gateway that cares about the current state of the application is applied correctly. This is most relevant in multi-site environments where each site might want to use their own gift card gateway.\n\n### Testing Your Custom Gateway\n\nWorkarea comes with unit tests for the main Gateway class, and you can\ndecorate this test to provide your own setup code. A minimal\nimplementation would look as follows:\n\n```ruby\nmodule Workarea\n  module GiftCards\n    decorate GatewayTest do\n      # Provide your own Gateway instance here to use it in each test.\n      def gateway\n        CustomGiftCardGateway.new\n      end\n\n      # Provide a custom object representing a Gift Card on your\n      # 3rd-party service.\n      def gift_card\n        CustomGiftCard.new(balance: 10.to_m)\n      end\n    end\n  end\nend\n```\n\nWorkarea Commerce Documentation\n--------------------------------------------------------------------------------\n\nSee [https://developer.workarea.com](https://developer.workarea.com) for Workarea Commerce documentation\n\nLicense\n--------------------------------------------------------------------------------\n\nWorkarea Gift Cards is released under the [Business Software License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkarea-commerce%2Fworkarea-gift-cards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkarea-commerce%2Fworkarea-gift-cards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkarea-commerce%2Fworkarea-gift-cards/lists"}