From 48642bb21ea2f8ae71fff04dedcbdc36e06de23f Mon Sep 17 00:00:00 2001 From: adrian-y1 <80251505+adrian-y1@users.noreply.github.com> Date: Fri, 28 Aug 2026 12:56:07 +1000 Subject: [PATCH 1/4] fix webhook event key --- lib/airwallex/webhook.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/airwallex/webhook.rb b/lib/airwallex/webhook.rb index e27603f..e99bab3 100644 --- a/lib/airwallex/webhook.rb +++ b/lib/airwallex/webhook.rb @@ -62,7 +62,8 @@ class Event def initialize(attributes = {}) @id = attributes["id"] - @type = attributes["type"] + # Airwallex webhook payloads carry the event type under "name", not "type". + @type = attributes["name"] @data = attributes["data"] @created_at = attributes["created_at"] end From 875942a23bee1cbb63d6181a31064201c8b527c9 Mon Sep 17 00:00:00 2001 From: adrian-y1 <80251505+adrian-y1@users.noreply.github.com> Date: Fri, 28 Aug 2026 12:56:46 +1000 Subject: [PATCH 2/4] update version to 0.6.0 --- lib/airwallex/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/airwallex/version.rb b/lib/airwallex/version.rb index a15568d..954e65b 100644 --- a/lib/airwallex/version.rb +++ b/lib/airwallex/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Airwallex - VERSION = "0.5.0" + VERSION = "0.6.0" end From 7b2eabd089efac2f4fcb8b67dffdc96b2569b078 Mon Sep 17 00:00:00 2001 From: adrian-y1 <80251505+adrian-y1@users.noreply.github.com> Date: Fri, 28 Aug 2026 12:57:03 +1000 Subject: [PATCH 3/4] bundle update --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5997ad8..3e42fba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - airwallex (0.5.0) + airwallex (0.6.0) faraday (~> 2.0) faraday-multipart (~> 1.0) faraday-retry (~> 2.0) From b0cee3356acd261b03964432045c1a9ec5d62fcc Mon Sep 17 00:00:00 2001 From: adrian-y1 <80251505+adrian-y1@users.noreply.github.com> Date: Fri, 28 Aug 2026 13:00:24 +1000 Subject: [PATCH 4/4] update type to name --- README.md | 4 ++-- lib/airwallex/webhook.rb | 5 ++--- spec/airwallex/webhook_spec.rb | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 15ddaad..d46287f 100644 --- a/README.md +++ b/README.md @@ -319,8 +319,8 @@ begin timestamp, tolerance: 300 # 5 minutes ) - - case event.type + + case event.name when 'payment_intent.succeeded' handle_successful_payment(event.data) when 'payout.transfer.failed' diff --git a/lib/airwallex/webhook.rb b/lib/airwallex/webhook.rb index e99bab3..424f8a4 100644 --- a/lib/airwallex/webhook.rb +++ b/lib/airwallex/webhook.rb @@ -58,12 +58,11 @@ def secure_compare(a, b) private_class_method :compute_signature, :verify_timestamp, :secure_compare class Event - attr_reader :id, :type, :data, :created_at + attr_reader :id, :name, :data, :created_at def initialize(attributes = {}) @id = attributes["id"] - # Airwallex webhook payloads carry the event type under "name", not "type". - @type = attributes["name"] + @name = attributes["name"] @data = attributes["data"] @created_at = attributes["created_at"] end diff --git a/spec/airwallex/webhook_spec.rb b/spec/airwallex/webhook_spec.rb index 40a5b87..6a86050 100644 --- a/spec/airwallex/webhook_spec.rb +++ b/spec/airwallex/webhook_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Airwallex::Webhook do let(:secret) { "test_secret" } - let(:payload) { '{"id":"evt_123","type":"payment_intent.succeeded","data":{}}' } + let(:payload) { '{"id":"evt_123","name":"payment_intent.succeeded","data":{}}' } let(:timestamp) { Time.now.to_i.to_s } let(:signature) { described_class.send(:compute_signature, timestamp, payload, secret) } @@ -82,7 +82,7 @@ let(:event_data) do { "id" => "evt_123", - "type" => "payment_intent.succeeded", + "name" => "payment_intent.succeeded", "data" => { "amount" => 100 }, "created_at" => "2025-11-25T10:00:00Z" } @@ -94,8 +94,8 @@ expect(event.id).to eq("evt_123") end - it "has type" do - expect(event.type).to eq("payment_intent.succeeded") + it "has name" do + expect(event.name).to eq("payment_intent.succeeded") end it "has data" do