Class: Braintree::WebhookTestingGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/braintree/webhook_testing_gateway.rb

Instance Method Summary collapse

Constructor Details

#initialize(gateway) ⇒ WebhookTestingGateway

Returns a new instance of WebhookTestingGateway.



3
4
5
6
7
# File 'lib/braintree/webhook_testing_gateway.rb', line 3

def initialize(gateway)
  @gateway = gateway
  @config = gateway.config
  @config.assert_has_access_token_or_keys
end

Instance Method Details

#_account_updater_daily_report_sample_xml(id) ⇒ Object



996
997
998
999
1000
1001
1002
1003
# File 'lib/braintree/webhook_testing_gateway.rb', line 996

def (id)
  <<-XML
    <account-updater-daily-report>
      <report-date type="date">2016-01-14</report-date>
      <report-url>link-to-csv-report</report-url>
    </account-updater-daily-report>
  XML
end

#_auth_paypal_status_changed_sample_xml(id) ⇒ Object



1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/braintree/webhook_testing_gateway.rb', line 1015

def _auth_paypal_status_changed_sample_xml(id)
  <<-XML
    <connected-merchant-paypal-status-changed>
      <oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
      <merchant-public-id>#{id}</merchant-public-id>
      <action>link</action>
    </connected-merchant-paypal-status-changed>
    XML
end

#_auth_status_transitioned_sample_xml(id) ⇒ Object



1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/braintree/webhook_testing_gateway.rb', line 1005

def _auth_status_transitioned_sample_xml(id)
  <<-XML
    <connected-merchant-status-transitioned>
      <merchant-public-id>#{id}</merchant-public-id>
      <status>new_status</status>
      <oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
    </connected-merchant-status-transitioned>
  XML
end

#_blik_one_click_local_payment_completed_sample_xml(id) ⇒ Object



1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
# File 'lib/braintree/webhook_testing_gateway.rb', line 1106

def _blik_one_click_local_payment_completed_sample_xml(id)
  <<-XML
    <local-payment>
      <bic>BIC</bic>
      <blik-aliases type='array'>
        <blik-alias>
          <key>alias-key-1</key>
          <label>alias-label-1</label>
        </blik-alias>
      </blik-aliases>
      <iban_last_chars>1234</iban_last_chars>
      <payer-id>ABCPAYER</payer-id>
      <payer-name>PAYERNAME</payer-name>
      <payment-id>PAY-XYZ123</payment-id>
      <payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
      <transaction>
        <id>#{id}</id>
        <status>authorized</status>
        <amount>49.99</amount>
        <order-id>order4567</order-id>
      </transaction>
    </local-payment>
  XML
end

#_checkObject



110
111
112
113
114
115
# File 'lib/braintree/webhook_testing_gateway.rb', line 110

def _check

  <<-XML
    <check type="boolean">true</check>
  XML
end

#_default_local_payment_completed_sample_xml(id) ⇒ Object



1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/braintree/webhook_testing_gateway.rb', line 1087

def _default_local_payment_completed_sample_xml(id)
  <<-XML
    <local-payment>
      <bic>BIC</bic>
      <iban_last_chars>1234</iban_last_chars>
      <payer-id>ABCPAYER</payer-id>
      <payer-name>PAYERNAME</payer-name>
      <payment-id>PAY-XYZ123</payment-id>
      <payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
      <transaction>
        <id>#{id}</id>
        <status>authorized</status>
        <amount>49.99</amount>
        <order-id>order4567</order-id>
      </transaction>
    </local-payment>
  XML
end

#_disbursement_sample_xml(id) ⇒ Object



972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
# File 'lib/braintree/webhook_testing_gateway.rb', line 972

def _disbursement_sample_xml(id)
  <<-XML
    <disbursement>
      <id>#{id}</id>
      <transaction-ids type="array">
        <item>afv56j</item>
        <item>kj8hjk</item>
      </transaction-ids>
      <success type="boolean">true</success>
      <retry type="boolean">false</retry>
      <merchant-account>
        <id>merchant_account_token</id>
        <currency-iso-code>USD</currency-iso-code>
        <sub-merchant-account type="boolean">false</sub-merchant-account>
        <status>active</status>
      </merchant-account>
      <amount>100.00</amount>
      <disbursement-date type="date">2014-02-10</disbursement-date>
      <exception-message nil="true"/>
      <follow-up-action nil="true"/>
    </disbursement>
  XML
end

#_dispute_accepted_sample_xml(id) ⇒ Object



373
374
375
376
377
378
379
# File 'lib/braintree/webhook_testing_gateway.rb', line 373

def _dispute_accepted_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_accepted_sample_xml(id)
  else
    _new_dispute_accepted_sample_xml(id)
  end
end

#_dispute_auto_accepted_sample_xml(id) ⇒ Object



381
382
383
384
385
386
387
# File 'lib/braintree/webhook_testing_gateway.rb', line 381

def _dispute_auto_accepted_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_auto_accepted_sample_xml(id)
  else
    _new_dispute_auto_accepted_sample_xml(id)
  end
end

#_dispute_disputed_sample_xml(id) ⇒ Object



389
390
391
392
393
394
395
# File 'lib/braintree/webhook_testing_gateway.rb', line 389

def _dispute_disputed_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_disputed_sample_xml(id)
  else
    _new_dispute_disputed_sample_xml(id)
  end
end

#_dispute_expired_sample_xml(id) ⇒ Object



397
398
399
400
401
402
403
# File 'lib/braintree/webhook_testing_gateway.rb', line 397

def _dispute_expired_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_expired_sample_xml(id)
  else
    _new_dispute_expired_sample_xml(id)
  end
end

#_dispute_lost_sample_xml(id) ⇒ Object



357
358
359
360
361
362
363
# File 'lib/braintree/webhook_testing_gateway.rb', line 357

def _dispute_lost_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_lost_sample_xml(id)
  else
    _new_dispute_lost_sample_xml(id)
  end
end

#_dispute_opened_sample_xml(id) ⇒ Object



349
350
351
352
353
354
355
# File 'lib/braintree/webhook_testing_gateway.rb', line 349

def _dispute_opened_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_opened_sample_xml(id)
  else
    _new_dispute_opened_sample_xml(id)
  end
end

#_dispute_under_review_sample_xml(id) ⇒ Object



341
342
343
344
345
346
347
# File 'lib/braintree/webhook_testing_gateway.rb', line 341

def _dispute_under_review_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_under_review_sample_xml(id)
  else
    _new_dispute_under_review_sample_xml(id)
  end
end

#_dispute_won_sample_xml(id) ⇒ Object



365
366
367
368
369
370
371
# File 'lib/braintree/webhook_testing_gateway.rb', line 365

def _dispute_won_sample_xml(id)
  if id == "legacy_dispute_id"
    _old_dispute_won_sample_xml(id)
  else
    _new_dispute_won_sample_xml(id)
  end
end

#_granted_payment_instrument_update_sample_xml(id) ⇒ Object



1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
# File 'lib/braintree/webhook_testing_gateway.rb', line 1034

def _granted_payment_instrument_update_sample_xml(id)
  <<-XML
    <granted-payment-instrument-update>
      <grant-owner-merchant-id>vczo7jqrpwrsi2px</grant-owner-merchant-id>
      <grant-recipient-merchant-id>cf0i8wgarszuy6hc</grant-recipient-merchant-id>
      <payment-method-nonce>
        <nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</nonce>
        <consumed type="boolean">false</consumed>
        <locked type="boolean">false</locked>
      </payment-method-nonce>
      <token>abc123z</token>
      <updated-fields type="array">
        <item>expiration-month</item>
        <item>expiration-year</item>
      </updated-fields>
    </granted-payment-instrument-update>
  XML
end

#_granted_payment_method_revoked_xml(id) ⇒ Object



1053
1054
1055
# File 'lib/braintree/webhook_testing_gateway.rb', line 1053

def _granted_payment_method_revoked_xml(id)
  (id)
end

#_local_payment_completed_sample_xml(id) ⇒ Object



1079
1080
1081
1082
1083
1084
1085
# File 'lib/braintree/webhook_testing_gateway.rb', line 1079

def _local_payment_completed_sample_xml(id)
  if id == "blik_one_click_id"
    _blik_one_click_local_payment_completed_sample_xml(id)
  else
    _default_local_payment_completed_sample_xml(id)
  end
end

#_local_payment_expired_sample_xmlObject



1131
1132
1133
1134
1135
1136
1137
1138
# File 'lib/braintree/webhook_testing_gateway.rb', line 1131

def _local_payment_expired_sample_xml
  <<-XML
    <local-payment-expired>
      <payment-id>PAY-XYZ123</payment-id>
      <payment-context-id>cG5b=</payment-context-id>
    </local-payment-expired>
  XML
end

#_local_payment_funded_sample_xml(id) ⇒ Object



1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
# File 'lib/braintree/webhook_testing_gateway.rb', line 1140

def _local_payment_funded_sample_xml(id)
  <<-XML
    <local-payment-funded>
      <payment-id>PAY-XYZ123</payment-id>
      <payment-context-id>cG5b=</payment-context-id>
      <transaction>
        <id>#{id}</id>
        <status>settled</status>
        <amount>49.99</amount>
        <order-id>order4567</order-id>
      </transaction>
    </local-payment-funded>
  XML
end

#_local_payment_reversed_sample_xmlObject



1155
1156
1157
1158
1159
1160
1161
1162
# File 'lib/braintree/webhook_testing_gateway.rb', line 1155

def _local_payment_reversed_sample_xml
  <<-XML
    <local-payment-reversed>
      <payment-id>PAY-XYZ123</payment-id>
      <payment-context-id>cG5b=</payment-context-id>
    </local-payment-reversed>
  XML
end

#_merchant_account_approved_sample_xml(id) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/braintree/webhook_testing_gateway.rb', line 218

def (id)

  <<-XML
    <merchant_account>
      <id>#{id}</id>
      <master_merchant_account>
        <id>master_ma_for_#{id}</id>
        <status>active</status>
      </master_merchant_account>
      <status>active</status>
    </merchant_account>
  XML
end

#_merchant_account_declined_sample_xml(id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 232

def (id)

  <<-XML
      <api-error-response>
          <message>Credit score is too low</message>
          <errors>
              <errors type="array"/>
                  <merchant-account>
                      <errors type="array">
                          <error>
                              <code>82621</code>
                              <message>Credit score is too low</message>
                              <attribute type="symbol">base</attribute>
                          </error>
                      </errors>
                  </merchant-account>
              </errors>
              <merchant-account>
                  <id>#{id}</id>
                  <status>suspended</status>
                  <master-merchant-account>
                      <id>master_ma_for_#{id}</id>
                      <status>suspended</status>
                  </master-merchant-account>
              </merchant-account>
      </api-error-response>
  XML
end

#_new_dispute_accepted_sample_xml(id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 773

def _new_dispute_accepted_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>accepted</status>
      <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>open</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
        <status-history>
          <status>accepted</status>
          <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array"/>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_new_dispute_auto_accepted_sample_xml(id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 819

def _new_dispute_auto_accepted_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>auto_accepted</status>
      <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>open</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
        <status-history>
          <status>auto_accepted</status>
          <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array"/>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_new_dispute_disputed_sample_xml(id) ⇒ Object



865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
# File 'lib/braintree/webhook_testing_gateway.rb', line 865

def _new_dispute_disputed_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>disputed</status>
      <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>open</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
        <status-history>
          <status>disputed</status>
          <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array">
        <evidence>
          <id>rxtngk9j5j93tsrq</id>
          <comments nil="true"/>
          <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
          <sent-to-processor-at nil="true"/>
          <url>s3.amazonaws.com/foo.jpg</url>
        </evidence>
        <evidence>
          <id>88cfb8dd</id>
          <comments>text evidence</comments>
          <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
          <sent-to-processor-at nil="true"/>
          <url nil="true"/>
        </evidence>
      </evidence>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_new_dispute_expired_sample_xml(id) ⇒ Object



926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
# File 'lib/braintree/webhook_testing_gateway.rb', line 926

def _new_dispute_expired_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>expired</status>
      <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>open</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
        <status-history>
          <status>expired</status>
          <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array"/>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_new_dispute_lost_sample_xml(id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 650

def _new_dispute_lost_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>lost</status>
      <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>open</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
        <status-history>
          <status>lost</status>
          <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array">
        <evidence>
          <id>rxtngk9j5j93tsrq</id>
          <comments nil="true"/>
          <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
          <sent-to-processor-at nil="true"/>
          <url>s3.amazonaws.com/foo.jpg</url>
        </evidence>
        <evidence>
          <id>88cfb8dd</id>
          <comments>text evidence</comments>
          <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
          <sent-to-processor-at nil="true"/>
          <url nil="true"/>
        </evidence>
      </evidence>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_new_dispute_opened_sample_xml(id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 608

def _new_dispute_opened_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>open</status>
      <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>open</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array"/>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_new_dispute_under_review_sample_xml(id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 566

def _new_dispute_under_review_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>under_review</status>
      <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>under_review</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array"/>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_new_dispute_won_sample_xml(id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 711

def _new_dispute_won_sample_xml(id)
  <<-XML
    <dispute>
      <id>#{id}</id>
      <amount>100.00</amount>
      <amount-disputed>100.00</amount-disputed>
      <amount-won>95.00</amount-won>
      <case-number>CASE-12345</case-number>
      <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
      <currency-iso-code>USD</currency-iso-code>
      <forwarded-comments nil="true"/>
      <kind>chargeback</kind>
      <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
      <reason>fraud</reason>
      <reason-code nil="true"/>
      <reason-description nil="true"/>
      <received-date type="date">2016-02-15</received-date>
      <reference-number>REF-9876</reference-number>
      <reply-by-date type="date">2016-02-22</reply-by-date>
      <status>won</status>
      <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
      <original-dispute-id>9qde5qgp</original-dispute-id>
      <status-history type="array">
        <status-history>
          <status>open</status>
          <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
        </status-history>
        <status-history>
          <status>won</status>
          <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
        </status-history>
      </status-history>
      <evidence type="array">
        <evidence>
          <id>rxtngk9j5j93tsrq</id>
          <comments nil="true"/>
          <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
          <sent-to-processor-at nil="true"/>
          <url>s3.amazonaws.com/foo.jpg</url>
        </evidence>
        <evidence>
          <id>88cfb8dd</id>
          <comments>text evidence</comments>
          <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
          <sent-to-processor-at nil="true"/>
          <url nil="true"/>
        </evidence>
      </evidence>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
        <created-at>2017-06-21T20:44:41Z</created-at>
        <order-id nil="true"/>
        <purchase-order-number nil="true"/>
        <payment-instrument-subtype>Visa</payment-instrument-subtype>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
      <date-won type=\"date\">2014-03-22</date-won>
    </dispute>
  XML
end

#_oauth_access_revoked_sample_xml(id) ⇒ Object



1025
1026
1027
1028
1029
1030
1031
1032
# File 'lib/braintree/webhook_testing_gateway.rb', line 1025

def _oauth_access_revoked_sample_xml(id)
  <<-XML
    <oauth-application-revocation>
      <merchant-id>#{id}</merchant-id>
      <oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
    </oauth-application-revocation>
  XML
end

#_old_dispute_accepted_sample_xml(id) ⇒ Object



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/braintree/webhook_testing_gateway.rb', line 486

def _old_dispute_accepted_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>accepted</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_old_dispute_auto_accepted_sample_xml(id) ⇒ Object



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/braintree/webhook_testing_gateway.rb', line 506

def _old_dispute_auto_accepted_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>auto_accepted</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_old_dispute_disputed_sample_xml(id) ⇒ Object



526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/braintree/webhook_testing_gateway.rb', line 526

def _old_dispute_disputed_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>disputed</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_old_dispute_expired_sample_xml(id) ⇒ Object



546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/braintree/webhook_testing_gateway.rb', line 546

def _old_dispute_expired_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>expired</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_old_dispute_lost_sample_xml(id) ⇒ Object



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/braintree/webhook_testing_gateway.rb', line 445

def _old_dispute_lost_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>lost</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_old_dispute_opened_sample_xml(id) ⇒ Object



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/braintree/webhook_testing_gateway.rb', line 425

def _old_dispute_opened_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>open</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_old_dispute_under_review_sample_xml(id) ⇒ Object



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/braintree/webhook_testing_gateway.rb', line 405

def _old_dispute_under_review_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>under_review</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
    </dispute>
  XML
end

#_old_dispute_won_sample_xml(id) ⇒ Object



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# File 'lib/braintree/webhook_testing_gateway.rb', line 465

def _old_dispute_won_sample_xml(id)
  <<-XML
    <dispute>
      <amount>100.00</amount>
      <currency-iso-code>USD</currency-iso-code>
      <received-date type="date">2014-03-01</received-date>
      <reply-by-date type="date">2014-03-21</reply-by-date>
      <kind>chargeback</kind>
      <status>won</status>
      <reason>fraud</reason>
      <id>#{id}</id>
      <transaction>
        <id>#{id}</id>
        <amount>100.00</amount>
      </transaction>
      <date-opened type=\"date\">2014-03-21</date-opened>
      <date-won type=\"date\">2014-03-22</date-won>
    </dispute>
  XML
end

#_partner_merchant_connected_sample_xml(data) ⇒ Object



187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/braintree/webhook_testing_gateway.rb', line 187

def _partner_merchant_connected_sample_xml(data)

  <<-XML
    <partner-merchant>
      <merchant-public-id>public_id</merchant-public-id>
      <public-key>public_key</public-key>
      <private-key>private_key</private-key>
      <partner-merchant-id>abc123</partner-merchant-id>
      <client-side-encryption-key>cse_key</client-side-encryption-key>
    </partner-merchant>
  XML
end

#_partner_merchant_declined_sample_xml(data) ⇒ Object



209
210
211
212
213
214
215
216
# File 'lib/braintree/webhook_testing_gateway.rb', line 209

def _partner_merchant_declined_sample_xml(data)

  <<-XML
    <partner-merchant>
      <partner-merchant-id>abc123</partner-merchant-id>
    </partner-merchant>
  XML
end

#_partner_merchant_disconnected_sample_xml(data) ⇒ Object



200
201
202
203
204
205
206
207
# File 'lib/braintree/webhook_testing_gateway.rb', line 200

def _partner_merchant_disconnected_sample_xml(data)

  <<-XML
    <partner-merchant>
      <partner-merchant-id>abc123</partner-merchant-id>
    </partner-merchant>
  XML
end

#_payment_method_customer_data_updated_sample_xml(id) ⇒ Object



1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
# File 'lib/braintree/webhook_testing_gateway.rb', line 1164

def _payment_method_customer_data_updated_sample_xml(id)
  <<-XML
    <payment-method-customer-data-updated-metadata>
      <token>TOKEN-12345</token>
      <payment-method>
        #{(id)}
      </payment-method>
      <datetime-updated type='dateTime'>2022-01-01T21:28:37Z</datetime-updated>
      <enriched-customer-data>
        <fields-updated type='array'>
          <item>username</item>
        </fields-updated>
        <profile-data>
          <username>venmo_username</username>
          <first-name>John</first-name>
          <last-name>Doe</last-name>
          <phone-number>1231231234</phone-number>
          <email>[email protected]</email>
        </profile-data>
      </enriched-customer-data>
    </payment-method-customer-data-updated-metadata>
  XML
end

#_payment_method_revoked_by_customer_sample_xml(id) ⇒ Object



1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/braintree/webhook_testing_gateway.rb', line 1057

def _payment_method_revoked_by_customer_sample_xml(id)
  <<-XML
    <paypal-account>
      <billing-agreement-id>a-billing-agreement-id</billing-agreement-id>
      <created-at type="datetime">2019-01-01T12:00:00Z</created-at>
      <customer-id>a-customer-id</customer-id>
      <default type="boolean">true</default>
      <email>[email protected]</email>
      <global-id>cGF5bWVudG1ldGhvZF9jaDZieXNz</global-id>
      <image-url>https://assets.braintreegateway.com/payment_method_logo/paypal.png?environment=test</image-url>
      <subscriptions type="array"/>
      <token>#{id}</token>
      <updated-at type="datetime">2019-01-02T12:00:00Z</updated-at>
      <is-channel-initiated nil="true"/>
      <payer-id>a-payer-id</payer-id>
      <payer-info nil="true"/>
      <limited-use-order-id nil="true"/>
      <revoked-at type="datetime">2019-01-02T12:00:00Z</revoked-at>
    </paypal-account>
  XML
end

#_refund_failed_sample_xml(id) ⇒ Object



1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
# File 'lib/braintree/webhook_testing_gateway.rb', line 1206

def _refund_failed_sample_xml(id)
  <<-XML
    <transaction>
      <id>#{id}</id>
      <amount>100</amount>
      <credit-card>
        <number>1234560000001234</number>
        <cvv>123</cvv>
        <card-type>MasterCard</card-type>
      </credit-card>
      <status>processor_declined</status>
      <refunded-transaction-id>1</refunded-transaction-id>
    </transaction>
  XML
end

#_sample_xml(kind, data, source_merchant_id = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/braintree/webhook_testing_gateway.rb', line 16

def _sample_xml(kind, data, source_merchant_id=nil)
  unless source_merchant_id.nil?
    source_merchant_xml = "<source-merchant-id>#{source_merchant_id}</source-merchant-id>"
  end

  <<-XML
    <notification>
      <timestamp type="datetime">#{Time.now.utc.iso8601}</timestamp>
      <kind>#{kind}</kind>
      #{source_merchant_xml}
      <subject>
        #{_subject_sample_xml(kind, data)}
      </subject>
    </notification>
  XML
end

#_subject_sample_xml(kind, id) ⇒ Object



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
# File 'lib/braintree/webhook_testing_gateway.rb', line 33

def _subject_sample_xml(kind, id)
  case kind
  when Braintree::WebhookNotification::Kind::Check
    _check
  when Braintree::WebhookNotification::Kind::DisputeAccepted
    _dispute_accepted_sample_xml(id)
  when Braintree::WebhookNotification::Kind::DisputeAutoAccepted
    _dispute_auto_accepted_sample_xml(id)
  when Braintree::WebhookNotification::Kind::DisputeDisputed
    _dispute_disputed_sample_xml(id)
  when Braintree::WebhookNotification::Kind::DisputeExpired
    _dispute_expired_sample_xml(id)
  when Braintree::WebhookNotification::Kind::DisputeLost
    _dispute_lost_sample_xml(id)
  when Braintree::WebhookNotification::Kind::DisputeOpened
    _dispute_opened_sample_xml(id)
  when Braintree::WebhookNotification::Kind::DisputeUnderReview
    _dispute_under_review_sample_xml(id)
  when Braintree::WebhookNotification::Kind::DisputeWon
    _dispute_won_sample_xml(id)
  when Braintree::WebhookNotification::Kind::PartnerMerchantConnected
    _partner_merchant_connected_sample_xml(id)
  when Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected
    _partner_merchant_disconnected_sample_xml(id)
  when Braintree::WebhookNotification::Kind::PartnerMerchantDeclined
    _partner_merchant_declined_sample_xml(id)
  when Braintree::WebhookNotification::Kind::OAuthAccessRevoked
    _oauth_access_revoked_sample_xml(id)
  when Braintree::WebhookNotification::Kind::TransactionDisbursed
    _transaction_disbursed_sample_xml(id)
  when Braintree::WebhookNotification::Kind::TransactionRetried
    _transaction_retried_sample_xml(id)
  when Braintree::WebhookNotification::Kind::TransactionReviewed
    _transaction_reviewed_sample_xml(id)
  when Braintree::WebhookNotification::Kind::TransactionSettled
    _transaction_settled_sample_xml(id)
  when Braintree::WebhookNotification::Kind::TransactionSettlementDeclined
    _transaction_settlement_declined_sample_xml(id)
  when Braintree::WebhookNotification::Kind::Disbursement
    _disbursement_sample_xml(id)
  when Braintree::WebhookNotification::Kind::SubscriptionBillingSkipped
    _subscription_billing_skipped(id)
  when Braintree::WebhookNotification::Kind::SubscriptionChargedSuccessfully
    _subscription_charged_successfully(id)
  when Braintree::WebhookNotification::Kind::SubscriptionChargedUnsuccessfully
    _subscription_charged_unsuccessfully(id)
  when Braintree::WebhookNotification::Kind::AccountUpdaterDailyReport
    (id)
  when Braintree::WebhookNotification::Kind::ConnectedMerchantStatusTransitioned
    _auth_status_transitioned_sample_xml(id)
  when Braintree::WebhookNotification::Kind::ConnectedMerchantPayPalStatusChanged
    _auth_paypal_status_changed_sample_xml(id)
  when Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod
    _granted_payment_instrument_update_sample_xml(id)
  when Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
    _granted_payment_instrument_update_sample_xml(id)
  when Braintree::WebhookNotification::Kind::GrantedPaymentMethodRevoked
    _granted_payment_method_revoked_xml(id)
  when Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer
    _payment_method_revoked_by_customer_sample_xml(id)
  when Braintree::WebhookNotification::Kind::LocalPaymentCompleted
    _local_payment_completed_sample_xml(id)
  when Braintree::WebhookNotification::Kind::LocalPaymentExpired
    _local_payment_expired_sample_xml
  when Braintree::WebhookNotification::Kind::LocalPaymentFunded
    _local_payment_funded_sample_xml(id)
  when Braintree::WebhookNotification::Kind::LocalPaymentReversed
    _local_payment_reversed_sample_xml
  when Braintree::WebhookNotification::Kind::PaymentMethodCustomerDataUpdated
    _payment_method_customer_data_updated_sample_xml(id)
  when Braintree::WebhookNotification::Kind::RefundFailed
    _refund_failed_sample_xml(id)
  else
    _subscription_sample_xml(id)
  end
end

#_subscription_billing_skipped(id) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/braintree/webhook_testing_gateway.rb', line 117

def _subscription_billing_skipped(id)

  <<-XML
    <subscription>
      <id>#{id}</id>
      <transactions type="array">
      </transactions>
      <add_ons type="array">
      </add_ons>
      <discounts type="array">
      </discounts>
    </subscription>
  XML
end

#_subscription_charged_successfully(id) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/braintree/webhook_testing_gateway.rb', line 132

def _subscription_charged_successfully(id)

  <<-XML
    <subscription>
      <id>#{id}</id>
      <transactions type="array">
        <transaction>
          <id>#{id}</id>
          <status>submitted_for_settlement</status>
          <amount>49.99</amount>
        </transaction>
      </transactions>
      <add_ons type="array">
      </add_ons>
      <discounts type="array">
      </discounts>
    </subscription>
  XML
end

#_subscription_charged_unsuccessfully(id) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/braintree/webhook_testing_gateway.rb', line 152

def _subscription_charged_unsuccessfully(id)

  <<-XML
    <subscription>
      <id>#{id}</id>
      <transactions type="array">
        <transaction>
          <id>#{id}</id>
          <status>failed</status>
          <amount>49.99</amount>
        </transaction>
      </transactions>
      <add_ons type="array">
      </add_ons>
      <discounts type="array">
      </discounts>
    </subscription>
  XML
end

#_subscription_sample_xml(id) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/braintree/webhook_testing_gateway.rb', line 172

def _subscription_sample_xml(id)

  <<-XML
    <subscription>
      <id>#{id}</id>
      <transactions type="array">
      </transactions>
      <add_ons type="array">
      </add_ons>
      <discounts type="array">
      </discounts>
    </subscription>
  XML
end

#_transaction_disbursed_sample_xml(id) ⇒ Object



261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/braintree/webhook_testing_gateway.rb', line 261

def _transaction_disbursed_sample_xml(id)

  <<-XML
    <transaction>
      <id>#{id}</id>
      <amount>100</amount>
      <disbursement-details>
        <disbursement-date type="date">2013-07-09</disbursement-date>
      </disbursement-details>
    </transaction>
  XML
end

#_transaction_retried_sample_xml(id) ⇒ Object



274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/braintree/webhook_testing_gateway.rb', line 274

def _transaction_retried_sample_xml(id)

  <<-XML
    <transaction>
      <id>#{id}</id>
      <amount>100</amount>
      <status>submitted_for_settlement</status>
      <type>sale</type>
      <currency-iso-code>USD</currency-iso-code>
      <retried-transaction-id>original_txn_id</retried-transaction-id>
    </transaction>
  XML
end

#_transaction_reviewed_sample_xml(id) ⇒ Object



288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/braintree/webhook_testing_gateway.rb', line 288

def _transaction_reviewed_sample_xml(id)

  <<-XML
    <transaction-review>
      <transaction-id>my_id</transaction-id>
      <decision>decision</decision>
      <reviewer-email>[email protected]</reviewer-email>
      <reviewer-note>i reviewed this</reviewer-note>
      <reviewed-time type="datetime">2017-06-16T20:44:41Z</reviewed-time>
    </transaction-review>
  XML
end

#_transaction_settled_sample_xml(id) ⇒ Object



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/braintree/webhook_testing_gateway.rb', line 301

def _transaction_settled_sample_xml(id)
  <<-XML
    <transaction>
      <id>#{id}</id>
      <status>settled</status>
      <type>sale</type>
      <currency-iso-code>USD</currency-iso-code>
      <amount>100.00</amount>
      <merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
      <payment-instrument-type>us_bank_account</payment-instrument-type>
      <us-bank-account>
        <routing-number>123456789</routing-number>
        <last-4>1234</last-4>
        <account-type>checking</account-type>
        <account-holder-name>Dan Schulman</account-holder-name>
      </us-bank-account>
    </transaction>
  XML
end

#_transaction_settlement_declined_sample_xml(id) ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/braintree/webhook_testing_gateway.rb', line 321

def _transaction_settlement_declined_sample_xml(id)
  <<-XML
    <transaction>
      <id>#{id}</id>
      <status>settlement_declined</status>
      <type>sale</type>
      <currency-iso-code>USD</currency-iso-code>
      <amount>100.00</amount>
      <merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
      <payment-instrument-type>us_bank_account</payment-instrument-type>
      <us-bank-account>
        <routing-number>123456789</routing-number>
        <last-4>1234</last-4>
        <account-type>checking</account-type>
        <account-holder-name>Dan Schulman</account-holder-name>
      </us-bank-account>
    </transaction>
  XML
end

#_venmo_account_xml(id) ⇒ Object



1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
# File 'lib/braintree/webhook_testing_gateway.rb', line 1188

def (id)
  <<-XML
    <venmo-account>
      <created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
      <updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
      <default type='boolean'>true</default>
      <image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
      <token>#{id}</token>
      <source-description>Venmo Account: venmojoe</source-description>
      <username>venmojoe</username>
      <venmo-user-id>456</venmo-user-id>
      <subscriptions type='array'/>
      <customer-id>venmo_customer_id</customer-id>
      <global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
    </venmo-account>
    XML
end

#sample_notification(kind, id, source_merchant_id = nil) ⇒ Object



9
10
11
12
13
14
# File 'lib/braintree/webhook_testing_gateway.rb', line 9

def sample_notification(kind, id, source_merchant_id=nil)
  payload = Base64.encode64(_sample_xml(kind, id, source_merchant_id))
  signature_string = "#{@config.public_key}|#{Braintree::Digest.hexdigest(@config.private_key, payload)}"

  return {:bt_signature => signature_string, :bt_payload => payload}
end