Class: BeyondApi::PaymentMethodDefinitions
- Includes:
- Utils
- Defined in:
- lib/beyond_api/resources/payment_method_definitions.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#all(params = {}) ⇒ OpenStruct
A
GET
request is used to list all payment method definitions on system level. -
#create(body) ⇒ OpenStruct
A
POST
request is used to create a payment method definition on system level. -
#delete(payment_method_definition_id) ⇒ Object
A
DELETE
request is used to delete a payment method definition on system level. -
#find(payment_method_definition_id) ⇒ OpenStruct
A
GET
request is used to deactivate a payment method. -
#update(payment_method_definition_id, body) ⇒ OpenStruct
A
PUT
request is used to update a payment method definition on system level.
Methods included from Utils
#file_content_type, #handle_all_request, #handle_error, #handle_response, #sanitize_key, #sanitize_response, #to_object_struct
Methods inherited from Base
Constructor Details
This class inherits a constructor from BeyondApi::Base
Instance Method Details
#all(params = {}) ⇒ OpenStruct
A GET
request is used to list all payment method definitions on system level.
$ curl 'https://api-shop.beyondshop.cloud/api/payment-method-definitions' -i -X GET \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>'
81 82 83 |
# File 'lib/beyond_api/resources/payment_method_definitions.rb', line 81 def all(params = {}) handle_all_request("/payment-method-definitions", :payment_method_definitions, params) end |
#create(body) ⇒ OpenStruct
A POST
request is used to create a payment method definition on system level.
$ curl 'https://system.beyondshop.cloud/api/payment-method-definitions' -i -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>' \
-d '{
"name": "credit-card",
"referralUriTemplate": "https://example.com/merchants",
"statusUriTemplate": "https://example.com/merchants/{shopId}/status",
"disconnectUriTemplate": "https://example.com/merchants/{shopId}/disconnect",
"createPaymentUriTemplate": "https://example.com/payments",
"capturePaymentUriTemplate": "https://example.com/payments/{paymentId}/capture",
"refundPaymentUriTemplate": "https://example.com/payments/{paymentId}/refund",
"sandbox": "true",
"workflow": "PAYMENT_ON_BUY",
"captureWorkflow": "CAPTURE_ON_ORDER",
"refund": "NO_REFUND",
"logos": [{
"setName" : "official",
"variant" : "STOREFRONT",
"uri" : "https://example.com/static/storefront.png"
}],
"officialName": {"de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.",
"en-US" : "Allow your customers to pay by credit card."
},
"officialDescription": {
"de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.",
"en-US" : "Allow your customers to pay by credit card."
},
"defaultName": {
"de-DE" : "Kreditkarte",
"en-US" : "Credit card"
},
"defaultDescription": {"de-DE" : "Bezahlen Sie mit Kreditkarte.","en-US" : "Pay by credit card."}}'
55 56 57 58 59 60 61 |
# File 'lib/beyond_api/resources/payment_method_definitions.rb', line 55 def create(body) response, status = BeyondApi::Request.post(@session, "/payment-method-definitions", body) handle_response(response, status) end |
#delete(payment_method_definition_id) ⇒ Object
A DELETE
request is used to delete a payment method definition on system level.
$ curl 'https://system.beyondshop.cloud/api/payment-method-definitions/credit-card' -i -X DELETE \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>'
174 175 176 177 178 179 180 |
# File 'lib/beyond_api/resources/payment_method_definitions.rb', line 174 def delete(payment_method_definition_id) response, status = BeyondApi::Request.delete(@session, "/payment-method-definitions/#{payment_method_definition_id}", body) handle_response(response, status, respond_with_true: true) end |
#find(payment_method_definition_id) ⇒ OpenStruct
A GET
request is used to deactivate a payment method.
$ curl 'https://api-shop.beyondshop.cloud/api/payment-method-definitions/credit-card' -i -X GET \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>'
101 102 103 104 105 106 |
# File 'lib/beyond_api/resources/payment_method_definitions.rb', line 101 def find(payment_method_definition_id) response, status = BeyondApi::Request.get(@session, "/payment-method-definitions/#{payment_method_definition_id}") handle_response(response, status) end |
#update(payment_method_definition_id, body) ⇒ OpenStruct
A PUT
request is used to update a payment method definition on system level.
$ curl 'https://system.beyondshop.cloud/api/payment-method-definitions/credit-card' -i -X PUT \
-H 'Content-Type: application/json' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>' \
-d '{
"name": "credit-card-updated",
"referralUriTemplate": "https://example.com/merchants",
"statusUriTemplate": "https://example.com/merchants/{shopId}/status",
"disconnectUriTemplate": "https://example.com/merchants/{shopId}/disconnect",
"createPaymentUriTemplate": "https://example.com/payments",
"capturePaymentUriTemplate": "https://example.com/payments/{paymentId}/capture",
"refundPaymentUriTemplate": "https://example.com/payments/{paymentId}/refund",
"workflow": "PAYMENT_ON_SELECTION",
"captureWorkflow": "CAPTURE_ON_DEMAND",
"refund": "NO_REFUND",
"logos": [{
"setName" : "official",
"variant" : "STOREFRONT",
"uri" : "https://example.com/static/storefront.png"
}],
"officialName": {"de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.",
"en-US" : "Allow your customers to pay by credit card."
},
"officialDescription": {
"de-DE" : "Ermögliche deinen Kunden, mit Kreditkarte zu bezahlen.",
"en-US" : "Allow your customers to pay by credit card."
},
"defaultName": {
"de-DE" : "Kreditkarte",
"en-US" : "Credit card"
},
"defaultDescription": {"de-DE" : "Bezahlen Sie mit Kreditkarte.","en-US" : "Pay by credit card."}}'
154 155 156 157 158 159 160 |
# File 'lib/beyond_api/resources/payment_method_definitions.rb', line 154 def update(payment_method_definition_id, body) response, status = BeyondApi::Request.put(@session, "/payment-method-definitions/#{payment_method_definition_id}", body) handle_response(response, status) end |