-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewURL.rb
More file actions
executable file
·63 lines (58 loc) · 1.75 KB
/
newURL.rb
File metadata and controls
executable file
·63 lines (58 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Docs: https://docs.scanpay.dk
# help@scanpay.dk
# irc.libera.chat:6697 #scanpay
require_relative '../lib/scanpay'
require 'base64'
$apikey = '1153:YHZIUGQw6NkCIYa3mG6CWcgShnl13xuI7ODFUYuMy0j790Q6ThwBEjxfWFXwJZ0W';
scanpay = Scanpay::Client.new($apikey)
options = {
'hostname' => 'api.test.scanpay.dk',
'headers' => {
'Authorization' => 'Basic ' + Base64.strict_encode64($apikey),
'X-Cardholder-IP' => '192.168.1.1',
},
'debug' => true,
}
order = {
'orderid' => 'a766409',
'language' => 'da',
'successurl' => 'https://insertyoursuccesspage.dk',
'items' => [
{
'name' => 'Pink Floyd: The Dark Side Of The Moon',
'quantity' => 2,
'total' => '199.99 DKK',
'sku' => 'fadf23',
}, {
'name' => '巨人宏偉的帽子',
'quantity' => 1,
'total' => '420 DKK',
'sku' => '124',
},
],
'billing' => {
'name' => 'John Doe',
'company' => 'The Shop A/S',
'email' => 'john@doe.com',
'phone' => '+4512345678',
'address' => ['Langgade 23, 2. th'],
'city' => 'Havneby',
'zip' => '1234',
'state' => '',
'country' => 'DK',
'vatin' => '35413308',
'gln' => '7495563456235',
},
'shipping' => {
'name' => 'Jan Dåh',
'company' => 'The Choppa A/S',
'email' => 'jan@doh.com',
'phone' => '+4587654321',
'address' => ['Langgade 23, 1. th', 'C/O The Choppa'],
'city' => 'Haveby',
'zip' => '1235',
'state' => '',
'country' => 'DK',
},
}
puts "Generated payment url: #{scanpay.newURL(order, options)}"