~singpolyma/jmp-pay

jmp-pay/jmp-pay.scm -rw-r--r-- 28.4 KiB
f84f822eStephen Paul Weber catapult_cred is by customer_ID@jmp.chat now 28 days ago
                                                                                
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
(define-module (jmp-pay)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system ruby)
  #:use-module (guix build-system copy)
  #:use-module (gnu packages ruby)
  #:use-module (gnu packages databases)
  #:use-module (ice-9 rdelim)
  #:use-module (ice-9 popen)
)

(define-public ruby-sucker-punch
  (package
    (name "ruby-sucker-punch")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sucker_punch" version))
        (sha256
          (base32
            "008vv7gpv2nm5n1njzvabd3aagbywc240y23vifvq6plir53ybay"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "sucker_punch.gemspec"
               (("1.0.0") "1.0"))
             #t)))))
    (propagated-inputs
      `(("ruby-concurrent" ,ruby-concurrent)))
    (native-inputs
     `(("ruby-pry" ,ruby-pry)))
    (synopsis
      "Asynchronous processing library for Ruby")
    (description
      "Asynchronous processing library for Ruby")
    (home-page
      "https://github.com/brandonhilkert/sucker_punch")
    (license license:expat)))

(define-public ruby-niceogiri
  (package
    (name "ruby-niceogiri")
    (version "1.1.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "niceogiri" version))
        (sha256
          (base32
            "1ha93211bc9cvh23s9w89zz7rq8irpf64ccd9arvg8v1sxg2798a"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "niceogiri.gemspec"
               (("2.7") "3.8")
               ((".*guard-rspec.*") "\n"))
             #t)))))
    (propagated-inputs
      `(("ruby-nokogiri" ,ruby-nokogiri)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-yard" ,ruby-yard)))
    (synopsis "Make dealing with XML less painful")
    (description
      "Make dealing with XML less painful")
    (home-page
      "https://github.com/benlangfeld/Niceogiri")
    (license license:expat)))

(define-public ruby-countdownlatch
  (package
    (name "ruby-countdownlatch")
    (version "1.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "countdownlatch" version))
        (sha256
          (base32
            "1v6pbay6z07fp7yvnba1hmyacbicvmjndd8rn2h1b5rmpcb5s0j3"))))
    (build-system ruby-build-system)
    (synopsis
      "A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes")
    (description
      "This package provides a synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes")
    (home-page
      "https://github.com/benlangfeld/countdownlatch")
    (license license:expat)))

(define-public ruby-blather
  (package
    (name "ruby-blather")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "blather" version))
        (sha256
          (base32
            "05ry2x835fj4pzk61282pcz86n018cr39zbgwbi213md74i90s7c"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "blather.gemspec"
               ((".*guard-rspec.*") "\n")
                ((".*bluecloth.*") "\n"))
             #t)))))
    (propagated-inputs
      `(("ruby-activesupport" ,ruby-activesupport)
        ("ruby-eventmachine" ,ruby-eventmachine)
        ("ruby-niceogiri" ,ruby-niceogiri)
        ("ruby-nokogiri" ,ruby-nokogiri)
        ("ruby-sucker-punch" ,ruby-sucker-punch)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-yard" ,ruby-yard)
       ("ruby-countdownlatch" ,ruby-countdownlatch)
       ("ruby-rb-fsevent" ,ruby-rb-fsevent)
       ("ruby-mocha" ,ruby-mocha)))
    (synopsis
      "An XMPP DSL for Ruby written on top of EventMachine and Nokogiri")
    (description
      "An XMPP DSL for Ruby written on top of EventMachine and Nokogiri")
    (home-page "http://adhearsion.com/blather")
    (license license:expat)))

(define-public ruby-braintree
  (package
    (name "ruby-braintree")
    (version "4.4.0")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; Rakefile.
       (uri (git-reference
             (url "https://github.com/braintree/braintree_ruby")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0dzf26yhmlf65464nranvqg5rzhrc8gfaqbg3p4ld3abz8ccnw08"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "test:unit"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'less-strict-dependencies
           (lambda _
             (substitute* "Gemfile"
               (("gem \"libxml-ruby\", \"3.2.0\"") "gem \"libxml-ruby\", \"~> 3.0.0\"")
               (("gem \"rspec\", \"3.9.0\"") "gem \"rspec\", \"~> 3.8.0\"")
               (("gem \"rubocop\", \"~>1.12.0\"") "gem \"rubocop\", \"~> 1.10.0\""))
             #t)))))
    (propagated-inputs
      `(("ruby-builder" ,ruby-builder)
        ("ruby-rexml" ,ruby-rexml)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-libxml" ,ruby-libxml)
       ("ruby-pry" ,ruby-pry)
       ("ruby-rake" ,ruby-rake)
       ("ruby-webrick" ,ruby-webrick)
       ("ruby-rubocop" ,ruby-rubocop)))
    (synopsis
      "Resources and tools for developers to integrate Braintree's global payments platform.")
    (description
      "Resources and tools for developers to integrate Braintree's global payments platform.")
    (home-page "https://www.braintreepayments.com/")
    (license license:expat)))

(define-public ruby-value-semantics
  (package
    (name "ruby-value-semantics")
    (version "3.6.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "value_semantics" version))
        (sha256
          (base32
            "1vdwai8wf6r1fkvdpyz1vzxm89q7ghjvb3pqpg2kvwibwzd99dnx"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "rspec")
             #t)))))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)))
    (synopsis
      "
    Generates modules that provide conventional value semantics for a given set of attributes.
    The behaviour is similar to an immutable `Struct` class,
    plus extensible, lightweight validation and coercion.
  ")
    (description
      "
    Generates modules that provide conventional value semantics for a given set of attributes.
    The behaviour is similar to an immutable `Struct` class,
    plus extensible, lightweight validation and coercion.
  ")
    (home-page
      "https://github.com/tomdalling/value_semantics")
    (license license:expat)))

(define-public ruby-promise.rb
  (package
    (name "ruby-promise.rb")
    (version "0.7.4")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "promise.rb" version))
        (sha256
          (base32
            "0a819sikcqvhi8hck1y10d1nv2qkjvmmm553626fmrh51h2i089d"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "Rakefile"
               (("if Gem.ruby_version.*") "if false\n"))
             (substitute* "spec/spec_helper.rb"
               ((".*devtools/spec_helper.*") "\n"))
             #t)))))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-rspec-its" ,ruby-rspec-its)
       ("ruby-awesome-print" ,ruby-awesome-print)
       ("ruby-fuubar" ,ruby-fuubar)))
    (synopsis "Promises/A+ for Ruby")
    (description "Promises/A+ for Ruby")
    (home-page "https://github.com/lgierth/promise")
    (license license:unlicense)))

(define-public ruby-multicodecs
  (package
    (name "ruby-multicodecs")
    (version "0.2.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "multicodecs" version))
        (sha256
          (base32
            "0drq267di57l9zqw6zvqqimilz42rbc8z7392dwkk8wslq30s7v8"))))
    (build-system ruby-build-system)
    (synopsis
      "This gem provides a PORO of the multicodec table for use with other
    multiformat ruby gems.")
    (description
      "This gem provides a PORO of the multicodec table for use with other
    multiformat ruby gems.")
    (home-page
      "https://github.com/SleeplessByte/ruby-multicodec")
    (license license:expat)))

(define-public ruby-multihashes
  (package
    (name "ruby-multihashes")
    (version "0.2.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "multihashes" version))
        (sha256
          (base32
            "17wiyy3fiv8rpgdv9ca01yncsmaaf8yg15bg18wc7m9frss1vgqg"))))
    (build-system ruby-build-system)
    (propagated-inputs
      `(("ruby-multicodecs" ,ruby-multicodecs)))
    (synopsis
      "A simple, low-level multihash (https://github.com/jbenet/multihash) implementation for ruby.")
    (description
      "This package provides a simple, low-level multihash (https://github.com/jbenet/multihash) implementation for ruby.")
    (home-page
      "https://github.com/neocities/ruby-multihashes")
    (license license:expat)))

(define-public ruby-lazy-object
  (package
    (name "ruby-lazy-object")
    (version "0.0.3")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "lazy_object" version))
        (sha256
          (base32
            "08px15lahc28ik9smvw1hgamf792gd6gq0s4k94yq1h7jq25wjn8"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (synopsis
      "It's an object wrapper that forwards all calls to the reference object. This object is not created until the first method dispatch.")
    (description
      "It's an object wrapper that forwards all calls to the reference object.  This object is not created until the first method dispatch.")
    (home-page "")
    (license license:expat)))

(define-public ruby-citrus
  (package
    (name "ruby-citrus")
    (version "3.0.2")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; files needed for tests
       (uri (git-reference
             (url "https://github.com/mjackson/citrus")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "197wrgqrddgm1xs3yvjvd8vkvil4h4mdrcp16jmd4b57rxrrr769"))))
    (build-system ruby-build-system)
    (synopsis "Parsing Expressions for Ruby")
    (description "Parsing Expressions for Ruby")
    (home-page "http://mjackson.github.io/citrus")
    (license license:expat)))

(define-public ruby-cbor
  (package
    (name "ruby-cbor")
    (version "0.5.9.6")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "cbor" version))
        (sha256
          (base32
            "0511idr8xps9625nh3kxr68sdy6l3xy2kcz7r57g47fxb1v18jj3"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-rake-compiler" ,ruby-rake-compiler)
       ("ruby-yard" ,ruby-yard)))
    (synopsis
      "CBOR is a library for the CBOR binary object representation format, based on Sadayuki Furuhashi's MessagePack library.")
    (description
      "CBOR is a library for the CBOR binary object representation format, based on Sadayuki Furuhashi's MessagePack library.")
    (home-page "http://cbor.io/")
    (license license:asl2.0)))

(define-public ruby-gem-release
  (package
    (name "ruby-gem-release")
    (version "2.2.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "gem-release" version))
        (sha256
          (base32
            "108rrfaiayi14zrqbb6z0cbwcxh8n15am5ry2a86v7c8c3niysq9"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (synopsis
      "Release your ruby gems with ease. (What a bold statement for such a tiny plugin ...)")
    (description
      "Release your ruby gems with ease. (What a bold statement for such a tiny plugin ...)")
    (home-page
    "https://github.com/svenfuchs/gem-release")
    (license license:expat)))

(define-public ruby-base32
  (package
    (name "ruby-base32")
    (version "0.3.4")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "base32" version))
        (sha256
          (base32
            "1fjs0l3c5g9qxwp43kcnhc45slx29yjb6m6jxbb2x1krgjmi166b"))))
    (build-system ruby-build-system)
    (native-inputs
     `(("ruby-gem-release" ,ruby-gem-release)))
    (synopsis
      "Ruby extension for base32 encoding and decoding")
    (description
      "Ruby extension for base32 encoding and decoding")
    (home-page "https://github.com/stesla/base32")
    (license license:expat)))

(define-public ruby-dhall
  (package
    (name "ruby-dhall")
    (version "0.5.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "dhall" version))
        (sha256
          (base32
            "09wcq8xc1ynld04r2f332bx8cn7rjc4afaq8hm1dr2fc35jlpn6m"))))
    (build-system ruby-build-system)
    (arguments
     ;; No test in gem archive
     `(#:tests? #f))
    (propagated-inputs
      `(("ruby-base32" ,ruby-base32)
        ("ruby-cbor" ,ruby-cbor)
        ("ruby-citrus" ,ruby-citrus)
        ("ruby-lazy-object" ,ruby-lazy-object)
        ("ruby-multihashes" ,ruby-multihashes)
        ("ruby-promise.rb" ,ruby-promise.rb)
        ("ruby-value-semantics" ,ruby-value-semantics)))
    (synopsis
      "This is a Ruby implementation of the Dhall configuration language. Dhall is a powerful, but safe and non-Turing-complete configuration language. For more information, see: https://dhall-lang.org")
    (description
      "This is a Ruby implementation of the Dhall configuration language.  Dhall is a powerful, but safe and non-Turing-complete configuration language.  For more information, see: https://dhall-lang.org")
    (home-page
      "https://git.singpolyma.net/dhall-ruby")
    (license license:gpl3)))

(define-public ruby-money
  (package
    (name "ruby-money")
    (version "6.16.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "money" version))
        (sha256
          (base32
            "0jkmsj5ymadik7bvl670bqwmvhsdyv7hjr8gq9z293hq35gnyiyg"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (propagated-inputs `(("ruby-i18n" ,ruby-i18n)))
    (synopsis
      "A Ruby Library for dealing with money and currency conversion.")
    (description
      "This package provides a Ruby Library for dealing with money and currency conversion.")
    (home-page "https://rubymoney.github.io/money")
    (license license:expat)))

(define-public ruby-monetize
  (package
    (name "ruby-monetize")
    (version "1.11.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "monetize" version))
        (sha256
          (base32
            "0cna2myxdbwfq0gn6k2hgrh368dq7wld3jklm96443ysykd0difn"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)))
    (propagated-inputs `(("ruby-money" ,ruby-money)))
    (synopsis
      "A library for converting various objects into `Money` objects.")
    (description
      "This package provides a library for converting various objects into `Money` objects.")
    (home-page
      "https://github.com/RubyMoney/monetize")
    (license license:expat)))

(define-public ruby-money-open-exchange-rates
  (package
    (name "ruby-money-open-exchange-rates")
    (version "1.4.0")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; Rakefile.
       (uri (git-reference
             (url "https://github.com/spk/money-open-exchange-rates")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "11xwqli8snr19k48yh8h77sal5vxd4snzq9gxg08v61f0574m3gw"))))
    (build-system ruby-build-system)
    (propagated-inputs `(("ruby-money" ,ruby-money)))
    (native-inputs
     `(("ruby-minitest" ,ruby-minitest)
       ("ruby-mocha" ,ruby-mocha)
       ("ruby-timecop" ,ruby-timecop)
       ("ruby-webmock" ,ruby-webmock)
       ("ruby-monetize" ,ruby-monetize)
       ("ruby-rake" ,ruby-rake)
       ("ruby-rubocop" ,ruby-rubocop)))
    (synopsis
      "A gem that calculates the exchange rate using published rates from open-exchange-rates. Compatible with the money gem.")
    (description
      "This package provides a gem that calculates the exchange rate using published rates from open-exchange-rates.  Compatible with the money gem.")
    (home-page
      "http://github.com/spk/money-open-exchange-rates")
    (license license:expat)))

(define-public ruby-roda
  (package
    (name "ruby-roda")
    (version "3.47.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "roda" version))
        (sha256
          (base32
            "1g3zs4bk8hqii15ci1hsykcsya88vr2qv63gp1qbcx4bm14l8lkl"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (propagated-inputs `(("ruby-rack" ,ruby-rack)))
    (synopsis "Routing tree web toolkit")
    (description "Routing tree web toolkit")
    (home-page "http://roda.jeremyevans.net")
    (license license:expat)))

(define-public ruby-nori
  (package
    (name "ruby-nori")
    (version "2.6.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "nori" version))
        (sha256
          (base32
            "066wc774a2zp4vrq3k7k8p0fhv30ymqmxma1jj7yg5735zls8agn"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests require too old version of rspec
     `(#:tests? #f))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-rake" ,ruby-rake)
       ("ruby-nokogiri" ,ruby-nokogiri)))
    (synopsis "XML to Hash translator")
    (description "XML to Hash translator")
    (home-page "https://github.com/savonrb/nori")
    (license license:expat)))

(define-public ruby-faraday-middleware
  (package
    (name "ruby-faraday-middleware")
    (version "1.1.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "faraday_middleware" version))
        (sha256
          (base32
            "0kgcphf7n74l3wlcvxafcp6a4l18b1bf4qslvz5dqj6v3gc8h8j4"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (propagated-inputs
      `(("ruby-faraday" ,ruby-faraday)))
    (synopsis "Various middleware for Faraday")
    (description "Various middleware for Faraday")
    (home-page
      "https://github.com/lostisland/faraday_middleware")
    (license license:expat)))

(define-public ruby-bandwidth-iris
  (package
    (name "ruby-bandwidth-iris")
    (version "4.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "ruby-bandwidth-iris" version))
        (sha256
          (base32
            "16bbx6y0ni3jl190ddr6xfbi2rbcikqfm2ghzr53445fpk6g12zc"))))
    (build-system ruby-build-system)
    (arguments
     ; Tests don't require helper for some reason, so all fail...
     '(#:tests? #f))
    (propagated-inputs
      `(("ruby-activesupport" ,ruby-activesupport)
        ("ruby-builder" ,ruby-builder)
        ("ruby-faraday" ,ruby-faraday)
        ("ruby-faraday-middleware"
         ,ruby-faraday-middleware)
        ("ruby-nori" ,ruby-nori)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-yard" ,ruby-yard)))
    (synopsis
      "Gem for integrating to Bandwidth's Iris API")
    (description
      "Gem for integrating to Bandwidth's Iris API")
    (home-page
      "https://github.com/bandwidthcom/ruby-bandwidth-iris")
    (license license:expat)))

(define-public ruby-sentry-core
  (package
    (name "ruby-sentry-core")
    (version "4.3.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sentry-ruby-core" version))
        (sha256
          (base32
            "13z35s9mflh3v775a0scsnqhscz9q46kaak38y7zmx32z7sg2a3a"))))
    (build-system ruby-build-system)
    (arguments
     ; No rakefile in gem
     '(#:tests? #f))
    (propagated-inputs
      `(("ruby-concurrent" ,ruby-concurrent)
        ("ruby-faraday" ,ruby-faraday)))
    (synopsis
      "A gem that provides a client interface for the Sentry error logger")
    (description
      "This package provides a gem that provides a client interface for the Sentry error logger")
    (home-page
      "https://github.com/getsentry/sentry-ruby")
    (license license:expat)))

(define-public ruby-sentry
  (package
    (name "ruby-sentry")
    (version "4.3.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sentry-ruby" version))
        (sha256
          (base32
            "101q3141xfkmh7vi8h4sjqqmxcx90xhyq51lmfnhfiwgii7cn9k8"))))
    (build-system ruby-build-system)
    (arguments
     ; No rakefile in gem
     '(#:tests? #f))
    (propagated-inputs
      `(("ruby-concurrent" ,ruby-concurrent)
        ("ruby-faraday" ,ruby-faraday)
        ("ruby-sentry-core" ,ruby-sentry-core)))
    (synopsis
      "A gem that provides a client interface for the Sentry error logger")
    (description
      "This package provides a gem that provides a client interface for the Sentry error logger")
    (home-page
      "https://github.com/getsentry/sentry-ruby")
    (license license:expat)))

(define-public ruby-webrick
  (package
    (name "ruby-webrick")
    (version "1.7.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "webrick" version))
        (sha256
          (base32
            "1d4cvgmxhfczxiq5fr534lmizkhigd15bsx5719r5ds7k7ivisc7"))))
    (build-system ruby-build-system)
    (synopsis
      "WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.")
    (description
      "WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.")
    (home-page "https://github.com/ruby/webrick")
    (license (list #f #f))))

(define-public ruby-interception
  (package
    (name "ruby-interception")
    (version "0.5")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "interception" version))
        (sha256
          (base32
            "01vrkn28psdx1ysh5js3hn17nfp1nvvv46wc1pwqsakm6vb1hf55"))))
    (build-system ruby-build-system)
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)))
    (synopsis
      "Provides a cross-platform ability to intercept all exceptions as they are raised.")
    (description
      "This package provides a cross-platform ability to intercept all exceptions as they are raised.")
    (home-page
      "http://github.com/ConradIrwin/interception")
    (license license:expat)))

(define-public ruby-pry-rescue
  (package
    (name "ruby-pry-rescue")
    (version "1.5.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "pry-rescue" version))
        (sha256
          (base32
            "1wn72y8y3d3g0ng350ld92nyjln012432q2z2iy9lhwzjc4dwi65"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'nuke-bad-test
           (lambda _
             (substitute* "spec/source_location_spec.rb"
               (("time = Time.now") "skip"))
             #t)))))
    (propagated-inputs
      `(("ruby-interception" ,ruby-interception)
        ("ruby-pry" ,ruby-pry)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-pry-stack-explorer" ,ruby-pry-stack-explorer)))
    (synopsis
      "Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions")
    (description
      "Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions")
    (home-page
      "https://github.com/ConradIrwin/pry-rescue")
    (license license:expat)))

(define-public ruby-rantly
  (package
    (name "ruby-rantly")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "rantly" version))
        (sha256
          (base32
            "11407cg0dzz83jsschnrpi9cqwz8b04q6bj6qj3m70ay52y222ix"))))
    (build-system ruby-build-system)
    (native-inputs
     `(("ruby-rubocop" ,ruby-rubocop)
       ("ruby-simplecov" ,ruby-simplecov)))
    (synopsis
      "Ruby Imperative Random Data Generator and Quickcheck")
    (description
      "Ruby Imperative Random Data Generator and Quickcheck")
    (home-page "https://github.com/rantly-rb/rantly")
    (license license:expat)))

(define %source-dir (dirname (current-filename)))
(define %git-dir (string-append %source-dir "/.git"))

;;;;

; double-escaped template of the jmp-pay sexp
; This allows us to bake the expression without doing a full eval to a record,
; so it can be written
(define-public jmp-pay-template
  '(package
    (name "jmp-pay")
    (version (read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "describe" "--always" "--dirty")))
    (source
     `(origin
       (method git-fetch)
       (uri (git-reference
             (recursive? #t)
             (url "https://git.singpolyma.net/jmp-pay")
             (commit ,(read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "rev-parse" "HEAD")))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         ,(read-line (open-pipe* OPEN_READ "guix" "hash" "-rx" %source-dir))))))
    (build-system 'copy-build-system)
    (arguments
     ''(#:install-plan '(("." "share/jmp-pay"))
       #:phases
       (modify-phases %standard-phases
         (add-after 'install 'wrap
           (lambda* (#:key outputs #:allow-other-keys)
             (use-modules (ice-9 ftw))
             (let* ((out (assoc-ref outputs "out"))
                    (appbindir (string-append out "/share/jmp-pay/bin/"))
                    (bindir (string-append out "/bin/")))
               (for-each (lambda (bin)
                 (mkdir-p bindir)
                 (let ((binstub (string-append bindir bin)))
                   (call-with-output-file binstub
                     (lambda (port)
                       (format port
                         "#!~a~%ENV['GEM_PATH'] = ['~a', ENV['GEM_PATH']].compact.join(':')~%Gem.clear_paths~%load '~a~a'~%"
                         (which "ruby")
                         (getenv "GEM_PATH")
                         appbindir
                         bin)))
                   (chmod binstub #o755)))
                 (scandir appbindir
                   (lambda (f) (eq? 'regular (stat:type (stat (string-append appbindir f))))))))
             #t))
         (add-before 'install 'check
           (lambda _
             (invoke "rake" "test")
             #t)))))
    (propagated-inputs
      '`(("ruby-blather" ,ruby-blather)
        ("ruby-braintree" ,ruby-braintree)
        ("ruby-dhall" ,ruby-dhall)
        ("ruby-money-open-exchange-rates" ,ruby-money-open-exchange-rates)
        ("ruby-pg" ,ruby-pg)
        ("ruby-redis" ,ruby-redis)
        ("ruby-roda" ,ruby-roda)
        ("ruby-bandwidth-iris" ,ruby-bandwidth-iris)
        ("ruby-sentry" ,ruby-sentry)
        ("ruby" ,ruby) ;; Normally ruby-build-system adds this for us
        ("ruby-slim" ,ruby-slim)))
    (native-inputs
     '`(("ruby-rantly" ,ruby-rantly)
       ("ruby-rake" ,ruby-rake)
       ("ruby-webmock" ,ruby-webmock)))
    (synopsis
      "Payment infrastructure for JMP.chat")
    (description
      "Web service and cronjobs for payment handling")
    (home-page
      "https://git.singpolyma.net/jmp-pay")
    (license 'license:agpl3)))

; Baked version of jmp-pay-template with leaves eval'd
(define-public jmp-pay-baked
 (cons
  (car jmp-pay-template)
  (map
   (lambda (x) (list (car x) (eval (cadr x) (current-module))))
   (cdr jmp-pay-template))))

; Build clean from git the version from a local clone
; To build whatever is sitting in local use:
; guix build --with-source="jmp-pay@$(git describe --always --dirty)=$(pwd)" -L . jmp-pay
(define-public jmp-pay
  (eval jmp-pay-baked (current-module)))