Module: Frontgo::Terminal

Included in:
Client
Defined in:
lib/frontgo/terminal.rb

Overview

Instance Method Summary collapse

Instance Method Details

#cancel_refund_request(order_uuid, params) ⇒ Object

Examples:

Cancel refund request

client.cancel_refund_request("ODR123456789", { type: "refund" })


79
80
81
# File 'lib/frontgo/terminal.rb', line 79

def cancel_refund_request(order_uuid, params)
  post "connect/terminal/orders/cancel/#{order_uuid}", params
end

#cancel_terminal_order(order_uuid, params) ⇒ Object

Examples:

Cancel terminal order payment

client.cancel_terminal_order("ODR123456789", { type: "payment" })


37
38
39
# File 'lib/frontgo/terminal.rb', line 37

def cancel_terminal_order(order_uuid, params)
  post "connect/terminal/orders/cancel/#{order_uuid}", params
end

#create_terminal_order(params) ⇒ Object

Examples:

Create terminal order with callback

client.create_terminal_order({
  products: { "0": { name: "Hair Wash", productId: "VFDDF", quantity: 1, rate: 42, tax: 0, amount: 42 } },
  orderSummary: { subTotal: 42.00, totalTax: 0.00, totalDiscount: 0.00, grandTotal: 42.00 },
  orderDate: "07 Apr, 2024",
  terminalUuid: "TRML1216693970",
  receiptPrint: false,
  sendOrderBy: { sms: false, email: true },
  customerDetails: {
    type: "private",
    name: "Kari Nordmann",
    email: "[email protected]",
    countryCode: "+47",
    msisdn: "46567468",
    preferredLanguage: "en",
    address: { street: "Luramyrveien 65", zip: "4313", city: "Sandnes", country: "NO" }
  },
  callbackUrl: "https://example-callback.com"
})


31
32
33
# File 'lib/frontgo/terminal.rb', line 31

def create_terminal_order(params)
  post "connect/terminal/orders/create", params
end

#get_payment_status(order_uuid) ⇒ Object

Examples:

Check payment status

client.get_payment_status("ODR123456789")


49
50
51
# File 'lib/frontgo/terminal.rb', line 49

def get_payment_status(order_uuid)
  get "connect/terminal/orders/payment-status/#{order_uuid}"
end

#get_refund_status(order_uuid) ⇒ Object

Examples:

Check refund status

client.get_refund_status("ODR123456789")


73
74
75
# File 'lib/frontgo/terminal.rb', line 73

def get_refund_status(order_uuid)
  get "connect/terminal/orders/refund-status/#{order_uuid}"
end

#get_terminal_lists(organization_uuid) ⇒ Object

Examples:

Get terminal lists for organization

client.get_terminal_lists("ORG2074299506")


8
9
10
# File 'lib/frontgo/terminal.rb', line 8

def get_terminal_lists(organization_uuid)
  get "connect/terminal/lists/#{organization_uuid}"
end

#refund_terminal_order(order_uuid, params) ⇒ Object

Examples:

Refund terminal order

client.refund_terminal_order("ODR123456789", {
  type: "regular",
  grandTotal: 42,
  products: [{ id: 12, amount: 42 }],
  isReversal: false
})

Reverse terminal payment

client.refund_terminal_order("ODR123456789", {
  type: "regular",
  grandTotal: 42,
  products: [{ id: 12, amount: 42 }],
  isReversal: true
})


67
68
69
# File 'lib/frontgo/terminal.rb', line 67

def refund_terminal_order(order_uuid, params)
  post "connect/terminal/orders/refund/#{order_uuid}", params
end

#resend_terminal_order(order_uuid) ⇒ Object

Examples:

Resend terminal order to terminal

client.resend_terminal_order("ODR123456789")


43
44
45
# File 'lib/frontgo/terminal.rb', line 43

def resend_terminal_order(order_uuid)
  post "connect/terminal/orders/resend/#{order_uuid}", {}
end