gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: match latest refund API of th


From: gnunet
Subject: [taler-wallet-core] branch master updated: match latest refund API of the merchant
Date: Thu, 20 Aug 2020 08:09:40 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 7ff93d8e match latest refund API of the merchant
7ff93d8e is described below

commit 7ff93d8ef64d8ae832c2267192ce1f97bf914776
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Thu Aug 20 11:39:34 2020 +0530

    match latest refund API of the merchant
---
 packages/taler-wallet-core/src/operations/refund.ts | 14 ++++++--------
 packages/taler-wallet-core/src/types/talerTypes.ts  | 18 ++++++++++++++++--
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/refund.ts 
b/packages/taler-wallet-core/src/operations/refund.ts
index fb39aa63..e9324712 100644
--- a/packages/taler-wallet-core/src/operations/refund.ts
+++ b/packages/taler-wallet-core/src/operations/refund.ts
@@ -48,6 +48,7 @@ import {
   MerchantCoinRefundFailureStatus,
   codecForMerchantOrderStatusPaid,
   AmountString,
+  codecForMerchantOrderRefundPickupResponse,
 } from "../types/talerTypes";
 import { guardOperationException } from "./errors";
 import { getTimestampNow, Timestamp } from "../util/time";
@@ -472,25 +473,22 @@ async function processPurchaseQueryRefundImpl(
     return;
   }
 
-
   const requestUrl = new URL(
-    `orders/${purchase.contractData.orderId}`,
+    `orders/${purchase.contractData.orderId}/refund`,
     purchase.contractData.merchantBaseUrl,
   );
-  requestUrl.searchParams.set(
-    "h_contract",
-    purchase.contractData.contractTermsHash,
-  );
 
   logger.trace(`making refund request to ${requestUrl.href}`);
 
-  const request = await ws.http.get(requestUrl.href);
+  const request = await ws.http.postJson(requestUrl.href, {
+    h_contract: purchase.contractData.contractTermsHash,
+  });
 
   logger.trace("got json", JSON.stringify(await request.json(), undefined, 2));
 
   const refundResponse = await readSuccessResponseJsonOrThrow(
     request,
-    codecForMerchantOrderStatusPaid(),
+    codecForMerchantOrderRefundPickupResponse(),
   );
 
   await acceptRefunds(
diff --git a/packages/taler-wallet-core/src/types/talerTypes.ts 
b/packages/taler-wallet-core/src/types/talerTypes.ts
index 99f44ea2..f251b47d 100644
--- a/packages/taler-wallet-core/src/types/talerTypes.ts
+++ b/packages/taler-wallet-core/src/types/talerTypes.ts
@@ -849,6 +849,13 @@ interface MerchantOrderStatusPaid {
    * Amount that was refunded in total.
    */
   refund_amount: AmountString;
+}
+
+interface MerchantOrderRefundResponse {
+  /**
+   * Amount that was refunded in total.
+   */
+  refund_amount: AmountString;
 
   /**
    * Successful refunds for this payment, empty array for none.
@@ -1265,12 +1272,19 @@ export const codecForMerchantOrderStatusPaid = (): 
Codec<
   MerchantOrderStatusPaid
 > =>
   buildCodecForObject<MerchantOrderStatusPaid>()
-    .property("merchant_pub", codecForString())
     .property("refund_amount", codecForString())
     .property("refunded", codecForBoolean)
-    .property("refunds", codecForList(codecForMerchantCoinRefundStatus()))
     .build("MerchantOrderStatusPaid");
 
+export const codecForMerchantOrderRefundPickupResponse = (): Codec<
+    MerchantOrderRefundResponse
+  > =>
+    buildCodecForObject<MerchantOrderRefundResponse>()
+      .property("merchant_pub", codecForString())
+      .property("refund_amount", codecForString())
+      .property("refunds", codecForList(codecForMerchantCoinRefundStatus()))
+      .build("MerchantOrderRefundPickupResponse");
+
 export const codecForMerchantOrderStatusUnpaid = (): Codec<
   MerchantOrderStatusUnpaid
 > =>

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]