@spree/docs 0.1.291 → 0.1.292
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -33,6 +33,8 @@ module SpreeAcmeCarrier
|
|
|
33
33
|
preference :test_mode, :boolean, default: true
|
|
34
34
|
|
|
35
35
|
def self.integration_group = 'shipping'
|
|
36
|
+
def self.logo_url = 'https://acme-carrier.example.com/logo.svg'
|
|
37
|
+
def self.docs_url = 'https://acme-carrier.example.com/docs/spree'
|
|
36
38
|
|
|
37
39
|
# Called when an admin activates the integration. Returning false blocks
|
|
38
40
|
# activation and shows your message in the dashboard.
|
|
@@ -51,6 +53,8 @@ module SpreeAcmeCarrier
|
|
|
51
53
|
end
|
|
52
54
|
```
|
|
53
55
|
|
|
56
|
+
`logo_url` and `docs_url` are optional. They put your logo and a "Setup guide" link on the integration's card under **Settings > Integrations**. Payment methods declare them the same way.
|
|
57
|
+
|
|
54
58
|
Declare secrets as `:password` preferences. Spree masks them on read and guards the round-trip on write, so an API key never leaves the server in plain text.
|
|
55
59
|
|
|
56
60
|
## 2. Implement the provider
|
|
@@ -43,6 +43,24 @@ end
|
|
|
43
43
|
|
|
44
44
|
After restarting your server, you can select "MyGateway" when creating a new payment method in the admin panel under **Settings > Payments**.
|
|
45
45
|
|
|
46
|
+
### Show a logo and setup guide (optional)
|
|
47
|
+
|
|
48
|
+
Payment providers also appear in the admin dashboard under **Settings > Integrations**. Declare a logo and a link to your setup guide so merchants recognise the provider and know how to connect it:
|
|
49
|
+
|
|
50
|
+
```ruby app/models/my_gateway.rb
|
|
51
|
+
class MyGateway < Spree::PaymentMethod
|
|
52
|
+
def self.logo_url
|
|
53
|
+
'https://my-gateway.example.com/logo.svg'
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.docs_url
|
|
57
|
+
'https://my-gateway.example.com/docs/spree'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`logo_url` accepts anything an image tag accepts, including a `data:` URI if you don't want to host the file. Both are optional: without a logo the card shows the provider's first letter, and without a guide the link is hidden. Integrations declare the same two methods — see [custom delivery rate providers](custom-delivery-rate-provider.md).
|
|
63
|
+
|
|
46
64
|
## Step 3: Add Payment Session Support
|
|
47
65
|
|
|
48
66
|
Payment Sessions are the modern, PCI-compliant way to handle payments. Your gateway creates a session with the provider, the frontend collects payment details using the provider's SDK, and Spree records the result.
|